mehdibaghaee

125 Reputation

One Badge

2 years, 154 days

MaplePrimes Activity


These are replies submitted by mehdibaghaee

@Carl Love your commands give error:

plot([seq(PPP[[1,k],..]^+, k= 2..rhs(rtable_dims(PPP)[1]))], color= black);
Error, invalid power

@Kitonum Thanks, Actually I dont have function, I have many vectors, where I want to plot all in one figure. How to plot all of them in one fig with only one line of commands, as you did above for functions.

It is tedious to plot one by one and then gather them as below

with(plots); g := 2926;
P1 := plot(PPP[1, 1 .. g], PPP[2, 1 .. g], style = line, color = black);

P2 := plot(PPP[1, 1 .. g], PPP[3, 1 .. g], style = line, color = black);

P3 := plot(PPP[1, 1 .. g], PPP[4, 1 .. g], style = line, color = black);

P4 := plot(PPP[1, 1 .. g], PPP[5, 1 .. g], style = line, color = black);

P5 := plot(PPP[1, 1 .. g], PPP[6, 1 .. g], style = line, color = black);

P6 := plot(PPP[1, 1 .. g], PPP[7, 1 .. g], style = line, color = black);

P7 := plot(PPP[1, 1 .. g], PPP[8, 1 .. g], style = line, color = black);

P8 := plot(PPP[1, 1 .. g], PPP[9, 1 .. g], style = line, color = black);

P9 := plot(PPP[1, 1 .. g], PPP[10, 1 .. g], style = line, color = black);

P10 := plot(PPP[1, 1 .. g], PPP[11, 1 .. g], style = line, color = black);

P11 := plot(PPP[1, 1 .. g], PPP[12, 1 .. g], style = line, color = black);

P12 := plot(PPP[1, 1 .. g], PPP[13, 1 .. g], style = line, color = black);

P13 := plot(PPP[1, 1 .. g], PPP[14, 1 .. g], style = line, color = black);

P14 := plot(PPP[1, 1 .. g], PPP[15, 1 .. g], style = line, color = black);

P15 := plot(PPP[1, 1 .. g], PPP[16, 1 .. g], style = line, color = black);

P16 := plot(PPP[1, 1 .. g], PPP[17, 1 .. g], style = line, color = black);

P17 := plot(PPP[1, 1 .. g], PPP[18, 1 .. g], style = line, color = black);

P18 := plot(PPP[1, 1 .. g], PPP[19, 1 .. g], style = line, color = black);

P19 := plot(PPP[1, 1 .. g], PPP[20, 1 .. g], style = line, color = black);

P20 := plot(PPP[1, 1 .. g], PPP[21, 1 .. g], style = line, color = black);

P21 := plot(PPP[1, 1 .. g], PPP[22, 1 .. g], style = line, color = black);

P22 := plot(PPP[1, 1 .. g], PPP[23, 1 .. g], style = line, color = black);

P23 := plot(PPP[1, 1 .. g], PPP[24, 1 .. g], style = line, color = black);

P24 := plot(PPP[1, 1 .. g], PPP[25, 1 .. g], style = line, color = black); 

plots[display]([P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, P22, P23, P24]);
 

@Kitonum What about the font size and type of the numbers in the axis? how adjust them?

@tomleslie yes i am running parallel computations, and monitoring cpu and ram usage during the run, min 44% of ram and 11% of Cpu are free. but error persists. 

@acer I changed GAMMA to PI and modified my ws as below:


 

``

restart

II := 6

6

(1)

JJ := 6

6

(2)

N := 2:

``

q := max(II+1, JJ+1):

M := 5:

seq(seq(seq(seq(assign(PI[i, j, r, m], a*`#mover(mi("Π",fontstyle = "normal"),mo("&uminus0;"))`[i, j, r, m]), i = 0 .. q), j = 0 .. q), r = 1 .. N), m = 1 .. M):``

a := .2:

RrProc := proc (i, m) local K, j, Q; if i <= m then 0 else K := 1; Q := Matrix(i, 1); for j by 2 to i do Q(j) := 2*i-K; K := 4+K end do; Q := FlipDimension(Q, 1); Q(m+1) end if end proc:
NULL

`#mover(mi("&Pi;",fontstyle = "normal"),mo("&uminus0;"))` := Array(0 .. II, 0 .. JJ, 1 .. 6, 1 .. M):

f1 := RandomArray(II+1, JJ+1):

for m to M do `&Pi;m`[1, m] := f1; `&Pi;m`[2, m] := f2; `&Pi;m`[3, m] := f3; `&Pi;m`[4, m] := f4; `&Pi;m`[5, m] := f5; `&Pi;m`[6, m] := f6 end do:

for m to M do `#mover(mi("&Pi;",fontstyle = "normal"),mo("&uminus0;"))`[0 .. II, 0 .. JJ, 1, m] := ArrayTools:-Alias(`&Pi;m`[1, m], [0 .. II, 0 .. JJ]); `#mover(mi("&Pi;",fontstyle = "normal"),mo("&uminus0;"))`[0 .. II, 0 .. JJ, 2, m] := ArrayTools:-Alias(`&Pi;m`[2, m], [0 .. II, 0 .. JJ]); `#mover(mi("&Pi;",fontstyle = "normal"),mo("&uminus0;"))`[0 .. II, 0 .. JJ, 3, m] := ArrayTools:-Alias(`&Pi;m`[3, m], [0 .. II, 0 .. JJ]); `#mover(mi("&Pi;",fontstyle = "normal"),mo("&uminus0;"))`[0 .. II, 0 .. JJ, 4, m] := ArrayTools:-Alias(`&Pi;m`[4, m], [0 .. II, 0 .. JJ]); `#mover(mi("&Pi;",fontstyle = "normal"),mo("&uminus0;"))`[0 .. II, 0 .. JJ, 5, m] := ArrayTools:-Alias(`&Pi;m`[5, m], [0 .. II, 0 .. JJ]); `#mover(mi("&Pi;",fontstyle = "normal"),mo("&uminus0;"))`[0 .. II, 0 .. JJ, 6, m] := ArrayTools:-Alias(`&Pi;m`[6, m], [0 .. II, 0 .. JJ]) end do:

UP1 := proc (s, PI, N, M, a, b, II, JJ) local k; i, j, r, p, m, q, n, l; if s = 1 then add(add(add(add(add(add((2/3)*Rr[i, m]*Rr[k, m]*b*add(PI[i, j, q, p]*PI[k, j, q, r]*tau[p](t)*tau[r](t), q = 1 .. N)/((2*m+1)*(2*j+1)*a), i = 0 .. II), k = 0 .. II), m = 0 .. II), j = 0 .. JJ), p = 1 .. M), r = 1 .. M) elif s = 2 then add(add(add(add(add(add((1/2)*Rr[i, m]*Rr[k, m]*b*add(PI[i, j, q, p]*PI[k, j, q, r]*tau[p](t)*tau[r](t), q = 1 .. N)/((2*m+1)*(2*j+1)*a), i = 0 .. II), k = 0 .. II), m = 0 .. II), j = 0 .. JJ), p = 1 .. M), r = 1 .. M) end if end proc:

y1 := Grid:-Seq(UP1(s, PI, N, M, a, b, II, JJ), s = 1 .. 2):

UP2 := proc (s, PI, N, M, a, b, II, JJ, Rr) local k; i, j, r, p, m, q, n, l; if s = 1 then add(add(add(add(add(add((2/3)*Rr[i, m]*Rr[k, m]*b*add(PI[i, j, q, p]*PI[k, j, q, r]*tau[p](t)*tau[r](t), q = 1 .. N)/((2*m+1)*(2*j+1)*a), i = 0 .. II), k = 0 .. II), m = 0 .. II), j = 0 .. JJ), p = 1 .. M), r = 1 .. M) elif s = 2 then add(add(add(add(add(add((1/2)*Rr[i, m]*Rr[k, m]*b*add(PI[i, j, q, p]*PI[k, j, q, r]*tau[p](t)*tau[r](t), q = 1 .. N)/((2*m+1)*(2*j+1)*a), i = 0 .. II), k = 0 .. II), m = 0 .. II), j = 0 .. JJ), p = 1 .. M), r = 1 .. M) end if end proc:

``

Grid:-Set(`index/xxx`);

y2 := Grid:-Seq(UP2(s, PI, N, M, a, b, II, JJ, Rr), s = 1 .. 2):

y1-y2

-HFloat(7.834444204490865e-9)*tau[4](t)*tau[2](t)-HFloat(7.834529469619156e-9)*tau[5](t)*tau[3](t)-HFloat(7.83451525876444e-9)*tau[3](t)*tau[1](t)-HFloat(7.83448683705501e-9)*tau[3](t)*tau[2](t)-HFloat(7.834401571926719e-9)*tau[5](t)*tau[1](t)-HFloat(7.834472626200295e-9)*tau[2](t)*tau[1](t)-HFloat(7.834529469619156e-9)*tau[4](t)*tau[3](t)-HFloat(2.8468605250964174e-9)*tau[5](t)^2-HFloat(2.846810787104914e-9)*tau[3](t)^2-HFloat(2.846810787104914e-9)*tau[4](t)^2-HFloat(2.846832103386987e-9)*tau[1](t)^2-HFloat(7.834600523892732e-9)*tau[5](t)*tau[4](t)-HFloat(7.834529469619156e-9)*tau[5](t)*tau[2](t)-HFloat(2.8468249979596294e-9)*tau[2](t)^2-HFloat(7.834472626200295e-9)*tau[4](t)*tau[1](t), -HFloat(7.32531901803668e-9)*tau[4](t)*tau[2](t)-HFloat(7.325368756028183e-9)*tau[5](t)*tau[3](t)-HFloat(7.325326123464038e-9)*tau[3](t)*tau[1](t)-HFloat(7.3253829668828985e-9)*tau[3](t)*tau[2](t)-HFloat(7.325304807181965e-9)*tau[5](t)*tau[1](t)-HFloat(7.325326123464038e-9)*tau[2](t)*tau[1](t)-HFloat(7.325361650600826e-9)*tau[4](t)*tau[3](t)-HFloat(3.5004319443032728e-9)*tau[5](t)^2-HFloat(3.5004674714400608e-9)*tau[3](t)^2-HFloat(3.5004568132990244e-9)*tau[4](t)^2-HFloat(3.500460366012703e-9)*tau[1](t)^2-HFloat(7.32529059632725e-9)*tau[5](t)*tau[4](t)-HFloat(7.3253119126093225e-9)*tau[5](t)*tau[2](t)-HFloat(3.5004532605853456e-9)*tau[2](t)^2-HFloat(7.3253829668828985e-9)*tau[4](t)*tau[1](t)

(3)

``


 

Download soal-1.mw

I created 2 UPs procs (UP1,UP2), the only difference between them is in using Rr as argument.

First of all I thick y1 is computed faster than y2. Why?

Second, why y1-y2 is not zero???

I am amazed.

@Carl Love Thanks acer, vv and Carl Love. It was great help.

@mehdibaghaee any comments yet???

@acer Thanks. Searching those terminologes I am a littile confused. Is it possible to show both methods for very simple functions as below:

y1=sin(x)

y2=cos(x)

thanks in advance

@acerActually I have a worksheet like below:

restart:

y1:=f(x1,x2,x3,...) :

y2:=g(x1,x2,x3,...) :

z:=y1+y2:

it takes two hours to be done, (only one core of my system's CPU is participitated in computation).

I found out that If I set y1 and y2 in different worksheets,and run them simultaneously, then y1+y2 can be computed very quickly, because more cores of CPU are engaged in computation.

What to do to speed up my computation?

@acer I expected Maple shares the computations between the cores automatically; it seems my expectations are very far from the reality.

@mehdibaghaee The examples appeared in help seems a little hard and peculiar for me to understand. It will be very appreciated if someone addresses very simple and tangble example in using parallel computations within Maple.

@tomleslie Could you please introduce a simple example that appropriately subdivided and use the Threads() package to distribute the calculation across multiple cores which should give a significant speed-up?

@Carl Love What about delete such Arrays? I mean how is it possible to claer such special Arrays from Maple's memory?

You mean there is no way?

What is the substitute way to do ?

@acer yes it contains numeric values.

Vector[column](4, [` 50x 500000`*Matrix, `Data Type: `*anything, `Storage: `*rectangular, `Order: `*Fortran_order])

@acer Thanks all for responses

1 2 3 4 5 6 Page 1 of 6