# Question:Error, recursive assignment

## Question:Error, recursive assignment

Maple 12

restart:
with(student):
with(linalg):
# system of linear equations
A := array(evalf([[2, -1, sqrt(2)], [3, 2, -3], [3, sqrt(2), -15/7]])):
B := array(evalf([5 + 7*sqrt(2), -24, -12 - 3*sqrt(2)])):
B := <,>(B):
print(A):
print(B):
N := 3:
t := 1*10^(-6):

for j from 1 to N do
for k from j to N do
S := 0:
for i from 1 to N do
S := S + A[i,j]*A[i,k]:
end do: # end of i
C[k] := S:
end do: # end of k
C := 0:
for i from 1 to N do
C := C + A[i,j]*B[i]:
end do: # end of i
for i from j to N do
A[i,j] := C[i]:
end do: # end of i
C[j] := C:
end do: # end of j
P := sqrt(t*N)/2:
for i from 1 to N do
A[i,i] := A[i,i] + P:
end do: # end of i
A[1,1] := sqrt(A[1,1]):
for j from 2 to N do
A[1,j] := A[j,1]/A[1,1]:
end do: # end of j
for i from 2 to N do
S := 0:
for k from 1 to (i-1) do
S := S + A[k,i]*A[k,i]:
end do: # end of k
A[i,i]:= sqrt(A[i,i] - S):
for j from (i+1) to N do
S := 0:
for k from 1 to (i-1) do
S := S + A[k,i]*A[k,j]:
end do: # end of k
A[i,j] := (A[j,i] - S)/A[i,i]:
end do: # end of j
end do: # end of i
C[1] := C[1]/A[1,1]:
for i from 2 to N do
S := 0:
for k from 1 to (i-1) do
S := S + A[k,i]*C[k]:
end do: # end of k
C[i] := (C[i] - S)/A[i,i]:
end do: # end of i
C[N] := C[N]/A[N,N]:
for i from (N-1) to 1 by -1 do
S := 0:
for k from (i+1) to N do
S := S + A[i,k]*C[k]:
end do: # end of k
C[i] := (C[i] - S)/A[i,i]:
end do: # end of i
print(C):

And I have got 3 mistakes like "Error, recursive assignment". Matrix C is something strange...

Could you help me?

﻿