|
|
Lösen linearer Gleichungssysteme

Lösen eines linearen Gleichungssystems mit 3 Gleichungen und 4 Variablen
> |
gl:= (a,b,c,d,e) -> a*x[1]+b*x[2]+c*x[3]+d*x[4] = e:
gl(a,b,c,d,e); |
![a*x[1]+b*x[2]+c*x[3]+d*x[4] = e](images-llinglsy/llinglsy1.gif)
> |
gl1:= gl(1, -1, -2, -2, 4):
gl2:= gl(3, -6, -2, 3, 12):
gl3:= gl(2, -5, -5, 8, 3):
gl1; gl2; gl3; |
![x[1]-x[2]-2*x[3]-2*x[4] = 4](images-llinglsy/llinglsy2.gif)
![3*x[1]-6*x[2]-2*x[3]+3*x[4] = 12](images-llinglsy/llinglsy3.gif)
![2*x[1]-5*x[2]-5*x[3]+8*x[4] = 3](images-llinglsy/llinglsy4.gif)
![x[3] := t](images-llinglsy/llinglsy5.gif)
> |
assign (solve ({gl1, gl2, gl3}, {x[1], x[2], x[4]})):
x[1]:= x[1]; x[2]:= x[2]; x[4]:= x[4]; |
![x[1] := -13/3+35/3*t](images-llinglsy/llinglsy6.gif)
![x[2] := 19/3*t-5](images-llinglsy/llinglsy7.gif)
![x[4] := -5/3+5/3*t](images-llinglsy/llinglsy8.gif)
Lösen eines 3x3-Gleichungssystems mit Hilfe von linsolve
> |
restart; with (linalg):
Warning, the protected names norm and trace have been redefined and unprotected |
> |
A:= matrix ([[0.4, 1, 3],
[1.2, -2, 1], [0.5, 2, -4]]);
b:= <2, 3, 1/2>; |

![b:= [2, 3, 1/2]](images-llinglsy/llinglsy31.gif)
A und b definieren ein lineares 3x3-Gleichungssystem mit den Unbekannten
x1, x2 und x3:
> |
x:= array (1..3):
ls:= evalm (A &* x):
for i to 3 do ls[i] = b[i] od; |
![.4*x[1]+x[2]+3*x[3] = 2](images-llinglsy/llinglsy11.gif)
![1.2*x[1]-2*x[2]+x[3] = 3](images-llinglsy/llinglsy12.gif)
![.5*x[1]+2*x[2]-4*x[3] = 1/2](images-llinglsy/llinglsy13.gif)
Lösen dieses Gleichungssystems, d.h. Lösen der Gleichung A x = b:
> |
for i to 3 do
x[i]:= evalf (linsolve (A, b)[i], 4);
od; |
![x[1] := 2.542](images-llinglsy/llinglsy14.gif)
![x[2] := .1620](images-llinglsy/llinglsy15.gif)
![x[3] := .2738](images-llinglsy/llinglsy16.gif)
Die allgemeine Lösung eines 3x3-Gleichungssystems
> |
restart; with (linalg):
Warning, the protected names norm and trace have been redefined and unprotected |
> |
A:= matrix ([[a[11],
a[12], a[13]],
[a[21], a[22], a[23]],
[a[31], a[32], a[33]]]);
B:= Vector ([[b[1], b[2], b[3]]); |
![B = [b1, b2, b3]](images-llinglsy/llinglsy30.gif)
> |
for i to 3 do x[i]:=
linsolve (A, B)[i]; od:
for i to 3 do x[i]:= collect (x[i],[a[11],a[21],a[31]]); od; |


Die Gleichung Ax = B ist also nur dann eindeutig lösbar, wenn die
Determinante von A von 0 verschieden ist.
|