Question: how to plot this proc ??



restart

Digits := 5

5

(1)

with(GraphTheory); with(SpecialGraphs)

with(LinearAlgebra)

lc:=proc(Ndx,Ndy,Tb,Td,Th,Tg);              local imax,jmax,Ndeq,G,i,T,j,k,Eq,var,sys,A,B,Ainvers,TT;               imax:=Ndx+1;  jmax:=Ndy+1;    Ndeq:=(imax-2)*(jmax-2); G:=GridGraph(imax,jmax );  DrawGraph(G);   for i from 1 to imax do     T[i,1] := Tb    od; for i from 1 to imax do     T[i,jmax] := Th od;   for j from 1 to jmax do     T[1,j] :=Tg od;   for j from 1 to jmax do     T[imax,j] := Td od;  k:=1 ;  for j from 2 to jmax-1 do     for i from 2 to imax-1 do      Eq[k]:= -4 T[i,j]+T[i-1,j]+T[i+1,j]+T[i,j-1]+T[i,j+1]=0;  var[k]:=T[i,j]; k:=k+1 ;      od;  od;  for k from 1 to  Ndeq do   Eq[k];  var[k];   od;  sys:=[seq(Eq[k],k=1..Ndeq)];    var:=[seq(var[k],k=1..Ndeq)]; A,B:=GenerateMatrix(sys,var); Ainvers:=MatrixInverse(A);    TT:=MatrixVectorMultiply(Ainvers,B): evalf(TT)     end proc;

``



Download proc5.mw

Please Wait...