Accueil > > > RÉSOLUTION D'UN SYSTÈME LINÉAIRE NXP PAR LA MÉTHODE DU PIVOT DE GAUSS (DIAGONALISATION)
RÉSOLUTION D'UN SYSTÈME LINÉAIRE NXP PAR LA MÉTHODE DU PIVOT DE GAUSS (DIAGONALISATION)
Information sur la source
Description
Ce programme permet la résolution numérique d'un système d'équations linéaires. Les systèmes sont édités puis sauvegardés (format .txt) dans le repertoire "matrices". Le programme montre la résolution étape par étape du système. Le rang du système est donné à la dernière étape.
Source
- procedure TForm1.resolClick(Sender: TObject);
- var
- i,j : integer;
- a,coef : extended;
- b,pivot_af : string;
-
- begin
- // à l'initialisation toutes les étapes sont true sauf etape1 à false.
- // étape 5
- if etape5=false then etape1:=false;
- etape5:=true;
- // étape 4,élimination des coef. de la colonne pivot : Li=Li-aij*Lipiv.
- if etape4=false then
- begin
-
- edit1.text:='élimination des coef. de la colonne pivot(rang='+inttostr(rang)+')';
- sleep(2000);
-
- for i:=1 to dim.ligne do
- begin
- if i<>ipiv then
- begin
- coef:= mat[i,jpiv];
- for j:=1 to dim.colonne do
- begin
- mat[i,j]:= mat[i,j]-coef*mat[ipiv,j];
- end;
- vect[i]:=vect[i]-vect[ipiv]*coef;
- end;
- end;
- form1.paint;
- if rang=dim.ligne then
- begin
- etape4:=true;
- end
- else
- begin
- etape4:=true;etape5:=false;
- pivot:=false;
- end;
-
- end;
- // étape 3, division de la ligne par le pivot.
- if etape3=false then
- begin
- a:=mat[ipiv,jpiv];
- str( a:3:3,pivot_af);
- edit1.text:='division de la ligne '+inttostr(ipiv)+' par le pivot.('+pivot_af+')';
- sleep(1000);
- for j:=1 to dim.colonne do
- begin
- mat[ipiv,j]:=mat[ipiv,j]/a;
- end;
- vect[ipiv]:=vect[ipiv]/a;
- form1.paint;
- etape3:=true;etape4:=false;
- end;
-
- // étape 2, permutation des lignes ou colonnes.
- if etape2=false then
- begin
- edit1.text:='ipiv ='+inttostr(ipiv);
- if ipiv<>rang then
- begin
- edit1.text:='permutation des lignes '+inttostr(rang)+' et '+inttostr(ipiv);
- sleep(1000);
- for j:=1 to dim.colonne do
- begin
- a:= mat[rang,j];
- mat[rang,j]:= mat[ipiv,j];
- mat[ipiv,j]:= a;
- end;
- a:=vect[rang];
- vect[rang]:=vect[ipiv];
- vect[ipiv]:=a;
- end;
-
- if jpiv<>rang then
- begin
- edit1.text:='permutation des colonnes'+inttostr(rang)+'et'+inttostr(jpiv);
- sleep(2000);
- for i:=1 to dim.ligne do
- begin
- a:= mat[i,rang];
- mat[i,rang]:= mat[i,jpiv];
- mat[i,jpiv]:= a;
- end;
- b:=inc[rang];
- inc[rang]:=inc[jpiv];
- inc[jpiv]:=b;
- end;
- form1.Paint;
- ipiv:=rang;
- jpiv:=rang;
- etape2:=true;etape3:=false;
-
- end;
- // étape 1, recherche du pivot dans une sous-matrice complète.
- if etape1=false then
- begin
-
- for j:=rang+1 to dim.colonne do
- begin
- for i:= rang+1 to dim.ligne do
- begin
- if pivot = false then
- begin
- if mat[i,j] <> 0 then
- begin
- pivot:= true;
- rang:=rang+1;
- ipiv:=i;
- jpiv:=j;
- end;
- end;
- end;
- end;
- if pivot=true then
- begin
- str(mat[ipiv,jpiv]:3:3,pivot_af);
- edit1.text:=' pivot trouvé '+inttostr(ipiv)+','+inttostr(jpiv)+' = '+pivot_af;
- sleep(1000);
- end;
- if (pivot = false) and (rang = 0) then edit1.text:='rang nul';
- if (pivot = false) and (rang <> 0) then edit1.text:='rang de ce syst. linéaire = '+inttostr(rang);
- if pivot = true then
- begin
- if (ipiv<> rang) or (jpiv<> rang) then
- begin
- edit1.text:='permutation '+inttostr(ipiv)+inttostr(jpiv);
- etape1:=true;etape2:=false;
- end
- else
- begin
- // edit1.text:='division de la ligne '+inttostr(ipiv)+'par le pivot';
- etape1:=true;etape3:=false;
- end;
- end;
- end;
- end;
procedure TForm1.resolClick(Sender: TObject);
var
i,j : integer;
a,coef : extended;
b,pivot_af : string;
begin
// à l'initialisation toutes les étapes sont true sauf etape1 à false.
// étape 5
if etape5=false then etape1:=false;
etape5:=true;
// étape 4,élimination des coef. de la colonne pivot : Li=Li-aij*Lipiv.
if etape4=false then
begin
edit1.text:='élimination des coef. de la colonne pivot(rang='+inttostr(rang)+')';
sleep(2000);
for i:=1 to dim.ligne do
begin
if i<>ipiv then
begin
coef:= mat[i,jpiv];
for j:=1 to dim.colonne do
begin
mat[i,j]:= mat[i,j]-coef*mat[ipiv,j];
end;
vect[i]:=vect[i]-vect[ipiv]*coef;
end;
end;
form1.paint;
if rang=dim.ligne then
begin
etape4:=true;
end
else
begin
etape4:=true;etape5:=false;
pivot:=false;
end;
end;
// étape 3, division de la ligne par le pivot.
if etape3=false then
begin
a:=mat[ipiv,jpiv];
str( a:3:3,pivot_af);
edit1.text:='division de la ligne '+inttostr(ipiv)+' par le pivot.('+pivot_af+')';
sleep(1000);
for j:=1 to dim.colonne do
begin
mat[ipiv,j]:=mat[ipiv,j]/a;
end;
vect[ipiv]:=vect[ipiv]/a;
form1.paint;
etape3:=true;etape4:=false;
end;
// étape 2, permutation des lignes ou colonnes.
if etape2=false then
begin
edit1.text:='ipiv ='+inttostr(ipiv);
if ipiv<>rang then
begin
edit1.text:='permutation des lignes '+inttostr(rang)+' et '+inttostr(ipiv);
sleep(1000);
for j:=1 to dim.colonne do
begin
a:= mat[rang,j];
mat[rang,j]:= mat[ipiv,j];
mat[ipiv,j]:= a;
end;
a:=vect[rang];
vect[rang]:=vect[ipiv];
vect[ipiv]:=a;
end;
if jpiv<>rang then
begin
edit1.text:='permutation des colonnes'+inttostr(rang)+'et'+inttostr(jpiv);
sleep(2000);
for i:=1 to dim.ligne do
begin
a:= mat[i,rang];
mat[i,rang]:= mat[i,jpiv];
mat[i,jpiv]:= a;
end;
b:=inc[rang];
inc[rang]:=inc[jpiv];
inc[jpiv]:=b;
end;
form1.Paint;
ipiv:=rang;
jpiv:=rang;
etape2:=true;etape3:=false;
end;
// étape 1, recherche du pivot dans une sous-matrice complète.
if etape1=false then
begin
for j:=rang+1 to dim.colonne do
begin
for i:= rang+1 to dim.ligne do
begin
if pivot = false then
begin
if mat[i,j] <> 0 then
begin
pivot:= true;
rang:=rang+1;
ipiv:=i;
jpiv:=j;
end;
end;
end;
end;
if pivot=true then
begin
str(mat[ipiv,jpiv]:3:3,pivot_af);
edit1.text:=' pivot trouvé '+inttostr(ipiv)+','+inttostr(jpiv)+' = '+pivot_af;
sleep(1000);
end;
if (pivot = false) and (rang = 0) then edit1.text:='rang nul';
if (pivot = false) and (rang <> 0) then edit1.text:='rang de ce syst. linéaire = '+inttostr(rang);
if pivot = true then
begin
if (ipiv<> rang) or (jpiv<> rang) then
begin
edit1.text:='permutation '+inttostr(ipiv)+inttostr(jpiv);
etape1:=true;etape2:=false;
end
else
begin
// edit1.text:='division de la ligne '+inttostr(ipiv)+'par le pivot';
etape1:=true;etape3:=false;
end;
end;
end;
end;
Conclusion
Une évolution du programme serait de faire un calcul formel sur des équations contenant des paramètres...
Historique
- 15 octobre 2008 20:56:57 :
- Pas de modification significative, à par la capture écran...
Sources du même auteur
Sources de la même categorie
Commentaires et avis
|
Derniers Blogs
SESSION SILVERLIGHT 5 3D : SLIDES ET DEMOSSESSION SILVERLIGHT 5 3D : SLIDES ET DEMOS par Groc
Durant les techdays, j'ai eu le plaisir d'animer une session sur Silverlight 5 et la 3D avec Simon Ferquel. Comme promis, voici nos slides et mes démos (celles avec le viper BSG) ici et là. Pour mémoire, les démos utilisent toutes le viper BSG...
Cliquez pour lire la suite de l'article par Groc [TECHDAYS 2012] SESSION WEBMATRIX 2 : LE COUTEAU SUISSE GRATUIT POUR VOS DéVELOPPEMENTS WEB - SLIDES[TECHDAYS 2012] SESSION WEBMATRIX 2 : LE COUTEAU SUISSE GRATUIT POUR VOS DéVELOPPEMENTS WEB - SLIDES par gpommier
Suite à la session que j'ai présenté sur WebMatrix 2, vous pouvez trouver les slides ici, ainsi que les démos en packages nuget : démos1 et démos2 J'en profite pour remercier chaleureusement tous ceux qui sont venus très nombreux à cette sess...
Cliquez pour lire la suite de l'article par gpommier [SHAREPOINT] LES SESSIONS TECHDAYS 2012.[SHAREPOINT] LES SESSIONS TECHDAYS 2012. par Patrick Guimonet
Voici donc pour ceux qui n'ont pas pu venir, ou ceux qui n'ont pas pu toutes les suivre la liste des sessions SharePoint aux TechDays 2012, que je mettrais à jour dès que les liens des vidéo seront disponibles. Ou ici : http...
Cliquez pour lire la suite de l'article par Patrick Guimonet TECHDAYS PARIS 2012 : SESSION PLEINIèRE JOUR 3TECHDAYS PARIS 2012 : SESSION PLEINIèRE JOUR 3 par ROMELARD Fabrice
Speaker: Bernard Ourghanlian Cette session est comme chaque jour transmise en live par BrainSonic, et j'ai donc suivi cette troisième pleinière par ce moyen sur mon iPad . Elle est dédiée comme chaque année à la mise en perspective de l'é...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice MISHRA READER : UN LECTEUR RSS TRèS ZUNE STYLE EN OPEN SOURCE !MISHRA READER : UN LECTEUR RSS TRèS ZUNE STYLE EN OPEN SOURCE ! par Vko
Hier durant une session dédiée aux Techdays 2012, j'ai eu le plaisir d'annoncer la sortie de la Béta 2 de Mishra Reader. C'est quoi ? Pour les utilisateurs, c'est une vraie expérience de lecture de flux RSS sur Windows. Rien à voir avec les produit...
Cliquez pour lire la suite de l'article par Vko
Logiciels
Academy System (17.2.1.0)ACADEMY SYSTEM (17.2.1.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System Easy-Planning (1.0.0.1)EASY-PLANNING (1.0.0.1)Basé sur les mêmes principes que MyPlanning, Easy-Planning permet de créer des plannings sous la ... Cliquez pour télécharger Easy-Planning COLLECTOR PLUS (3.00B)COLLECTOR PLUS (3.00B)COLLECTOR PLUS version 3.00B est un logiciel utilisant une base de données alimentée par :
- L... Cliquez pour télécharger COLLECTOR PLUS PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V7.4)PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V7.4)PONAMEDIA TV DEVIENS HELLLOOO FLASH
LA TV SUR VOTRE ORDINATEUR.
Toute une plateforme Multi... Cliquez pour télécharger PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO LettresFaciles 2011 (8.0.0.1)LETTRESFACILES 2011 (8.0.0.1)LettresFaciles est un logiciel facilitant la création et la rédaction de lettres types.
Son inte... Cliquez pour télécharger LettresFaciles 2011
|