.


:




:

































 

 

 

 





, , repeat - until while-do.

12. y=2x-sin(x) [ xmin,xmax ] Dx, .. y(x), x [ xmin,xmax ].

repeat - until.

repeat - until:

Repeat

1;

2;

n;

until _;

repeat - until:

1) ;

2) _ true (), , , 1).

 

Program Prim12;

var

x, y, xmin, xmax, dx: real;

begin

writeln(' xmin,xmax,dx');

readln(xmin,xmax,dx);

x:=xmin;

repeat

y:=2*x-sin(x);

writeln('x=', x:7:2, ' y=', y:7:2);

x:=x+dx;

until x>xmax;

end.

 

: :

xmin = -2; xmax = 1; dx = 0.5 x= -2.00 y= -3.09

x= -1.50 y= -2.00

x= -1.00 y= -1.16

x= -0.50 y= -0.52

x= 0.00 y= 0.00

x= 0.50 y= 0.52

x= 1.00 y= 1.16

13. [ a,b] e .

. 1. [a,b] (x:=(a+b)/2).

2. x0 x.

3. : |x - x0|£e.

 

 

Program Prim13;

var

a,b,x,x0,eps: real;

n: integer;

begin

writeln('a,b,eps');

readln(a,b,eps);

x:=(a+b)/2;

n:=0;

repeat

x0:=x;

x:=sqrt(18+x0)+sqrt(16-x0);

n:=n+1;

until abs(x-x0)<=eps;

writeln('x=', x:8:5,' n=', n:3);

end.

 

 

: :

a = 6; b = 8; eps = 0.0001 x= 7.93272 n= 5

14. :

: |sin(nx)/n|£e

while-do.

while-do:

While _ do

Begin

1;

2;

n;

end;

while-do:

_ true (), , .

 

Program Prim14;

var

a,s,x,eps: real;

n: integer;

begin

writeln(' x, eps');

readln(x,eps);

s:=0;

n:=1;

a:=sin(x);

while abs(a)>eps do

begin

s:=s+a;

n:=n+1;

a:=sin(n*x)/n;

end;

writeln('s=', s:8:3);

end.

 

: :

x = 3.48; eps = 0.0001 s= -0.168

15.

: |xn/n!|£e

. 1. :

s:=0; n:=1; a:=x; - () .

2. x/n 1, .. , .. : a:= -a*x/n.

 

 

Program Prim15;

var

a,s,x,eps: real;

n: integer;

begin

writeln(' x,eps');

readln(x,eps);

s:=0;

n:=1;

a:=x;

while abs(a)>eps do

begin

s:=s+a;

n:=n+1;

a:= -a*x/n;

end;

writeln('s=', s:8:3);

end.

 

 

: :

x = 1.3; eps = 0.0001 s= 0.727

 

, , .

, , , .

, , , .





:


: 2016-10-30; !; : 837 |


:

:

, , .
==> ...

1792 - | 1687 -


© 2015-2024 lektsii.org - -

: 0.015 .