Sie sind auf Seite 1von 2

wxMaxima document

Gauss Seidel

1 / 2

wxMaxima document

(%i1) (A:matrix([5,1,2],[-3,9,4],[1,2,-7]),
for i:1 thru 3 do
for j:1 thru 3 do
(if(i>j) then L[i,j]:A[i,j] else L[i,j]:0,
if (i=j) then D[i,j]:A[i,j] else D[i,j]:0,
if (i<j) then U[i,j]:A[i,j] else U[i,j]:0),
L:genmatrix(L,3,3),
D:genmatrix(D,3,3),
U:genmatrix(U,3,3),
B:transpose([10,-14,-33]),
X0:transpose([0.0,0.0,0.0]),
for k:0 thru 10 do
(
X_1:-(invert(D+L)) . U . X0+(invert(D+L) . B),
display(k,X_1),
X0:X_1));
Maxima encountered a Lisp error:
Console interrupt.
Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.
(%i1)
k=0
2.0

X_1 = - 0.88888888888889
4.746031746031746

k=1
0.27936507936508

X_1 = - 3.571781305114639
3.7336860670194

k=2
1.220881834215168

X_1 = - 2.8080109739369
4.086408555191624

k=3
0.92703877271073

X_1 = - 3.062724211403812
3.971655764271873

k=4
1.023882536572013

X_1 = - 2.979441716374605
4.0092855862604

k=5
0.99217410877076

X_1 = - 3.006735557636591
3.996957570499654

k=6
1.002564083327457

X_1 = - 2.997793114668472

2 / 2

Das könnte Ihnen auch gefallen