Table des Matières

Publicité

Résolution d'un système d'équations linéaires
Texte de la fonction
resol

Exemples

Dans le cas d'un système dégénéré, ce programme se charge de la
résolution effective à partir de la matrice des coefficients en appelant
la fonction
.
rref
: resol(matcoeff,lvar)
: Func
: local i,n,mat,sol,lc,c
: rref(matcoeff) " mat
: dim(lvar) " n
: {} " sol
: For i,1,n
subMat(mat,i,1,i,n) " lc
:
mat[i,n+1] " c
:
If norm(lc)π0 Then
:
augment(sol,{sum(matúlist(lc)*lvar)=c}) "sol
:
ElseIf norm(lc)=0 and cπ0 Then
:
return "Système incompatible"
:
EndIf
:
: EndFor
: sol
: EndFunc
Système
R
S |
+
+ =
x
3
y z
1
− +
=
T |
2
x y
3
z
1
− + =
0
x y z
R
S |
+ + =
x y z
1
− +
=
T |
2
3
1
x y
z
+
=
x
2
y
2
z
0
R S
+ =
a x y
1
T
+
=
x a y
1
Résolution
syst({x+3y+z=1, 2x-y+3z=1,x-y+z=0},
{x,y,z}) ¸
syst({x+y+z=1,2x-y+3z=1,x-2y+2z=0},
{x,y,z}) ¸
R S
4
z
+
=
T
x
3
y=1}"s ¸
{a
x+y=1,x+a
*
*
syst(s,{x,y}) ¸
syst(s,{x,y}) | a=1 ¸
syst(s,{x,y})| a=-1 ¸
"
Exemples de programmes
(suite)
L
O
M M
P P
1
/
2
M M
P P
1
/
4
N
Q
3
/
4
U V
z
=
W
2
/
3
y
1
/
3
3
L
O
M M
P P
1
+
a
1
2
M M
P P
a
1
and
1
N
Q
+
a
1
+
= 1
{
x
y
}
système incompatible
"
35–3

Publicité

Table des Matières
loading

Table des Matières