Vous êtes sur la page 1sur 5

Ministère de l’Education Nationale REPUBLIQUE DU MALI

**************** Un Peuple – Un But – Une Foi


Direction Nationale de ****************
l’Enseignement Supérieur et de la
Recherche Scientifique
****************

ECOLE NATIONALE D’INGENIEURS ABDERHAMANE BABA TOURE (ENI-ABT)


DEPARTEMENT DE GEOLOGIE ET MINES
Licence 2 – Semestre 4

RAPPORT DES TPs CALCUL NUMERIQUE


Elaboré par GROUPE :
Issiaka SIDIBE
Moussa Amadou SANGARE
Bintou Idrissa MAIGA
Mohamed HAIDARA
Chèckinè SISSOKO

Note Appréciations

Pr. Chargé du cours : Dr Alpha KEITA


1. Méthode d’Euler :
a) Enoncé
𝑦 ′ = 𝟑𝒙 − 2𝑦
Soit le problème de Cauchy suivant : { avec t ∈ [𝟎; 𝟏]
𝑦(0) = 1

Trouver la valeur de y aux points t1=0.5 et t2=1.0 par la méthode d’Euler avec un
pas h=0.5.
b) Programme en C

#include<stdio.h>
#include<math.h>
float f(float x, float y){
return 3*x - 2y;}
int main (){
int i=0;
float x0,y0,x,y,h,xn;
printf("Entrez les valeurs de:\n");
printf("x0="); scanf("%f",&x0);
printf("y0="); scanf("%f",&y0);
printf("\nEntrez la valeur du pas\nh="); scanf("%f",&h);
printf("\nxn="); scanf("%f",&xn);
x=x0; y=y0;
printf("\n");
while (x<xn){
y=y+(h*f(x,y)); x=x+h;
printf("n=%d\tx%d=%0.1f\ty%d=%0.4f\n",i,i,x,i,y);
i=i+1;
}
return 0;}

c) Solution

y(0.5) = 0
y(1.0)= 0.75
2. Méthode de Heun ou de RK d’ordre 2
a) Enoncé
𝑦 ′ = 𝑦 2 − 2𝑥
Soit le problème de Cauchy suivant : {
𝑦(0) = −1

Calculer 𝒚(𝟎, 𝟐), 𝒚(𝟎, 𝟒) et en utilisant la méthode de Heun ou RK2.


b) Programme en C
#include<stdio.h>
#include<math.h>
float f(float x, float y){
return y*y – 2*x;}
int main (){
int i=1;
float x0,y0,k1,k2,x,y,h,xn;
printf("Entrez les valeurs de:\n");
printf("x0="); scanf("%f",&x0);
printf("y0="); scanf("%f",&y0);
printf("\nEntrez la valeur du pas\nh="); scanf("%f",&h);
printf("\nxn="); scanf("%f",&xn);
x=x0; y=y0;
printf("\n");
while (x<xn){
k1 = f(x,y);
k2 = f((x+h),(y+k1*h));
y = y + (h*(k1+k2)/2);
x = x+h;
printf("n=%d\t x%d=%0.1f\t",i,i,x);
printf("k1=%0.4f\t k2=%0.4f\t",k1,k2);
printf("y%d=%0.4f\n",i,y);
i=i+1;}
return 0;}

Solution :

y(0.2) = -0.8760 ; y(0.4) = -0.8549


3. Méthode de RK d’ordre 4
c) Enoncé :
𝑥²
𝑦′ =
Soit le problème de Cauchy suivant : { 𝑦
𝑦(0) = 1
Calculer 𝒚(𝟎, 𝟐), 𝒚(𝟎, 𝟒) et 𝒚(𝟎, 𝟔) en utilisant la méthode de Runge-Kutta RK4.
d) Programme en C
#include<stdio.h>
#include<math.h>
float f(float x, float y){
return x*x/y;}
int main (){
int i=1;
float x0,y0,k1,k2,k3,k4,x,y,h,xn;
printf("Entrez les valeurs de:\n\n");
printf("x0="); scanf("%f",&x0);
printf("y0="); scanf("%f",&y0);
printf("\nEntrez la valeur du pas\nh="); scanf("%f",&h);
printf("\nxn="); scanf("%f",&xn);
x = x0; y = y0;
printf("\n");
while (x<xn){
k1 = f(x,y);
k2 = f((x+h/2.0),(y+k1*h/2.0));
k3 = f((x+h/2.0),(y+k2*h/2.0));
k4 = f((x+h),(y+h*k3));
y = y+(h*(k1+2*k2+2*k3+k4)/6); x = x+h;
printf("n=%d\tx%d=%0.1f\t",i,i,x);
printf("k1=%0.4f\t k2=%0.4f\tk3=%0.4f\t k4=%0.4f\t",k1,k2,k3,k4);
printf("y%d=%0.4f",i,y);
i=i+1; }
return 0;}

e) Solution

y(0.2)=1.0027 ; y(0.4)= 1.0211 ; y(0.6)=1.0696

Vous aimerez peut-être aussi