Mac Dude

1122 Reputation

13 Badges

7 years, 206 days

MaplePrimes Activity

These are replies submitted by Mac Dude

@MTata94 @phil2 The FAQ phil2 mentions seems to address mostly issues where the Maple GUI cannot connect to the kernel. This is not the case for you MTata94, if I understand correctly.

Independent of that, however, you should have the files mentioned in the FAQ; these are the main Maple binaries. Without them you would not have a working installation. Note that on OS X, there is a /Library, sitting in Macintosh HD (your boot disk) and a ~/Library, sitting in your home directory. The Maple frameworks will be in /Library.

What are the general settings of your Firewall?


@John Fredsted Probably not, as when Maple hangs it will never get to the time statement.

I have used a variation on your theme, however: In a lengthy piece of code I would store the values of time()-t after each specific step in an array with the index counting up as the code goes along. When it got stuck I would break out & examine the array & see how far the code got. If it goes around the loop then you look for the value going down with increasing index; that is where the previous iteration values are still present & Maple hung.

When the code runs the overhead at least in my case was insignificant.

Another thing I would do for lengthy loops is to setup a gauge indicator that increments each iteration of the loop. This gives a nice visual clue of progress.

I do like acer's suggestion, however.

Mac Dude


Your post resonated with me. I occasionally teach a course in Advanced Accelerator Physics at the US Particle Accelerator School (, together with a colleague from CERN, and it is done just in the same way you describe: highly intensive 1- or 2-week courses, in essence cramming a whole semester's worth of material into two weeks. Two lectures a day and exercises in the evening. Classes are relatively small and lots of hands-on and 1:1 contact.  Students (which in our case are mostly either graduate students or those working in the field e.g. as operators or engineers wanting to deepen their understanding) are highly motivated and boy, do they hold their teachers accountable (in a good way)! It is a very rewarding endeavour, even if we are pretty drained by the end.

We do use scripts; in essence we wrote a textbook in Maple, with all the calculations live, obviously. Even though I curse regularly at Mape's 2-D input & printing, it is actually a big kudos to Maple that this is practical. As part of the tuition the students get student-licenses for Maple that they can keep, which I consider an essential element of the course, and which we know to be attractive.

We are still a bit struggling with keeping the lectures as interactive as possible. We added a sidebar to the script files where students could do their own explorations but the feedback on that was mixed: there just isn't enough room on a laptop screen for doing this in a nice way. The next time we may try putting a field below certain sections in the script where students can work on a given aspect. Lenin Araujo Castillo has just posted here one of his worksheets, and I like his layout, maybe we can experiment with that.

I visited IHEP in Beijing two years ago (as visitor-scientist, not as teacher). Your experience sounds very familiar.

For me personally, Maple opened up a path to teaching that I may not have gone otherwise. Using Maple allowed us to create a better course, and feedback we have gotten recently validates this impression. We do work hard on our course, using Maple in itself certainly does not guarantee a good learning experience (as I am sure you & everyone else who uses Maple in teaching already knows).

Thanks again for your post, much appreciated.

Uli Wienands
Argonne National Laboratory.

Any chance you have a beta license that is expiring lying around, that your version of Maple picks up? I had the same thing happen when I installed Maple 2017 beta, which would get in the way before my regular Maple 2016 got a chance.


@9009134 Ok, what is it you want? If you just want a solution to ode1; Maple will do this at least numerically; read up on dsolve(). Maybe it can even be solved analytically.

If you want to program a numeric solution (e.g. for homework) then you'd need to go back to your classroom material to figure out where to begin. I haven't programmed a d.e. solver in a long time so I m not in a position to write the solution down for you. There are many articles on the web about such mehods (look up e.g. Runge Kutta).

And Kitonum of course is correct, to define a function you need to put the arguments in (). But I think this is only a small part of your problem. I find the eval in your assignment to eq problematic. Syntactically you can make it more correct by writing f[i,j](x,y) and maybe include these in the argument list in the F1xx etc.  but I do not really understand your code. Also, while putting indicaes as arguments (to the F1xx etc) may be syntactically ok in Maple, it certainly does not smell right.

My apologies, but I would need more of an explanation what it is you are trying to do and the steps you are going to take before I can do anything for you.


Please give an example of what you have and what you want it to look like.


@Christiawanta Well, you use x already in your sum; and NLPSolve minimizes a function by varying its independent variables (indets in Maple lingo) so no, you don't need or want x explicitly in NLPSolve. While your data table suggest this is a kind of least-square-type minimization, it is formulated as a minimization problem for a function and does not explicitly deal with x other than in the sum of the terms. Since the terms are all squared the sum should be positive definite (unless you have complex terms, which you should not) and should have a minimum.

Some observations: You use a both as a "function" as well as a variable storing one of your constraints. I suggest you get rid of the line a(x):=qtopi[x] as you don't need it. Just put qtopi[x] into your expression to be minimized. While you are at it, please change sum() to add(); sum() tries to evaluate a symbolic sum into a closed expression, which is not what you want here.

I would also try to get rid of the first constraint (the sum of the psi angles to be 1) by eliminating one of the angles (psi3=1-psi1+psi2). You have already more constraints than is healthy so getting rid of one can only help.

I would also try to evaluate your expression numerically for a set of parameter values that fulfills all the constraints, just to see if the answer makes any sense. If you have such a set you can even consider building up the number of variables to be included in the optimization problem, thereby finding when the algorithm gets into trouble (if it gets into trouble).



@greenloafer Ahh... the plot thickens, so to speak.

It appears that the amer_approx code calls functions out of the bs program. The way to do this properly in Maple would be by wrapping up all the functions from bs (after conversion to proper Maple syntax) in a module, or even better a package (which is a module with option package specified) and export each function (which we then should call a method). So

bs:=module() option package
export N,phi,... ; # sequence of all the function names in bs
<here come all your functions, one after the other in arbitrary order, just following the template I gave earlier>
end module;

Since you are not familiar with Maple I suggest you pre-pend this whole module to your converted amer_approx code and call (execute) bs on the first line. After that you can use all the functions just like having written them without the module construct. The (better) alternative would be to save this as a .mla file and put it into a library and loading it using with(bs); but that involves some trickyness in getting Maple to do this and later find it & I do not recommend this until you have gotten your feet wet in Maple and also debugged the routines. If you expect to use these more often, however, that is what you will eventually want to do.

Just for completeness, there is a more pedestrian alternative: you can put the Maple code into a text file, save it with extension .mpl and then code


This will read and execute the code and thereby define all the functions. Here /path/ is the directory path to the file (in Windows it would be something like C:\...\). You can still make a module and may have to execute that.

Presumably the thesis referenced in the header of amer_approx.txt has explanations how this model works and maybe even test cases.


@greenloafer Ok, you have in your python file

def phi(z):
        return exp(-.5 * z * z) / (sqrt( 2 * pi ))

This obviously defines a function phi(z). In Maple, the general way to do the same thing would be to define a procedure like this:

  return exp(-.5 * z * z) / (sqrt( 2 * Pi ))
end proc;

(and before this gets side-tracked, since phi is a function the more terse way would be to write
phi:=z -> exp(-.5 * z * z) / (sqrt( 2 * Pi ));
but that would not work with a more procedural routine. proc() always works.)

You then use your function by assignment:


I urge again to make the effort reading some of the documentation. It is worth it if you want to use Maple on a routine basis and derive the benefit.


Edit: Pi is capitalized in Maple.

@greenloafer I don't really program in python, but this code looks straightforward to port to Maple.

def function() becomes function:=proc()...end proc;

= assignments become := in Maple

** becomes ^

pi becomes Pi

and all statements need to be terminated with ; or with : (if you want to suppress output),

and that seems mostly it, with one important caveat: Maple being a symbolic environment will keep anything that isn't assigned a number to as a symbol. This leads to the potential of accumulating huge expressions and slowing things to a crawl just because of a spelling error or a forgotten assignment. You can partially avoid this trap by wrapping your functions and/or expressions in an evalhf() statement, but that can fail in other ways. evalf() does not work, it will just evaluate what it can & leave the rest symbolic.

You may run into some names that Maple considers reserved works in which case you'll have to rename them.


Edit: removed incorrect comment about N() being undefined. It is in fact defined at the top of the file.

Although I never use palettes, I can see this being useful for large packages with many different functions or procedures. Having the package—upon loading—create a palette as you describe thus giving access to the top-level functions of the package should be a nice facility esp. for novice users.

Thanks for sharing this,


@akhmeteli I don't have time right now to try this myself (and the math is beyond my knowledge) but if your algorithm is a loop construct (like 2.25 in the paper) then I would, as a first step, use print() to have it put out some status info on each pass. Yes, it'll litter your worksheet but at least you can see where it slows down or hangs. Per se, >1 GB should not be a problem on a 64-bit system; maybe a problem on a 32 bit system, though (and on macOS at least I have seen the mserver process take twice as much memory than it advertises on the status like). And I have seen Maple choke on large expressions like this.

Gotta go,



@Lali_miani As written, you do not have a "system". In your file there are merely three procedures, or functions, each one takes three arguments.

Now, you can rewrite these three procs as one vector function that transforms the vector <x,y,z> into a new one <x2,y2,z2>. Then you can talk about things like fixed points etc., which would be the vector <x,y,z> that gets transformed into itself. I am not sure it exists for your system as it is not homogeneous (actually, I am sure it does not exist in general as e.g. f1 returns II + something, which can never be x unless II is 0, likewise for f3 which returns alpha). A quick try with solve did not return a solution for such a vector <x,y,z>, as expected.

Maybe I am missing something here, but then the problem needs to be clarified.

Mac Dude

@Christopher2222 Maple is a computer-algebra system. I really do not see how web-browser functionality is essential for that.

Besides, there are more than enough bugs and problems with Maple I am dying to see fixed. Sidetracking the Maple develper team with providing web-browser functionality seems a distraction and only likely to further delay bug fixing.

My $0.02,

Mac Dude

Consider yourself lucky. Maplesoft stopped supporting my perfectly fine G5 PowerMac after Maple 15 (and there is no 20 in front of the 15)... :-)

Mac Dude.


4 5 6 7 8 9 10 Last Page 6 of 37