Thank you very much Doug, that was really formidable. It is everything that I need to conclude my Maplet. I was very animated with the result that you got.
I´m vastly grateful.
Hugs,
João Laudares

Thank you very much Doug, that was really formidable. It is everything that I need to conclude my Maplet. I was very animated with the result that you got.
I´m vastly grateful.
Hugs,
João Laudares

Hello Adriene, thank you for the attention.
What I´m trying to obtain is the graph of each iteration, presented in the window of the plotter Maplet component. My objective is to accompany the convergence during the system solution process, in particular when using external calls to the NAG algorithms. The output that you are seeing at my example is not of importance at that moment.
This is part of a Maplet for solution of partial diferential equations over distributed domains, using finite volumes technique and taking advantage of Maplets, to a computational fluid dynamics class.
Do you have any idea on why the plotter are not presenting all the graphs that is generated by the procedure??? Below is my last code trying to fix the problem. Only the last procedure generated graph is ploted. Why?
Hugs,
João Laudares
restart;with(linalg):with(stats[statplots]):with(plots):with(CurveFitting):GSeidel:=proc(a, prec, nmax)
> local n, xnew, i, j, k, m, erro, soma:
> global xold,x,y,R2,R3,h,X,Y,vetor,xix,z,p,vetor_erro,vetor_iterada,R4,R5:
> n:=rowdim(a):
> xold:=vector(n,1):
> xnew:=vector(n,1):
> erro:=1:
> vetor_erro:=vector(nmax);
> vetor_erro:=0;
> vetor_iterada:=vector(nmax);
> vetor_iterada:=0;
> for j from 1 to nmax do
> x:=vector(j);
> y:=vector(j);
> xix:=vector(nmax);
> vetor:=vector(n);
> if erro > prec then
> #Calculando vetor xnew para iterada j
> for i from 1 to n do
> soma:=0:
> for k from 1 to n do
> if i<>k then soma:=soma+a[i,k]*xnew[k]: fi
> od:
> xnew[i]:=(a[i,n+1]-evalf(soma))/a[i,i]:
> od:
> for z from 1 to j do
> xix[z]:=erro;
> od:
> for p from 1 to j do
> y[p]:=y[j];
> od:
> vetor_erro[j]:=erro;
> vetor_iterada[j]:=j;
> R2 := convert(xix,'list');
> R3 := convert(y,'list');
> else break
> fi:
> for k from 1 to n do
> erro:=0:
> m:=abs(xnew[k]-xold[k]):
> if erro < m then erro:=m: fi:
> xold[k]:=xnew[k]:
> od:
> R4 := convert(vetor_erro,'list');
> R5:= convert(vetor_iterada,'list');
> p:=plots[display]({scatterplot(R4,R5)},view = [0..10, 0..10],axes=frame);
> od:
> end:
> A := linalg[matrix](3,4,[1,2,0,4,5/2,6,2,0,5,2,9,1]);
> with(Maplets[Elements]):
> maplet2d := Maplet([
> [Button("Plot", Evaluate('PL1' = 'GSeidel(A,0.0001,20)') ), Button("OK", Shutdown(['TF2d']))]
> ,Plotter['PL1']( plot(undefined, x = 0..10,y=0..10) )]):
> Maplets[Display](maplet2d);

Hello Adriene, thank you for the attention.
What I´m trying to obtain is the graph of each iteration, presented in the window of the plotter Maplet component. My objective is to accompany the convergence during the system solution process, in particular when using external calls to the NAG algorithms. The output that you are seeing at my example is not of importance at that moment.
This is part of a Maplet for solution of partial diferential equations over distributed domains, using finite volumes technique and taking advantage of Maplets, to a computational fluid dynamics class.
Do you have any idea on why the plotter are not presenting all the graphs that is generated by the procedure??? Below is my last code trying to fix the problem. Only the last procedure generated graph is ploted. Why?
Hugs,
João Laudares
restart;with(linalg):with(stats[statplots]):with(plots):with(CurveFitting):GSeidel:=proc(a, prec, nmax)
> local n, xnew, i, j, k, m, erro, soma:
> global xold,x,y,R2,R3,h,X,Y,vetor,xix,z,p,vetor_erro,vetor_iterada,R4,R5:
> n:=rowdim(a):
> xold:=vector(n,1):
> xnew:=vector(n,1):
> erro:=1:
> vetor_erro:=vector(nmax);
> vetor_erro:=0;
> vetor_iterada:=vector(nmax);
> vetor_iterada:=0;
> for j from 1 to nmax do
> x:=vector(j);
> y:=vector(j);
> xix:=vector(nmax);
> vetor:=vector(n);
> if erro > prec then
> #Calculando vetor xnew para iterada j
> for i from 1 to n do
> soma:=0:
> for k from 1 to n do
> if i<>k then soma:=soma+a[i,k]*xnew[k]: fi
> od:
> xnew[i]:=(a[i,n+1]-evalf(soma))/a[i,i]:
> od:
> for z from 1 to j do
> xix[z]:=erro;
> od:
> for p from 1 to j do
> y[p]:=y[j];
> od:
> vetor_erro[j]:=erro;
> vetor_iterada[j]:=j;
> R2 := convert(xix,'list');
> R3 := convert(y,'list');
> else break
> fi:
> for k from 1 to n do
> erro:=0:
> m:=abs(xnew[k]-xold[k]):
> if erro < m then erro:=m: fi:
> xold[k]:=xnew[k]:
> od:
> R4 := convert(vetor_erro,'list');
> R5:= convert(vetor_iterada,'list');
> p:=plots[display]({scatterplot(R4,R5)},view = [0..10, 0..10],axes=frame);
> od:
> end:
> A := linalg[matrix](3,4,[1,2,0,4,5/2,6,2,0,5,2,9,1]);
> with(Maplets[Elements]):
> maplet2d := Maplet([
> [Button("Plot", Evaluate('PL1' = 'GSeidel(A,0.0001,20)') ), Button("OK", Shutdown(['TF2d']))]
> ,Plotter['PL1']( plot(undefined, x = 0..10,y=0..10) )]):
> Maplets[Display](maplet2d);