Ali Hassani

45 Reputation

4 Badges

7 years, 248 days

MaplePrimes Activity

These are replies submitted by Ali Hassani

@Carl Love 

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.






for i from 1 to nops(dummy_UU1) do


end do;



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!.


for k from 0 to num do

for h from 0 to num do




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":


@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.


@Carl Love 

Hi again,
Thank you very much.
Best wishes

@Carl Love 

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.


@Carl Love 


Dear Carl,

Thank you very much for your reply.

The answers are very informative for me especially about question 1.

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.

I am eagerly looking forward to your reply

Thanks in advance




@Carl Love 

Dear Carl,

Thanks so much

My Maple version is 2020.


Thanks so much

Best wishes

@Carl Love 

Hi again,
Your comments are very useful.
Thanks so much

Dear tomleslie,
thany you so much
Best wishes

@Carl Love 

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.

However, when I tried to re-write the above by application of a procedure, named 'dummy', the code doesn’t correctly execute.
end proc;
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:
I wrote the Map-versioned 'taylor' command as the following, however, it returns the error. what is the reason?

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?

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
Thank you for your attention.
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?

@Joe Riel 

Dear Riel,
Before anything, I thank you for your reply.
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?
Thanks, in advance
Best wishes

@Carl Love 

Dear Carl,
Before anything, I thank you for your reply.
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?
Thanks, in advance
Best wishes

1 2 Page 2 of 2