Carl Love

Carl Love

28025 Reputation

25 Badges

12 years, 312 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

@Ali Hassani You asked:

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

In a sense, the help pages of most complicated software are necessarily "too complete" to facilitate self learning. They explain every command and option without suggesting an order in which to learn things.

I recommend that you learn Grid:-MapGrid:-Seq, and Grid:-Set first and ignore the rest for now. If your tasks are independent of one another in the sense that the output of one task is not required as part of the input of another, then these commands will be enough. This covers a huge number of practical cases.

  • 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);

As explained elsewhere, there is a bug when the input list has 1 element and the function takes more than 1 argument. Of course, having an input list with 1 element is not a practical use of Grid.

  • Is it possible to tell me those commands being thread-safe but not listed in page index.threadsafe?

No, but let it suffice to say that the vast majority of Maple commands are not threadsafe.

To assuage any nitpickers: There is a mechanism called option lock whereby any command that is not threadsafe can---in a limited sense---be made threadsafe, but this option must be used with great care or you'll cripple the multi-threading mechanism, thus making things take longer than they would have had they been done sequentially.

 

@nm Even without a minimal example, it should be trivial to answer this, even if the code is 10,000 lines: Is the code that resets libname inside a procedure that is a local or export of the module? If it's not, then it's in the body, and it's not saved in the .mla.

Yes, I see that I prematurely jumped to the conclusion that it was in the body. As Acer explained, your example doesn't conclusively show whether that's true. To me, the other evidence that you presented seems to point that way.

Regardless of its applicabilty to this particuar case, my Answer above explains the one fundamental difference between a module read from an .mla and one read from a plaintext file. So, I see the Answer as useful either way.

@janhardo Those A's are what I was refering to, in another Reply, for changing the color (to blue, or any other color). The A on the left changes the text color; the A on the right changes the background color.

@Ali Hassani You asked:

  • 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?

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.

Another exception is code for the numeric evaluation of mathematical functions in hardware-float arithmetic under evalhf. So, while abs(...) is not generally threadsafe, evalhf(abs(...)) is.

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

Generally, most seq or map commands can be replaced with Grid:-Seq or Grid:-Map. These are the easiest ways to use Grid. But note that Grid can use much more memory.

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

No, usually it's much easier.

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

Yes, there are no specific restrictions on code that can be used with Grid. There is no concept "gridsafe" analogous to threadsafe. Code that competes for write access to an external resource such as a disk file can be problematic (but it's still doable); however, the vast majority of Maple code does not have such competition.

@janhardo To get the blue output, I copy-and-paste **1D** output (interface(prettyprint= 0 or 1)) from my worksheet and then use the pull-down menu labeled "A" to change the color.

@Ali Hassani Unfortunately, the commands solvefsolvetaylor, and coeftayl cannot be used in the shared-memory environment of Threads. But there is a package called Grid that does multiprocessing without shared memory. It's a bit slower and of course uses more memory.

Example: Suppose that Eqns is a list of a thousand systems of equations that you want to solve with fsolve. Then just do

Grid:-Map(fsolve, Eqns);

@Kitonum zip was added in Maple 4.2.

Your method can be extended via seq to one or more lists (or other posint-indexable structures) by

MapThread:= f-> [seq](f(seq(a[i], a= args[2..])), i= 1..nops(args[2])):

@Kitonum Vote up for finding a way to use map, however cumbersome.

@ogunmiloro The solution shown in your most recently attached file is garbage, and it has a very large error, 10^12, which comes from you trapping the "cannot evaluate" error. Like I said before, you can avoid this error by including the option maxfun= -1 in the dsolve command.

If you want to plot C(T) for any given assignment of parameter values, do

res(parameters= [...parameter values...]):
plots:-odeplot(res, [T, C(T)], T= 0..times[-1]);

One thing that might help is for you to provide a small range of feasible values for each parameter.

@mthkvv I'll take a look at this. I don't understand the first input of the norm algorithm. Please give details and show an example of appropriate input. In particular, I don't understand "unit" or the significance of theta, which doesn't otherwise appear in the algorithm.

@mmcdara But how do you get tasklist to show it instead of showing N/A?

@nm The grey box can be edited inline. There's no need to repeat the process to edit it.

@ogunmiloro You say that you've adjusted the code, but I still see times[1], not times[i]. I also don't see any warning message. I think that you attached an old copy of the worksheet.

@nm Please confirm for me whether the above Reply is true, i.e., whether only the restart is needed.

@nm Put the command that sets your libname in your initialization file.

First 174 175 176 177 178 179 180 Last Page 176 of 708