Хелпикс

Главная

Контакты

Случайная статья





F(x) = x - sin(x) - 0.25. plot(x, x-sin(x)-0.25). Fx1=x1-sin(x1)-0.25. Fx2=x2-sin(x2)-0.25. while abs(x2-x1)>Eps. Fx3=x3-sin(x3)-0.25. if sign(Fx1*Fx3)==-1 x2=x3; end. if sign(Fx2*Fx3)==-1 x1=x3; end. while dx>Eps. x=x0-(x0-sin(x0)-0.25)/(1-cos(x0))



 

 

F(x) = x - sin(x) - 0.25

 

Построение графика:

 

x = 0.5:0.1:1.5

plot(x, x-sin(x)-0.25)

 

 

 

Задание 1:

 

Eps=10^(-4)

n=0

x1=0.5

x2=2

Fx1=x1-sin(x1)-0.25

Fx2=x2-sin(x2)-0.25

while abs(x2-x1)>Eps

n=n+1

x3=(x1+x2)/2

Fx3=x3-sin(x3)-0.25

if sign(Fx1*Fx3)==-1 x2=x3; end

if sign(Fx2*Fx3)==-1 x1=x3; end

end

clc

n

x1

x2

abs(x2-x1) 

 

Задание 2:

 

Eps=10^(-4)

n=0

x0=1

dx=1

while dx>Eps

n=n+1

x=x0-(x0-sin(x0)-0.25)/(1-cos(x0))

dx=abs(x-x0)

x0=x

end

cls

n

x0

dx



  

© helpiks.su При использовании или копировании материалов прямая ссылка на сайт обязательна.