02.05.2014 Views

Patrick Corde & Anne Fouilloux

Patrick Corde & Anne Fouilloux

Patrick Corde & Anne Fouilloux

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Corrigés 230<br />

Corrigé de l’exercice 1<br />

1 program systeme<br />

2 implicit none<br />

3 real u1,u2<br />

4 real v1,v2<br />

5 real w1,w2<br />

6 real delta, delta_x, delta_y<br />

7 real x,y<br />

8<br />

9 ! Valorisation des coefficients.<br />

10 u1 = 2; u2 = 4<br />

11 v1 = 5; v2 = 11<br />

12 w1 = 7; w2 = 6<br />

13<br />

14 ! Calcul du déterminant principal.<br />

15 delta = u1*v2 - u2*v1<br />

16 if ( delta < 1e-6 ) then<br />

17 print *, "Le système n’a pas de solution unique."<br />

18 stop 4<br />

19 end if<br />

20 ! Calcul du déterminant en x.<br />

21 delta_x = w1*v2 - w2*v1<br />

22 ! Calcul du déterminant en y.<br />

23 delta_y = u1*w2 - u2*w1<br />

24 ! calcul des solutions.<br />

25 x = delta_x/delta<br />

26 y = delta_y/delta<br />

27 ! Impression des solutions.<br />

28 print *, "x = ", x, ", y = ", y<br />

29 end program systeme<br />

INSTITUT DU DÉVELOPPEMENT<br />

ET DES RESSOURCES<br />

EN INFORMATIQUE SCIENTIFIQUE<br />

Cours langage Fortran – 27 janvier 2006<br />

<strong>Patrick</strong> <strong>Corde</strong> et <strong>Anne</strong> <strong>Fouilloux</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!