1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
| program interpolation;
uses crt;
var xmin,seuil,x0,x1,y:real;
s:integer;
function f(x0:real):real;
begin
f:=x0*x0*x0+2*x0+1;
end;
Function newt(x:real):real;
Begin
newt:=(2*x*x*x-1)/(3*x*x+2);
End;
Function lag(x:real):real;
Begin
lag:=(-x*x+x-1)/(x*x-x+3);
end;
procedure entree;
begin
gotoxy(1,10);
textcolor(14);
write('Donner la valeur de xmin :');
readln(xmin);
write('Donner la valeur de seuil :');
readln(seuil);
End;
Procedure Newton(x1,seuil:real);
Begin
x0:=x1;
while abs(x0-newt(x0))>=seuil do
Begin
y:=newt(x0);
x0:=y;
End;
writeln ('Valeur de solution est de: ',x0);
textcolor(4);
writeln('voullez tapez la touche Entr pour choisir une autre methode');
End;
Procedure Lagrange(x1,seuil:real);
Begin
x0:=x1;
while abs(x0-lag(x0))>=seuil do
Begin
y:=lag(x0);
x0:=y;
End;
writeln('Valeur de solution de: ',x0);
textcolor(4);
writeln('voullez tapez la touche Entr pour choisir une autre methode');
End;
begin
repeat
clrscr;
gotoxy(28,2);
textcolor(10);
writeln(interpolation) ;
textcolor(4);
gotoxy(23,4);
writeln('le mini projet d"analyse Nemurique ');
textcolor(10);
gotoxy(15,6);
writeln('"le Recherche du solutions de l"equation 2+üx+1"');
gotoxy(18,8);
textcolor(9);
writeln('********************************************');
gotoxy(18,9);
textcolor(7);
writeln('* Choisisez la methode que vous voulez: *');
gotoxy(18,11);
textcolor(26);
writeln('* -1- pour la methode de NEWTON *');
gotoxy(18,13);
textcolor(14) ;
writeln('* -2- pour la methode de lagrange *');
gotoxy(18,15);
textcolor(7);
writeln('* -3- pour sortir *');
gotoxy(18,17);
textcolor(9) ;
writeln('********************************************');
textcolor(15);
readln(s);
case s of
1:
begin
clrscr;
gotoxy(28,4);
textcolor(26);
writeln(interpolation) ;
textcolor(14);
gotoxy(23,6);
writeln('le mini projet d"analyse Nemurique ');
gotoxy(15,8);
textcolor(26);
writeln('"le Recherche du solutions de l"equation (newton) 2+üx+1"');
entree;
newton(xmin,seuil);
end;
2:
begin
clrscr;
gotoxy(28,4);
textcolor(26);
writeln(interpolation) ;
textcolor(14);
gotoxy(23,6);
writeln('le mini projet d"analyse Nemurique ');
gotoxy(15,8);
textcolor(26);
writeln('"le Recherche du solutions de l"equation lagrange) 2+üx+1"');
entree;
Lagrange(xmin,seuil);
end;
end;
write(FIN DE PROGRAMME) ;
readln;
until s=3;
end. |
Partager