.


:




:

































 

 

 

 


. /*ii */




/*ii */

#include<stdio.h>

main()

{

FILE *stream;

int i,j,n;

float x[10],y[10],d[10][10],xx,h,nh,p,s,fact;

printf("i - i iii");

scanf("%d",&n);

stream=fopen("ne.txt","w");

fprintf(stream,"Ii \n");

fprintf(stream,"x ");

for (i=0;i<n;i++)

{puts("i x");

scanf("%f",&x[i]);

fprintf(stream,"%5.2f ",x[i]);

};

fprintf(stream,"\ny ");

for (i=0;i<n;i++)

{puts("i y");

scanf("%f",&y[i]);

fprintf(stream,"%1.3f ",y[i]);

};

printf("i iii ");

scanf("%f",&xx);

for(i=0;i<=n-1;i++)

d[i][0]=y[i+1]-y[i];

for(j=1;j<n;j++)

for(i=0;i<n;i++)

d[i][j]=d[i+1][j-1]-d[i][j-1];

fprintf(stream,"\nx=%5.3f",xx);

s=y[0];

p=1.0;

h=x[1]-x[0];

nh=1.0;

fact=1.0;

for(i=0;i<n-1;i++)

{ fact*=(i+1);

nh*=h;

p*=xx-x[i];

s+=d[0][i]*p/(fact*nh);

};

fprintf(stream,"\ny=%5.4f",s);

printf("y=%5.4f",s);

fclose(stream);

}

Ii

X 3.00 7.00 11.00 15.00 19.00

Y 4.000 10.000 22.000 26.000 33.000

x=13.000

y=24.8984

, .


 

Pascal bibl.tpu, . .

 

program newt;

{$M 65520,0,655360}

{ }

Uses Crt,bibl;

 

{ }

var i,j,k,n,m:integer;

s,p,q,p1:poli;

fact,h,nh,t,w:real;

x,y:array[1..20] of real;

d:array[1..20,1..20] of real;

begin

{ i zero i ii i od}

zerod;

assign(fi,'newt.txt');

rewrite(fi);

{i i}

writeln('i i ');

readln(n);

for i:=1 to n do begin

writeln('i x[',i,'] y[',i,']');

readln(x[i],y[i]);

end;

writeln('i iii ');

readln(t);

writeln(' x y');

for i:=1 to n do writeln(x[i]:5:2,' ',y[i]:5:2);

writeln(fi,' x y');

for i:=1 to n do writeln(fi,x[i]:5:2,' ',y[i]:5:2);

writeln(' iii ',t:5:3);

writeln(fi,' iii ',t:5:3);

s:=zero;

s[0]:=y[1];

h:=x[2]-x[1];

for i:=1 to n do d[i,1]:=y[i+1]-y[i];

for j:=2 to n do

for i:=1 to n do

d[i,j]:=d[i+1,j-1]-d[i,j-1];

fact:=1;nh:=1;

p:=od;

for i:=1 to n-1 do

begin

fact:=fact*i;

nh:=nh*h;

q:=zero;

q[1]:=1;q[0]:=-x[i];

dobutok(p,q,p);

dobchy(p,d[1,i]/fact/nh,p1);

suma(s,p1,s);

end;

writeln(' ');

writeln(fi,' ');

vyvid(s);

fvyvid(s);

writeln;

writeln(fi);

w:=znach(s,t);

writeln(' i iii=',w:5:3);

writeln(fi,' i iii=',w:5:3);

close(fi);

end.





:


: 2015-09-20; !; : 476 |


:

:

, - , ; , - .
==> ...

1474 - | 1482 -


© 2015-2024 lektsii.org - -

: 0.009 .