## 45 Reputation

7 years, 248 days

## Re: Possible external dependencies?...

Dear Carl,

Thank you very much for your attention to my problem. Besides, I am sorry to not reply to your answer about “You didn't reply to my earlier Answer”. In fact, I am in much stress due to my work; nevertheless, I tried to study and reply to you as soon as possible. You told me you spent several hours writing that answer. I appreciate it you consumed your much time for me.

Now, about simplification, I should say that I am much confused due to the behavior of Maple about simplification through the ‘simplify’ command.

I attached the TXT file entitled “backup.txt” including elements of dummy_UU1.

UU:='UU';

dummy_UU1:='dummy_UU1';

dummy_UU1:=Map(simplify,Map(solve_proc,[seq(seq([Trans_Coef_Eq[2][k,h],UU[k+1,h]],h=0..num),k=0..num)])):

fd:=fopen("F:\\backup.txt",WRITE);

for i from 1 to nops(dummy_UU1) do

fprintf(fd,"dummy_UU1[%d]:=%s;\n",i,convert(dummy_UU1[i],string)):

end do;

fclose(fd):

When I use the ‘read’ command to import the components of dummy_UU1, everything is Ok, namely simplifications are correctly executed as the following:

Wonderfully, when I tried to substitute the dummy_UU1 components into UU[k+1,h], as the following, it is seen that UU[k+1,h] are non-simplified!.

itr:=1;num:=5;

for k from 0 to num do

for h from 0 to num do

UU[k+1,h]:=dummy_UU1[itr];

print(k+1,h,itr);

itr:=itr+1;

end do:

end do:

UU[5,1]; # for example

Do you know why the reason of?

About the time-running, I have to say that the simplifications of UU[k+1,h] are rapidly executed. However, I must simplify other parameters which request much CPU-time.

The below is the content of "backup.txt":
dummy_UU1[1]:=-UU[0,0]/(50.*UU[0,0]+10.);
dummy_UU1[2]:=(-50.*UU[1,0]-1.)*UU[0,1]/(50.*UU[0,0]+10.);
dummy_UU1[3]:=((-5.*UU[1,0]-.1)*UU[0,2]-5.*UU[0,1]*UU[1,1])/(5.*UU[0,0]+1.);
dummy_UU1[4]:=((-5.*UU[1,0]-.1)*UU[0,3]-5.*UU[0,1]*UU[1,2]-5.*UU[0,2]*UU[1,1])/(5.*UU[0,0]+1.);
dummy_UU1[5]:=((-5.*UU[1,0]-.1)*UU[0,4]-5.*UU[0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UU[4,0]-5.*UU[3,0]*UU[3,4]-5.*UU[3,1]*UU[3,3]-5.*UU[6,0]*UU[0,4]-5.*UU[6,1]*UU[0,3]-5.*UU[6,2]*UU[0,2]-5.*UU[6,3]*UU[0,1]-2.5*UU[3,2]^2)/(5.*UU[0,0]+1.);
dummy_UU1[36]:=((-5.*UU[1,0]-.1)*UU[5,5]-5.*UU[1,1]*UU[5,4]-5.*UU[1,2]*UU[5,3]-5.*UU[1,3]*UU[5,2]-5.*UU[1,4]*UU[5,1]-5.*UU[1,5]*UU[5,0]-5.*UU[2,0]*UU[4,5]-5.*UU[2,1]*UU[4,4]-5.*UU[2,2]*UU[4,3]-5.*UU[2,3]*UU[4,2]-5.*UU[2,4]*UU[4,1]-5.*UU[2,5]*UU[4,0]-5.*UU[3,0]*UU[3,5]-5.*UU[3,1]*UU[3,4]-5.*UU[3,2]*UU[3,3]-5.*UU[6,0]*UU[0,5]-5.*UU[6,1]*UU[0,4]-5.*UU[6,2]*UU[0,3]-5.*UU[6,3]*UU[0,2]-5.*UU[6,4]*UU[0,1])/(5.*UU[0,0]+1.);

## @Carl Love Thanks very much for your att...

@Carl Love Thanks very much for your attention to safely create the above code. Regarding your previous explanation, now I well realize why you added the Grid:-Wait(1) command. As I have already said, I learned many points due to the connection with you.

## Re: Simple Send and Receive example...

Hi again,
Thank you very much.
Best wishes

## Re: "Master" node...

Dear Carl,
It is interesting and important hints which you explained to me. I learned much. It seems in many situations I can send a value of a variable from a node to another by using Grid:-Get and Grid:-Set commands as you did above. I don't want you to spend more time due to another question; hence, if it is possible please explain how and where "Send" and "Receive" commands are applied to transfer data from a node to another through a simple example (for example, in the above incorrect code of mine). If you are tired of my questions, don't worry and don't perform it. Nevertheless, I appreciate it you explained to me in detail.
Thank you very much.
Best wishes.

## Re: Grid:-Run bug; keep track of where v...

Dear Carl,

However, I was not unfortunately convinced of the answer to question 2. I used Grid-MyNode() command to show the master node, which was the same node 0; Unless the Grid:-MyNode() command isn't the correct one to find the "master" node.

If it is possible please modify my code to transfer the value of a from node 0 to node 1. Besides, It is worth mentioning that by executing two last commands, nor any error returns neither the execution is stopped!

Again, I emphasize I learned much about the answer to question 1.

restart;
Grid:-MyNode();
master:=Grid:-MyNode();
Grid:-Run(master,"a:=2;a;");
Grid:-Wait(master);
Grid:-GetLastResult(master);
Grid:-Send(master+1,a);

## Re: What's your Maple version?...

Dear Carl,

Thanks so much

My Maple version is 2020.

Hi,
Thanks so much

Best wishes

Hi again,
Thanks so much

## RE: Hmmm...

@tomleslie
Dear tomleslie,
thany you so much
Best wishes

## Re: Grid...

Dear Carl,
Thank you so much to consume your time with me. You are very patient to reply.
The reason for my delay to reply is that I was studying the commands of Grid package such as Map, Send, Receive, MyNode, and so on. As I previously said, the help pages of Maple are not appropriate for self-learning. I think it causes me to find many problems to implement what is in my mind.
Now, I have another question:
I, for example, want to execute the command “coeftayl(sin(x),x=0,9)” due to 'Run' command at node 0 in parallel. When I wrote the following code, I arrived at my goal.

Grid:-Run(0,coeftayl,[sin(x),x=0,9]);
GetLastResult(0);

However, when I tried to re-write the above by application of a procedure, named 'dummy', the code doesn’t correctly execute.

dummy:=proc(expr,num)
coeftayl(expr,x=0,num);
end proc;
Grid:-Run(0,dummy,[sin(x),9]);
GetLastResult(0);
Would you tell me what is the reason?

Besides, I want to use Map command to execute taylor command to derive the first 10 terms of sine function about x=0. The usual command is as the following:
taylor(sin(x),x,10);
I wrote the Map-versioned 'taylor' command as the following, however, it returns the error. what is the reason?
Grid:-Map(taylor,[sin(x)],x,10);

Finally, you told me that "That is mostly true. I have discovered a few commands (such as index) which I've confirmed are threadsafe (by reading their code), yet they aren't listed on page ?index,threadsafe."
Is it possible to tell me those commands being thread-safe but not listed in page index.threadsafe?

## Re: Those things can't be done with Thre...

Dear Carl,

I appreciate it to your help.

Does the following sentence is true?

The Threads[Task] package, which is shared memory, is applicable only for the commands listed in “Thread-safe fucntions” in the help of Maple, and if ok, to execute another commands (not listed in “Thread-safe fucntions”) in parallel, we have to use Grid programming?

Another question is about Grid programming model. I know that Grid programming explain in the related help pages. However, its explanation by a person, can be usually more useful than the help pages. Please tell me some important keys of Grid prgramming as far as possible.

Does Grid programming is hard to write rather than Task programming model?

Does Grid:-Map(fsolve, Eqns) command is feasible to another commands such as taylor, solve and so on? If not, please guide me to learn about.

Best wishes

@Carl Love
Dear Carl
I think I understood the concept of “divide-and-conquer”. Besides, I think that I can’t convey my idea about the “coeftayl” command for programming in parallel. I try to explain my opinion as follows. Let me request the first 10 coefficients of sin(x) in parallel. I want to write a parallel program with Threads[Task] package so that the first task to be executing the first coefficient of sin(x), and the second task (thread) to be executing the second coefficient, and the third thread (task) is forced to calculate the third coefficient of the Taylor series of sin (x), and so on. Would you help me to do this?

About the “solve” command, let me assume a set of equations including 100 equations and 100 unknowns. I want to write a parallel program such that the first 10 equations is a new smaller set of equations to calculate the first 10 unknowns by the first “task”. Of course, I know there are all 100 unknowns in the first 10 equations. I make focus on derivation of the first 10 unknowns by using the first 10 equations (included all 100 unknowns). The second 10 equations are, in turn, another smaller set of equations to obtain the second 10 unknowns by the second “task”, and so on. In this mmaner, I force all threads to run some parts of my program. Would you have any idea about?

## Re: Infinite Recursion...

Dear Riel,
I understood my code leads to an infinite recursive call of the “task” procedure. I knew this after submitting the question; However, I didn’t remove my question to take feedback about Threads[Task] package. I severely need to implement some command of Maple in parallel such as “fsolve” and “solve” for a big set of equations in a lot of unknowns. However, I am not able to it. For another example to apply parallel programming, I asked a new question about using “coeftayl” in parallel entitled "How do I can use the therads[Task] package to produce the coefficient of Taylor series of expression?".
Would you help me to learn how to use Treads[Task] package in the parallel-programming application of  “solve”, “fslove”, and “taylor” commands?