# Question:How can i get the procedure to plot for coupled difference scheme

## Question:How can i get the procedure to plot for coupled difference scheme

Dear Maple user  help required to  evaluate the values of u and v from  coupled difference scheme  and plot the 2D multiple curves by changing the values of M  and R .  By seeing mapleprime post i have written sample codes

restart; Digits := 5; with(plots); with(LinearAlgebra);
#Parameter values:
a:=0:b:=2:N:=9:
h:=(b-a)/(N+1): phi:=0.5:
K:=10^(-6):mu:=1.67:
alpha:=K/(phi*mu):lambda:=alpha*k/h^2:

#Initial conditions
for i from 0 while i <= N do u[i, 0] := h*i+1 end do;

#Initial conditions
for i from 0 while i <= N do v[i, 0] := h*i+1 end do;

#Boundary conditions
for j from 0 while j <= N+1 do u[0, j] := .1; u[N+1, j] := .5 end do;

#Boundary conditions
for j from 0 while j <= N+1 do v[0, j] := .2; v[N+1, j] := R end do;

#Discritization scheme
printlevel := 2; for i while i <= N do for j from 0 while j <= N do eq1[i, j] := lambda*u[i-1, j]+(M.(2-2*lambda))*u[i, j]+lambda*u[i+1, j] = -lambda*u[i-1, j+1]+(2+2*lambda)*v[i, j+1]-(M.lambda)*u[i+1, j+1] end do end do;

#Discritization scheme
printlevel := 2; for i while i <= N do for j from 0 while j <= N do eq2[i, j] := lambda*v[i-1, j]+3*lambda*v[i, j]+(M.lambda)*v[i+1, j] = -lambda*u[i-1, j+1]+(M.(7-2*lambda))*u[i, j+1]-lambda*v[i+1, j+1] end do end do;
# how to solve the two equations (1 and 2) in terms to calculate the values of u and v and plot the graphs in 2 dimension while #changing the values of M=0,5,10 (variable), R=0,0.5,0.7
# I am unable to write the codes  further

###############################################################
restart:
#sys := ([seq])(seq(eq[i, j], j = 0 .. N), i = 1 .. N):
nops(sys);
vars:=indets(sys) minus {k}:
nn := Matrix(N+1, N+1,(i, j)-> u[i-1, j-1]):
##
p:=proc(kk) local u_res,A;
u_res:=solve(eval(sys,k=kk),vars);
A:=eval(nn,u_res);
plots:-matrixplot(A)
end proc;
## Testing p for k=0.001:
p(0.001);
## Animating the plot for k=0.0001..0.001:
plots:-animate(p,[k],k=0.0001..0.001);
#################################################################

﻿