Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
| Download
Image: ubuntu2004
Kernel: Python 3 (system-wide)
Your Real Interest
The idea Newton-Raphson method is that in order to make it easier to find the interest we pretend that the equation is a line and then find the root of the line with the hope that the lines crossing is an excellent approximation to the root we actually need.
The Newton iteration is given by π₯π+1=π₯πβπ(π₯)/πβ²(π₯).The most basic version starts with a single-variable function f defined for a real variable x, the function's derivative fββ², and an initial guess x0 for a root of f. If the function satisfies sufficient assumptions and the initial guess is close (0.00001 in this case but usually a small so we get as cloose to r as possible) then x1=x0-f(x0)/f'(x0). The process is repeated as Xn+1= xn-f(Xn)/f'(Xn) until a sufficiently precise value is reached.
We define the function newton that takes on the f=function, df= derivative of function, x= intial guess, n=how many times we are will run the function (more accuurate the more it runs), err = your current approxiation.The loop approximately
In [4]:
In [5]:
Out[5]:
0.12106321628112304
95.33728282138439
In [2]:
Out[2]:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-2-5b6d19fa7902> in <module>
----> 1 Fridge_loan(0.0001)
<ipython-input-1-210fc1b4c415> in Fridge_loan(x)
3 R = 95.30
4 n = 19
----> 5 for i in range(t*n):
6 A = r/x[1-(r/n)**-n]
7 return x
NameError: name 't' is not defined