i have made a code for finding a derivative and now im trying to use it to help me with a code for the newton raphson method:
[CODE=python]
def derivative (f,x,h):
import math
return float(1/(2*h)) * (f(x+h) - f(x-h))
def solve (f,x0,h):
delta= f(x(n))/fp(x(n)
for x(n+1) in solve():
x(n)-delta[/CODE]
the first def works fine but i cant get the second def to work can anyone see what im doing wrong?
[CODE=python]
def derivative (f,x,h):
import math
return float(1/(2*h)) * (f(x+h) - f(x-h))
def solve (f,x0,h):
delta= f(x(n))/fp(x(n)
for x(n+1) in solve():
x(n)-delta[/CODE]
the first def works fine but i cant get the second def to work can anyone see what im doing wrong?
Comment