Question: Array error out of range

Can anyone assist with the error please?
 

#Clear memory.
restart;

#Initialise variables and arrays.
h:=0.1;
n:=10;
k:=0.1;  
m:=10;
t:=Array(0..m):
x:=Array(0..n):
u:=Array(0..n,0..m):

#Initialise the x array and the initial u(x,0) boundary.
for i from 0 to n do
    x[i]:=i*h;
    u[i,0]:=exp(x[i]);
end do:

#Initialise the t array and the u(x,t) side boundaries.
for j from 0 to m do
   t[j]:=j*k;
   u[0,j]:=0;
   u[n,j]:=t[j];
end do:

#Use the 2D CTCS explicit wave method.
for i from 1 to n-1 do
   u[i,1]:=(9*u[i-1,0]+14*u[i,0]+9*u[i+1,0])/32+[i]/10;
end do:
 
for j from 1 to m-1 do
  for i from 0 to n-1 do
   u[i,j+1]:=(9*u[i-1,j]+14**u[i,j]+9*u[i+1,j])/16-u[i,j-1];
  end do;
end do:

#Display the u(x,t)values.
printf("2D CTCS Explicit Wave Method\n");
printf("----------------------------\n");
printf("x\t\t t\t\t u\n");
for i from 0 to n do
   printf("% f\t% f\t% f\n",x[i],t[m],u[i,m]);
end do;

.1

 

10

 

.1

 

10

 

Error, Array index out of range

 

2D CTCS Explicit Wave Method
----------------------------
x                 t                 u
 0.000000         1.000000         0.000000
 0.100000         1.000000         0.000000
 0.200000         1.000000         0.000000
 0.300000         1.000000         0.000000
 0.400000         1.000000         0.000000
 0.500000         1.000000         0.000000
 0.600000         1.000000         0.000000
 0.700000         1.000000         0.000000
 0.800000         1.000000         0.000000
 0.900000         1.000000         0.000000
 1.000000         1.000000         1.000000

 

NULL


 

Download Asst_3_Q2b.mw

Please Wait...