Mac Dude

1546 Reputation

17 Badges

12 years, 119 days

MaplePrimes Activity

These are answers submitted by Mac Dude

It works on the PPC version of Maple 15 on OS X. See attached file.

Having said that; I have found that plots:-display(label) does not work: I have to assign the plot structure to a proper name to be able to plots:-display it. So I can see that there are subtleties with using labels.

Beyond the fact that the Standard GUI still acts funny when using labels; like stepping the cursor across a label is always an adventure.


The syntax of a simple for loop is

for i from 1 to 4 do


end do;

Sometimes you can use the (in general more efficient) seq() as in


which returns a sequence (4 comma-separated results in this case). Wrap the seq() statement in angular brackets ([]) and you have a list of the results.

assign() is often seful with seq(), as in


which puts the result into the elements of r (which should be declared beforehand as a Vector, Array or list, as appropriate for your task).


Two items may warrant mentioning here:

If your processes do not need to talk to each other you may be able to use Grid computing (search Help for Grid). This sets up separate environments for each process and does not require thread-safety. The price paid is higher overhead; i.e. for many processes with short running time each the gains may be insignificant (or they even may take longer). Also, as without buying the GridComputing Toolbox you can only use cores on your local machine (the one Maple is running on).

The Thread model at least on OS X was broken for the 64 bit version of Maple 17. I could only get it to work by forcing Maple to run in 32 bit mode. This was on OS X 10.6.8. I have not tried it with my current setup (Maple 2015 on OS X 10.10.something). I do not know whether your error indicates something similar. Did you ever get Threads:-  to work with a simple example?


How to extract data from a plot has been answered often here, see e.g.  The command you want is getdata().

As for finding minima or maxima I am afraid you are on your own. If the number of points is not large you can always use brute-force to find them; but it won't be precise. If you want really precise answers you may need to do at least quadratic interpolation.

Or am I missing something here? Your term "received" would imply someone gave you a plot... ??

Mac Dude

(D(x))(t) is a differentiating operator. diff(x'(t),x(t)) is a differentiating operation. Don't assign anything to these; I am surprised Maple does not barf at these assignments. If you want to define differential equations, write D(x)(t) = ... (use = rather than :=). This defines an equation that Maple can do something with.

In your last block you are dooing it right: you are assigning a differential to a name (a variable); so no problem here.

I don't know enough about what you want to achieve so cannot help beyond this.



You have 3 equations with 2 unknowns which means there is no general exact solution. It depends on the numbers whether there is a specific solution. Be that as it may, use only two equations.

If you use only two of the three equations, in your first case, solve() will do this without any fuss:

solve([a = sin(w*t1 + phi),b = sin(w*t2 + phi)],[w,phi],explicit);

The result is a bit messy so I spare this board printing it, and there are branch cuts to consider, but nothing is out of the ordinary here. Since you have periodic functions you will likely have an infinite number of solutions; use the option allsolutions to solve to get more than the first one.

I'll leave it to you to figure out the 2nd case.

Check the help on solve to find out its options.

Mac Dude


We do not know what is in your launch.ini file (I assume you refer to the Maple initialization file, which I thought was maple.ini on Windows, but I could be wrong) so we cannot tell for sure, but I think it is unlikely to be the problem.

I have had some issues in Maple (15 and up, standard GUI, worksheet mode) when selecting the entire output including the terminating characters. If I want to copy output for later paste I usually make sure the selection range does NOT include the final (invisible) character and does NOT extend to the next line. On occasion I would not copy the last visible character and add that one manually (usually it is a closing bracket). There is certainly no general issue with copy-pasting output or even parts of it. Do note that sometimes the pasted input looks different as Maple may use a different form internally than what the pretty-printer produces.

For really long output, taro's suggestion to use lprint is not a bad one, alternatively, you may just want to write out the variable to a file and read it back in as a string. You can use "parse" to convert it back to an expression.

Mac Dude


In your definition of w(n) there is no way to tell when the recursion is to stop. Typically, the recursive call would be w(n-1), and in the definition of w you return when n=0. Or something similar, depending on your specific problem.

As is, if w(n) calls w(n) the recursion can never stop. Hence the error you got.

Also; you appear to use = as assignment operator; that should be :=. Furthermore, to prevent grief I suggest you use the arrow operator to define a function:

f:= (x,w,t) -> x*w*t;
r:=(n) -> n; # and what is that supposed to do??

The way you wrote it f is not going to work as you expect. Note that the parameters to f are simple names; you use the functions when you call f (as in result:=f(x(n),w(n),t)).

If you explain a little more whatyou are actually up to then I am sure we can be more specific.

Mac Dude.


Try adding a vertical label with a lot of blank spaces, like "...,labels=[typeset(" ").typeset("                        ")]);

Unless you changed the default the label will be printed in horizontal orientation thus creating the space you want.

Mac Dude


D is a protected name (the differentiel operator) in Maple and cannot be assigned to. So choose some other name.

Also, do you want "D" to be a Matrix, or a function? If a Matrix, you need to pre-define it as such else Maple will create a table (an associative array, what other languages call a hash). If n is known you would use square brackets rather than braces to do the assignment; but you can also use braces in what Maple calls "programmer indexing", which allows to dynamically enlarge the Matrix, but then the indices always start at 1. RTFM for this topic.

I think the latest versions of Maple may allow for the notation you use for D to define a function, at least in 2-D input. Due to the similarity to programmer indexing I would suggest you do not use that notation but rather Maple's arrow operator to define a function (if that is what you really intended). While maybe a bit weird initially, you get used to it quickly and will appreciate the uniqueness of it.



Here is an attempt to give you at least a feeling for what these do and what their main thrust is. Note that I am a Maple user and a LaTeX user, have used Mma maybe 10 years ago and have dabbled in Matlab.

Maple and Mma are computer algebra systems (CAS) so you can use both of these to do analytic work incl. solving of equations and solving of differential equations (ODE and PDE). Each of these systems have certain limitations I cannot really go into too deeply here. Maple and Mma also nowadays have extensive numerical capabilities; I have analysed whole experimental data sets with thousands of records in Maple, but not any with millions of records. Maple allows you to write complex code and also build a GUI for ease of usage. I assume recent versions of Mma allow the same. Maple has a certain amount of object-oriented capabilities but is not a full-fledged oo language. Mma is stronger as a language for functional programming than Maple according to others I discussed this with.

Matlab originated as a "wrapper" around LaPACK and BLAS (highly optimized linear algebra and matrix routines). Over the years it acquired many more capabilitie incl. the ability to write GUIs and also, I believe, some analytic (or algebraic) capabilities. The matrix capabilities are highly optimized and efficient (I believe more so that Maple's although I have not done a direct comparison). Matlab's freeware cousin Octave has oo capabilities; I assume Matlab as well (but I don't know that for a fact).

For both Maple and Matlab there are Toolboxes you can buy to extend their abilities e.g. in simulation or digital filter design. Again, Maple allows algebraic work whereas I suspect in Matlab you are quickly relegated to doing numerics. In my professional environment (particle accelerators), Matlab is in widespread use for anything from data analysis and processing to being embedded in the control system, making use of its GUI and plotting capabilities. Mma (and to a lesser extent maple) are used by our people to do theory.

Finally, LaTeX is a different beast altogether: it is a document description language built on top of the TeX typesetting system. Maple and Mma both have the ability to create LaTeX code from (pieces of) their workbooks so you can include that into a larger LaTeX document (e.g. a paper you are writing).

If you need help in deciding which of these to use (e.g. to buy) please indicate what you want to do with it. If your aims are general (i.e. "I am a n-th year student of physics..." or similar), I suspect Maple or Mma have broader applicability than Matlab due to their analytic capabilities. I am a Maple user and use Maple in a teaching environment, therefore I am biased towards Maple. If you need it primarily for data analysis or numeric work, Matlab maybe better suited, in parts due to its widespread use for such things. In that case it is worth investing Octave as well; maybe not as powerful or polished as Matlab, but free. Note that, unless you are a professional and large-scale user, questions like efficiency are likely of secondary importance. Any of Maple, Mma and Matlab will be able to cope with relatively large problems, if my experience with Maple is any indication here.

So, let us know what your applications are and we'll take it from there.


Well, you refer to "the above output" but the above lines are actually Maple input.

Then, "Maple-friendly format" is a little ambiguous. Do you want to be able to save a whole worksheet as text, input and output, and be able to read it back in? Or is writing input only sufficient as you can always run the read-in sheet and recreate the output. If all you want to write is a specific variable; tomleslie has shown how to do that.

In the standard GUI you can save worksheets in various formats using File>Export... In the following dialog; chose the format you want: Maple text refers to saving input and pretty-printed output in ASCII form. You CANNOT read this back in as Maple chokes on various issues. If you save as Maple Input; only the input gets saved in ASCII as a .mpl file but no output. You CAN read this back in and run it to recreate the output.



The "Open Recent..." item in the File menu has a "Restore Backup" item that has, on rare occasion, given me back  some work that got clobbered. You can also try looking  for a "<filename>_MAS.bak" file in your working directory and try opening that. However, in general it is retyping time.

For the next time, though, when you get the "Kernel connection lost" message, save right then! If cmd-s does not work, quit Maple at which time it'll ask you whether you want to save the sheet, to which you answer "Yes." Your sheet will be saved.


Your need is not quite clear. But assuming that upon reading-in the Excel data you end up with some kind of variable holding text strings and you want to use these text strings as variable names to assign to, you can use assign() to do that. Example:

assign(cat(``,t)=3): # assigns 3 to variable Test

The cat() construct is to coerce the strings to Maple names. There may be other methods to do this conversion. At the same time you can use cat() to pre-pend some common identifier.

HTH, post more details if I missed your question.

Mac Dude

Check the downloaded file with an editor (since it is csv you can do that, but you may need to skip the FileTools:-RemoveDirectory in DL()). Most likely the last line (or one line somewhere) is too short or otherwise malformed. ImportMatrix is not particularly graceful when it comes to irregularities in files to be imported.


Edit: Oops; did not see the other replies before posting. However, the point to inspect the downloaded .csv file is still valid; inspecting .xlsx files from the same sheet does not count as they can (will) differ.

First 8 9 10 11 12 13 14 Last Page 10 of 20