clase 20 sept

334 days ago by etlopez18

f(x)=e^x-4 
       
plot(f,(x,0,4)) 
       
x0=1 x1=3 
       
x2=(x0*f(x1)-x1*f(x0))/(f(x1)-f(x0)); x2.n() 
       
1.14760169808642
1.14760169808642
###ecuacion y=f(x0)+(f(x1)-f(x0))/(x1-x0)*(x-x0) recta1(x)=f(x0)+(f(x1)-f(x0))/(x1-x0)*(x-x0) grafrecta=plot(recta1,(x,0,3),color='red') 
       
plot(f,(x,0,3))+grafrecta+grafrecta2 
       
x3=(x1*f(x2)-x2*f(x1))/(f(x2)-f(x1)); x3.n() 
       
1.24050894735226
1.24050894735226
###ecuacion y=f(x0)+(f(x1)-f(x0))/(x1-x0)*(x-x0) recta2(x)=f(x1)+(f(x2)-f(x1))/(x2-x1)*(x-x1) grafrecta2=plot(recta2,(x,1,3),color='green') 
       
x1=x2 x2=x3 
       
x4=(x1*f(x2)-x2*f(x1))/(f(x2)-f(x1)); x4.n() 
       
1.40486052077335
1.40486052077335
###ecuacion y=f(x0)+(f(x1)-f(x0))/(x1-x0)*(x-x0) recta3(x)=f(x1)+(f(x2)-f(x1))/(x2-x1)*(x-x1) grafrecta3=plot(recta3,(x,1,3),color='violet') 
       
plot(f,(x,0,3))+grafrecta+grafrecta2+grafrecta3 
       
x4.n()-log(4).n() 
       
0.0185661596534559
0.0185661596534559
x4.n()-x3.n() 
       
0.164351573421091
0.164351573421091
x1=x3 x2=x4 
       
x5=(x1*f(x2)-x2*f(x1))/(f(x2)-f(x1)); x5.n() 
       
1.38491265026516
1.38491265026516
x5.n()-x4.n() 
       
-0.0199478705081815
-0.0199478705081815
####PUNTO FIJO F(x)=cos(x) x0=0.5 
       
x1=F(0.5); x1 
       
0.877582561890373
0.877582561890373
x2=F(x1); x2 
       
0.639012494165259
0.639012494165259
x3=F(x2); x3 
       
0.802685100682335
0.802685100682335
x4=F(x3); x4 
       
0.694778026788006
0.694778026788006
x5=F(x4); x5 
       
0.768195831282016
0.768195831282016
x6=F(x5); x6 
       
0.719165445942419
0.719165445942419
points([(0,x0),(1,x1),(2,x2),(3,x3),(4,x4),(5,x5),(6,x6)]) 
       
f(x)=-3*x+e^(-x) 
       
f(0); f(1).n() 
       
1
-2.63212055882856
1
-2.63212055882856