quantum
quantum

Reputation: 111

Efficiently programming in Maple

I need some tips on efficiently programming in Maple (as in the computer algebra software). By efficient I do not mean making my program/code more efficient (performancewise) but rather efficiently working with Maple codes. This is ironic, but I am quite spoiled by software and tools developed for programming in languages such as C/C++ e.g. : IDE, debuging tools (watches, breakpoints, etc. etc.), compilers and the language structure itself (object orientedness, more flexibility with procedures, overloading, passing by reference or value etc.). In this sense I feel more comfortable programming in C/C++ (I use visual studio) or even in script languages like python (no real debugging but I feel more in control and discipline working).

Maple on the other hand, is one of the few languages (somehow I do have similar problems with other CAS but maybe to a lesser degree) where I feel I do not have discipline. I tried just simply working with some text file (most people call it .mpl files) and just read the text file in maple and just load this text file from maple e.g. read("some.mpl"), this allows me to diff my changes when using a version control like svn or git (the .mws or other maple file format aren't so version control friendly). On the fly programming can be really cumbersome the IDE often takes a long time loading and feels very heavy. So I just write my codes in Notepad++ (working in windows) and costumized a "Run" in Notepad++ menu to call cmaple (the console version of maple) and read my .mpl files on the fly. This are the few steps I took to help me work more efficiently. But I think I can do more and I would appreciate any tips. Right now for instance, I feel like maple (unlike in programming languages in C, python, java etc.) does not work very well when one has many procedures. In C/C++ or any C-like languages, I can practically inline all my code as procedure and call them individually , sometimes you get weird behaviour if you do this in Maple. Sometimes even, functions and maple commands behave very differently when they are within a procedure (I have experience such a thing when for instance wanting to do SVD or LU decomposition within a procedure). One has also to be careful when working with nested loops (e.g. print command have levels where they do not appear if you reach a certain level of your nested loop in a procedure and other things that I am sure I still do not know) and very many other things that gets irritating in the long run.

So I think I have an idea what tools/softwares to use to make programming easier when working in maple. But I still do not know how to program properly and more efficiently in maple. To the initiated C programmer many things are very unintuitive and even annoying in maple. Is there any other things that I should be cautious about when programming in maple (e.g. unusual behaviours when reading several .mpl files in another .mpl file, different types of global/local variables, saving all of the variables in a worksheet, backward compatibility between maple versions etc.). It is probably better to also ask for a reference/book that does provide these advises. Just for the record: I have been programming in maple (seriously) for more than 2 years and I still do not feel as comfortable as in the first 6 months when I first learned to program in C.

Upvotes: 1

Views: 808

Answers (2)

Audrius Meškauskas
Audrius Meškauskas

Reputation: 21728

From my experience, the most efficient flow is to solve mathematically heavy parts in Maple and then use these results for producing C code you can embed everywhere, from for C++ numeric simulator of your scientific project to code fragment in your JavaScript computer game.

The strongest sides of Maple are symbolic mathematics and code generation, it nicely complements your expertise in C++ or say even Java without ambitions to replace these languages where they are better.

Upvotes: 2

DSkoog
DSkoog

Reputation: 657

If you're looking for a written guide, the Maple Programming Guide is probably the best resource out there at this moment for getting started (though if you've been programming in Maple for a few years, you may have moved past it already). It is distributed by Maplesoft and is available in their documentation center. I've also heard good things about 'Understanding Maple'.

That said, there's probably much more that you can learn from anything tagged Maple on StackExchange or more importantly from the Maple user community at mapleprimes.com. You cover a variety of topics in your post, so what you might try is to simply add a short code example at MaplePrimes in order to further explore the topic with the Maple experts there.

Upvotes: 2

Related Questions