## 0 Reputation

1 years, 136 days

## Error, recursive assignment...

Maple

Hallo, I would like to ask anyone have encountered this problem. I tried to update a matrix value using recurrence do but end up with "Error, recursive assignment". Here is the code. Any help is appreciated.

with(LinearAlgebra);
with(plots);
Nx := 200;
Nt := 200;
dx := 0.5e-2; dt := 0.2e-1;
A := Matrix(Nx, Nx);

for k to Nx do A[k, k] := -2.0 end do;
for j to Nx-1 do A[j+1, j] := 1.0 end do;
for j to Nx-1 do A[j, j+1] := 1.0 end do; A;
zeta := (.1*dt/dx)^2;
phi || 0 := Matrix(Nx, Nx);

fin := proc (t) options operator, arrow; cos(4*Pi*t) end proc;
phi || 0[(1/2)*Nx, (1/2)*Nx] := fin(0);
phi || 1 := (1/2)*zeta^2 . A . phi || 0; phi || 1[(1/2)*Nx, (1/2)*Nx] := fin(dt);

phinow := Matrix(Nx, Nx); phinext := Matrix(Nx, Nx); phibefore := Matrix(Nx, Nx);

phinow := phi || 1; phibefore := phi || 0;

for j from 2 to Nt do phinext := Zeta^2 . (A . phinow+phinow . A)+2.*phinow-phibefore; phi || j := Matrix(Nx, Nx); phinext[(1/2)*Nx, (1/2)*Nx] := fin(j*dt); phi || j := phinext; phibefore := phi || (j-1); phinow := phi || j end do;
Error, recursive assignment

for j to (1/5)*Nt do p || j := matrixplot(phi || j, heights = histogram, gap = 0.5e-2, labels = ["", "", ""]) end do;

plots[display](p || (1 .. 20), insequence = true);

 Page 1 of 1
﻿