Question: solving system of equations using matrix

Dear Sir

I want to solve system of algebric equations using matrix

can you help me to do that

> restart;

> Digits:=6:

> s:=140:

T:=1:

M:=40:

N:=10:

k:=T/N:

h:=s/M:

r:=0.05:
W:=20:

 

> #u[M+1,N+1

> for i from 0 to M do

S[i]:=i*h:

u[i,0]:=W:

od:

> for j from 0 to N do  

u[M,j+1]:=s

u[0,j+1]:=0:

od:

> for i from 1 to M do

a[i]:=(r*k*S[i]/h-k*S[i]^2/h^2);

b[i]:=1S[i]^2*k/h^2;

c[i]:=-(0.5*r*k*S[i]/h+k*S[i]^2/h^2);

od:

> for j from 0 to N do

for i from 1 to M-1 do

u[i,j]:=a[i]*u[i-1,j+1]+b[i]*u[i,j+1]+c[i]*u[i+1,j+1]:

od:

od:

 

> for j from 0 to N do

v[M-1,j]:=0.45*u[M-1,j];

od:

 

thanks

yasser

 

Please Wait...