Mac Dude

1232 Reputation

16 Badges

8 years, 262 days

MaplePrimes Activity

These are answers submitted by Mac Dude

Loading a package using with() masks the global definition of any symbol you export in the package. I once wrote a package that redefined the same dot operator you use, `.`. As a result the global definition of `.` no longer was effective & I had to revert to a messy construction using overload() to apply my redefinition only to the types that needed it. So the behaviour you see seems to me as expected. Do note that VectorCalculus:-`.` could be written such that it preserves the functionality of :-`.` by clever way of using type definitions. In that sense, VectorCalculus:-`.` indeed can check its arguments & fall back on using the normal :-`.` where applicable. I hasten to add that I don't know what VectorCalculus:-`.` is actually doing in this regard.

I have been wondering about the effect of name clashes myself, when several packages redefine the same symbol. So just as you are, I am hesitant loading multiple packages using with(). It should not be difficult to test Maple's behaviour in such cases. I'd speculate that using several with() statements, each in its own execution group, the last one wins.


Yes, this does happen, and it can be mighty annoying as all variable values are gone & one cannot find out what went wrong. There is no good way around this I know; but a few hints:

(a): Save a sheet before you attempt to run it. In this way you preserve your starting point.

(b): If this happens in a loop, lower the end point so that it only does a very limited number of iterations. Print the index at each iteration so you know how far it gets.

(c): Check the memory value at the bottom of the sheet. If it goes up and up you are likely running into "expression swell", i.e. some intermediate expressions are growing, most likely exponentially. Terminate the process in the early stages so you can get an idea which ones are growing. Occasionally (but not very often) I have had luck with running simplify at each step. If you use modules and Records you may run into a memory leak, i.e. Maple keeps allocating space for new objects which will make it run out of memory while at the same time slow it to a crawl. This situation also reveals itself in an increase in time per iteration if a loop is involved (which is usually the case).

(d): Post an example here that shows this behaviour. Mention the Maple version you run.

There are ways to limit space and time but I don't know whether they preserve variables. Check help on kernelopts() for these.


plots:-setoptions(size=[1200,500]) in your .mapleinit file will make this the default for 2d plots.

I do note that I have had on occasion issues with setoptions, so it is conceivable that for thing like plots:-display() the option might be ignored.

Mac Dude

Edit: You can set most option with this command. See the Help on setoptions.

f is overwritten near the end of the loop; the new f with no more c[i] is then used in eq1 on the 2nd pass  through the loop. Then the fsolve returns NULL (no variables to solve for) and the eval fails. If this is intended then you have a problem. If f is always to have the form as in the assignment after eq1, then assign the eval to g near the bottom and plot g. That produces this plot:


Mac Dude


One way is to eval your series:

eval(series(...),g='x->x^2+1'); # note the uneval quotes

which returns

This is of type series, to make it a normal expression use


to get rid of the O(x^4) part.


Well, there is the Maple Programming Guide; an excellent document describing Maple programming in detail. I learned a lot from it and still use it for reference when needed.

As for editing, I suggest looking into the maplev Emacs module by Joe Riel. This gives you syntax coloring, indentation and such. You edit a .mpl file with Maple code; that you then read into the worksheet to execute it. Or, if you don't need the graphical aspects of Maple's GUI, you can run it directly from emacs using the command-line version of Maple. What I personally do is to put code of any length or significance into a package edited using emacs/maplev an then read the package & save it as .mla file using LibraryTools.

A debugger is available in the standard GUI. stopat(routineame) will bring it up.


Well, it depends on what you want. taylor is the Maple function for Taylor expansion by a single variable, and the use is straightforward (for up to first order (linear)):

xpr:=F(x,y+q,G(x+q,z) );




The results are in a series form; use convert(s,polynom) (where s is one of the above results) to make a normal expression (polynom) out of it.

If you want the expansion in all three variables, use mtaylor:


and note that mtaylor returns a normal expression, not a series.

series() is a more general expansion procedure in Maple. mseries does not exist, but is possible to program.

It's all in the Help files. They also explain the derivative operator Dn. Use them.




It appears this has only the trivial answer (everything is 0). I worked this along the lines of using solve and eliminate repeatedly and one runs into infinities sooner or later. See the attached sheet.


About a year ago I wrote myself a little package that can model RC, CR and LRC circuits. Please see the attached. I also attach a test file that should demo its use. Actually, I don't as MaplePrimes refuses to let me upload a 2nd file. WTF?





If, by math type software you are referring to MathType, the "full", paid-for version of the Equation Editor that has been arund for a long time in MSWord, then you can select a Maple output string, copy as MathML and paste it into the MathType window. It'll need some post-editing but you'll get reasonably close.

If you use actual LaTeX, the string Maple produces needs to be embedded in math mode. You would usually put this into a LaTeX document at the right position and put it into an equation environment. In my experience the LaTeX code is not very efficient but it should typeset. I often manually clean it up. If you don't use LaTeX these terms will be meaningless to you and you should use a different mechanism to get your output into Word. Maple supports RTF and HTML. I don't know whether these are sufficient for you; if you do heavy math they may well not. Maple lso supports export as pdf... I have no clue what that does. The Help facility has a number of pages dealing with this; search e.g. for format.

Send an example if this answer doesn't help you.


use "assuming a>0", then it works (the result is too large to show here). It appears this integral diverges for a=0.


Edit: Ninja'd by Mariusz

I assume you need to show this explicitly. I'd do it like this:


note: only the numerator in the differential


at which point you can see that the division by h just removes the common factor and you can eval the rest for h=0 yielding the result:




I hope this helps,



MathType is indeed te way to go. You copy the Maple output (from the Standard Notebook Interface) as MathML and paste into a MathType document. The result may need some manual touching up but the basics are there.

It does appear that MathType has been sold to a new outlet & now is subscription based. This makes it expensive if you have the odd need only. On the other hand, development had mostly stopped so maybe this will end up being a good thing.

Your alternatives are screen dumps to a TIFF or PNG file & paste it in; or, as rlopez suggested, do a round trip via LaTeX (and figure out how to get that into Word).


Your solution is to use evalf (no h before the f) instead of evalhf. IIRC evalhf is not able to do lexical parsing, which in this case means it cannot find the member (or property) of a module. If you really, really need to use evalhf you may be able to assign to a local variable and call evalhf on that.

As for restart, Maple does not allow restart within a proc or module. It is very hard to see why you would ever want to do that (and for nested calls, where should Maple restart from??). So get rid of it. Use error "message" to catch any error comditions.

Mac Dude

I believe what you are looking for the the error of the parameters. I ran into a imilar issue years ago and wrote a variance routine that does this to firt order. See the attached Mape worksheet. Read up on how to use the matrix in Statistics:-Linearfit.


1 2 3 4 5 6 7 Last Page 1 of 18