Can someone please explain to me why my approximations don\'t work for negative
ID: 3730485 • Letter: C
Question
Can someone please explain to me why my approximations don't work for negative x values? I've narrowed the fault down to my exponential_approx function but everything looks fine there. Thanks
xproblem1 Section-06-While Loop × /notebooks/problem 1.ipynb er problem1 Last Checkpoint: 03/07/2018 (autosaved) it View Insert Cell Kernel Widgets Help Home Before you turn this assignment in, make sure everything runs as expected: · First, restart the kernel (in the menubar, select Kernel Restart). . Second run all cells (in the menubar, select Cell Run A11) Problem 1 Consider the following series that can be used to calculate e But wait, aren't we dividing by zero in this series? Nope. 0! = I (https://zero-factor hatis htm) import numpy as npExplanation / Answer
In the original function, the error checking is done without removing the sign of the error. It works fine for positive but for negative it doesnt.
To rectify, change error =ans-preans to error=np.abs(ans-preans)