Section11Non-Linear Regression¶ permalink
Subsection11.1The Motivation: Newton's Method¶ permalink
xxxxxxxxxx
f(x) = cos(x)-0.5
plot(f(x), (x, 0, 2), color='green',thickness=3)
xxxxxxxxxx
f(x) = cos(x)-0.5
fp(x) = f.derivative()
x0=0.5
tl(x)=f(x0)+fp(x0)*(x-x0)
P = plot(f(x),(x,0,2),color='green',thickness=3)
Q = plot(tl(x),(x,0,2),color='red',thickness=2)
P+Q
xxxxxxxxxx
(0 == cos(x)-0.5).find_root(0,2)
xxxxxxxxxx
f(x) = cos(x)-0.5
fp(x) = f.derivative()
x1=0.5-f(0.5)/fp(0.5)
x1
xxxxxxxxxx
f(x) = cos(x)-0.5
fp(x) = f.derivative()
x0=0.5
x1=x0-f(x0)/fp(x0)
x0=x1
tl(x)=f(x0)+fp(x0)*(x-x0)
P = plot(f(x),(x,0,2),color='green',thickness=3)
Q = plot(tl(x),(x,0,2),color='red',thickness=2)
P+Q
xxxxxxxxxx
f(x) = cos(x)-0.5
fp(x) = f.derivative()
x0=0.5
x1=x0-f(x0)/fp(x0)
x0=x1
x1=x0-f(x0)/fp(x0)
x0=x1
x1=x0-f(x0)/fp(x0)
x0=x1
x1=x0-f(x0)/fp(x0)
x0=x1
x1=x0-f(x0)/fp(x0)
x0=x1
x1=x0-f(x0)/fp(x0)
x0=x1
x1=x0-f(x0)/fp(x0)
x0=x1
x1=x0-f(x0)/fp(x0)
x0=x1
x1=x0-f(x0)/fp(x0)
x0=x1
x1=x0-f(x0)/fp(x0)
x0=x1
x0