newton method

May 2010
39
0
Code:
if (x2 - x1)/x2 < err
return
end
Is this terminating condition correct for newton raphson method?
 

CaptainBlack

MHF Hall of Fame
Nov 2005
14,972
5,271
someplace
Code:
if (x2 - x1)/x2 < err
return
end
Is this terminating condition correct for newton raphson method?
No, it at least needs an abs() on the left of the inequality.

CB
 
May 2010
39
0
cant i say

if feval(fx,x) < err
return
end

fx is the function
x is the value of x at current iteration

So fx(x) < err means x is very close to the root

Am i correct in this case?
 

CaptainBlack

MHF Hall of Fame
Nov 2005
14,972
5,271
someplace
cant i say

if feval(fx,x) < err
return
end

fx is the function
x is the value of x at current iteration

So fx(x) < err means x is very close to the root

Am i correct in this case?
suppose err=0.0001 and fx(x)=-200 ?

CB
 
May 2010
39
0
oh yeah i forgot

it should be

abs(f(x) ) < err


absolute value so -200 will be 200 in this case

is it okay to use this technique?
 
Similar Math Discussions Math Forum Date
Calculus
Calculus
Calculus
Calculus