Mac Dude

1531 Reputation

17 Badges

11 years, 34 days

MaplePrimes Activity


These are answers submitted by Mac Dude

With the caveat that I use Maple on macOS, it is my experience that the readout can freeze on operations that cause large amounts  of output. My understanding/explanation is that the GUI, being a Java process, is essentially single-threaded, so if it is busy typesetting it won't update the status line.

Another, more sinister reason can be that the Maple kernel stops updating these values. I have seen that as well, and often (but not always) it idicates that the kernel evaluation is trapped in some endless loop at a low level.

You mention 9 hours accumulated run time. Is that expected for your task? I have Maple programs that can run this long, but those are simulations with a high number of iterations. A linear Maple program taking this long is almost certainly either stuck or up against an exponentially growing expression swell. Is Maple gobbling up memory? That would cause excessive paging, which also can slow the status update but at the same time would make your system sluggish to respond. If you have a parameter that governs the size of your problem you can gradually increase that (from a value where things work) to detect this condition.

M.D.

There is apparently a Maple Toolbox for Matlab, that gets installed when you install Maple. Maple's help facility has some info on it. Maybe it can help.

You can also check out the CodeGeneration:-Matlab() function, that supposedly outputs Maple code translated into Matlab code.

I haven't used either...

M.D.

 

Probably not a full answer, but in your example I would write:

unapply(eval(D(y->sin(y^2))(y)),y);

%~(x);

which, for a Vector or list x, is only marginally slower than your first expression. You want to avoid that Maple evaluates the derivativation for each element of the argument Vector so you do it for a (scalar) variable. I can see that there might be cases where this fails, although, you are not deriving by a vector anyway, so in most cases I'd think this works.

The tilde (~) creates new elementwise operators. subs substitutes variable names, not operators so it cannot work in the way you are trying in your last attempt.

If you want a float in the end, wrap the whole thing in evalf~().

Mac Dude
 

It will be mostly like having 2 processors. The GUI (written in Java) can chew up a good fraction of a CPU by itself, and that goes in parallel to the actual Maple compute engine which runs in a separate process (called mserver on macOS). Also, garbage collection in Maple now runs in parallel to the rest for a claimed speed increase of about 10% or so (I have not verified this but have evidence that this is about right).

But as far as scaling with the no. of processors, you only get that if you write your code using prallel programming techniques, which Maple supports through its Thread module and its Grid module (the latter is included for using multiple cores on one system; using several systems requires you to buy an extra package). There are a few intrinsically parallel functions (parallel versions of seq, add, mul) which in the right circumstances should get you a good speed-up; personally I have not been able to take advantage of these but that may be because the computation within the parallel Add (which I tried the most) were not CPu intensive enough.

Darien Ohashi has published here a series of parallel-programming hints and tricks well worth reading. I'll look up the reference & add it here if I can find it.

Edit: Here it is: http://www.mapleprimes.com/posts/200184-Parallel-Programming-Contents-Page

In summary: If you run existing code you are unlikely to gain much beyond the faster processor.

Having said that;  you may be able to run several Maple processes in parallel. If you have tasks like analysis of large files of data, this may actually help.

Mac Dude

Make sure you have "datatype=float" in your ImportMatrix statement. If you let it read as type "anything" it will slow things down.

One potential issue with that approach is that it will choke if there are non-numeric items (other than the separators) in the data.

Mac Dude

 

I did a quick test:

interface(verboseproc=2);
print(plot);
proc(p::{array,list,rtable,set,algebraic,procedure,And(module,appliable)} := [],{axiscoordinates::anything := NULL,coords::anything := NULL,ispolarplot::boolean := false}) local cname; if coords<>NULL then cname := convert(coords,'string'); if not ispolarplot and 5<=length(cname) and cname[1..5]="polar" and axiscoordinates='polar' then return plots:-polarplot(p,_rest) end if end if; try return Plot:-Plot2D(Plot:-Preprocess(procname,p,_rest,if(coords<>NULL,_options['coords'],NULL),if(axiscoordinates<>NULL,_options['axiscoordinates'],NULL))) end try end proc

So print() works as expected and it is not clear (to me) what your problem is. Specifically; you mention "I try to retrieve some procedures from a package that I have in a 2D output." What exactly does that mean? Using the print function, packages are printed in a typeset fashion, although the result does not look particularly "2-D".

Maybe you can post an example of the commands you issue to get the listing?

M.D.

You seem to want to disseminate worksheets to students that do not have Maple. This is a bit of a questionable premise. The value of Maple as a teaching tool, in my opinion, lies in the students' ability to manipulate th eworksheets, trying out different scenarios etc. It is a little hard to see how a series of canned applications will improve on the learning experience.

MapleCloud caters primarily to those having Maple and is a good concept in principle. But I have grown quite disillusioned with MapleCloud. In my experience with my classes it failed pretty miserably in that the sign-up process was brittle, often requiring three or four tries before it stuck, and even once we got them all signed up there were constant problems of stuff not showing up as expected. Dropboxes for exercises would not, or only sporadially, accept the students' solution worksheets. Eventually we had to give up & resort to email and USB sticks as MapleCloud just got in the way. Again, this was trying to use MapleCloud in the Maple framework.

I do not know WWWMaple. I actually wanted to play with MaplePlayer; but if it does not run on iDevices, no use for me as it does not run on macOS either.

I looked at MapleCloud on the web; the applet I tried did not seem to fully run (promised plots did not show. May well have been a problem of the applet.

But fundamentally, what can Maple sheets without a working Maple implementation do for your students? Presumably they are limited to run canned demos. I do not quite see the point of that.

In my own classes the students have the Maple Student edition. Yes there is an initial expense either for the students or for the institution; but then, textbooks nowadays are not exactly cheap either. I built my course as a series of Maple worksheets that together make up the script of the course; the students get a printed version (spiral-bound book) plus the individual worksheets, plus the pdf of the script. I think that works (it is significant work to build that, however). In the class they follow along in their worksheets and I try to make them engage and explore the Maple code as much as possible (which actually is not quite as easy as one might think). It also needs to be realized that there is a significant learning curve using Maple itself; this becomes hard to appreciate once one has gotten reasonably fluent with it. But it does get a bit in the way of learning the subject matter. I do however like to think that learnig to wrestle a CAS like Maple is of value in its own right.

My $0.02

Mac Dude

While Joe has given you lots of info, and while he is certainly the authoritative source on maplev given that he wrote it, here is what I am doing. I am not new to Emacs but I am not an elisp jockey by any stretch so maybe this helps.

First; maplev establiches what is called an Emacs mode. This mode will be activated when Maple input files are opened, which Emacs recognizes by the extension. The one I usually have is .mpl, which is Maple source code. It is distinctly different from the .mw worksheet files you will be familiar with.

I put maplev.el into my directory called .emacs.d, which has all my Emacs init files. This directory gets included in Emac' search path by the statement

(setq load-path (cons "~/.emacs.d" load-path))

which you put somewhere near the top in your .emacs file. The tilde refers to your home directory (this is Unix-slang). You then need to tell Emacs that this file should auto load:

(autoload 'maplev-mode "maplev" "Maple editing mode" t)
(autoload 'cmaple      "maplev" "Start Maple process" t) ; only if you use Maple from within Emacs.
(setq auto-mode-alist
      (cons `("\\.mpl\\'" . maplev-mode) auto-mode-alist))

again, in your .emacs file.

Save the .emacs file and restart Emacs and open a .mpl file to see whether your definitions have stuck, which you can see by the term Maple showing up in the status line. Emacs will throw an error (in the input line (the "mini-buffer") if something is wrong.

I would not bother with byte compilation; I literally have not done that in decades. It speeds up the load process; but on today's hardware that is no longer an issue.

I have no idea what maplev.mla is supposed to be. The Emacs mode works just fine without ever knowing about such a library.

This is not to contradict Joe; but I do feel this is a relatively quick way to get going with MapleV.

HTH

M.D.

 

Near theta=Pi, both arguments of the arctan go towards 0 but the limit of the arctan appears to be a finite value. So the plot looks smooth For arctan(0,0), however, Maple returns 0; this 0 is not visible in the plot but you see it when you eval the arctan at the exact value of Pi for theta. However, if you plot from Pi-0.001..Pi+0.001 you will see that the value already becomes unstable as both arguments to the arcsin become very small.

I would not consider this behaviour a bug.

M.D.

You do type checking of a parameter with the :: operator. If you want to allow more than one type you can use a set, like

f:=proc(a::{expression,list})

I don't think there is a direct way to enforce several parameters to have the same type but allowing different types. An indirect way, however, is to use overload:

f:=overload([proc(a::expression,b::expression) option overload ... end proc,
                    proc(a::list,b::list) option overload ... end proc]);

where each of the procs treat their respective parameter types. Maple chooses the matching proc depending on the parameter types.

The Maple Programming guide has such & other constructs explained.

HTH,

Mac Dude

 

Yes, creating Maple help files is extremely frustrating and a real hindrance to making nice and useable documentation. In fact, when I wrote the help files for a package I have published in the Application Center I could not do it until Maplesoft Support was called in and helped me getting this of fthe ground. Boris turned out to be a very helpful sort who figured it out and sent me a .mw file that takes my Maple worksheets and converts them into entries in the .help database, which is created as the first step in the program. I have attached the file. Obviously you'll need to edit it for your own purpose.

There is another issue: To have the help pages open in the help browser and not as Maple worksheets, the files cannot be "active"; whatever that means. From Boris' email to me here is the recipe to fix that (Quote): This parameter can be changed by opening the .mw file you wish to upload to the help database, going to “File > Document Properties”, and if the field “Active= true” exists, just double-click “true” and change it to “false” and save the file.

This is all about 9 months ago so some experimenting will be necessary to get this to work again. The gist is that you have to build a new .help database each time you update the individual files, replacement does not work. I'll actually have to get to this soon again myself as I am preparing an update of this package. But I do remember that eventually this sheet allowed me to create a working .help database. That then goes where the .mla file is.

I hope this helps; if you cannot get it done I suggest you call on Maplesoft support to help.

M.D.

fill-lattice-help.mw

 

Try

solve([f],[c,p,d,m]);

M.D.

 

Here is a link to dohashi's page on the subject:

http://www.mapleprimes.com/posts/200184-Parallel-Programming-Contents-Page

 

M.D.

Did you actually buy a license? If yes, you should have received your code by email. If no, then you need to buy one. Prices and conditions are on the Maplesoft website.

M.D.

 

I am not entirely sure I understand what you are after, but I have written large worksheets which are essentially papers (actually, more like text-book chapters).

First, I learned the hard way not to make a sheet too long. At least in older Maple versions, sheets exceeding a few MB in size cause trouble with Maple becoming intolerably slow. So I structure thing such that I don't need excessively long sheets.

In a sheet, I use sections, but not excessively so. Maybe 3 or 4 per sheet. They can nest if desired.

I do make extensive use of equation numbers (labels) when I reference prior results. I like Maple's way of structured labels (section.subsection.eqationnumber). Maple handles the renumbering well (by and large) when I need to insert stuff at an earlier location in the sheet.

I rarely, if ever, use ":" to suppress output.

I do bundle some often-used routines in a Package. For actual work (as opposed for writing something more like a paper) I have some very large Packages that are well structured and documented and make full use of Maples object-orientation-like features (i.e. modules containing modules containing records and procs) I have found this very powerful for large programs, although less so for writing papers.

I can and do work with such sheets on a 13-inch screen esp. when on travel even if I prefer the larger screens I have @ home and @ work.

I hope this helps,

M.D.

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