itsme

769 Reputation

14 Badges

17 years, 47 days

MaplePrimes Activity


These are answers submitted by itsme

This does not address any of your memory questions, but as a workaround, you can just use the "-c " flag of the "maple" command, which lets you define some maple code (in your case variables) that gets passed to the maple interpreter. You can then simply have a loop over some set of values in an external script (say in bash/python/whatever) that would execute "maple -c ... " type command which would define the values for the variables maple would work on. This way each time you run "maple" you would run it with a new kernel.

I have done this kind of thing often and it works fine. 

 

EDIT1: Note, I'm calling "maple" what you're calling "cmaple" as in linux (what i use) the executable is in fact called "maple". 

EDIT2: For completeness, let me add a trivial example in case someone finds this kind of thing useful:


contents of maple_code.mpl:
a:=a_INPUT:

b:=b_INPUT:

evalf(a*sin(b*Pi));

 

contents of runner.sh
!/bin/bash

for variable1 in 1 2 3 

do    

for variable2 in "0.1" "0.2"     

do          

maple -c "a_INPUT:=${variable1};" -c "b_INPUT:=${variable2};" ./maple_code.mpl   

done

done


Then simply make sure runner.sh is executable with 
chmod +x ./runner.sh
and run it.

It will run the maple_code.mpl with effectivelly different set of parameters each time. 


Note that the use of "_INPUT" suffix is of course not necessary and you could imagine settings variable values directly, but it can be useful in more complicated cases where you may want to give certain variables values later during execution and want only minimal changes to the code you usually execute in a "reagular" way. 

 

1) look up ExportMatrix

 

2) the command 

interface(rtablesize=32);

will do it. You can change the number 32 to whatever you want if you have bigger matrices. 

 

 

 

here is one way:

savePlotEPS:=proc(p, fileName, w:="750", h:="450")
    plotsetup('postscript', plotoutput=fileName, plotoptions=cat("quality=100,portrait,noborder,width=",w,",height=",h));
    print(display(p));
    plotsetup(default):
end proc:

myplot:=plot(sin(x), x=0..10):

savePlotEPS(myplot,"myfile.eps", 500, 400):

You could change the 500/400 numbers to whateve size you want.

Note that I have had problems with maple sometimes not reseting back to defaults or even overwriting files (when savePlotEPS is called in a loop!). One way around it that seems to work, is this version (see the sleep command):

savePlotEPS:=proc(p, fileName, w:="750", h:="450")
    plotsetup('postscript', plotoutput=fileName, plotoptions=cat("quality=100,portrait,noborder,width=",w,",height=",h));
    print(display(p));
    Threads[Sleep](2);
    plotsetup(default):
end proc:

thanks for the answer

Another option you have is to use an external editor (say vim or emacs) that may be easily controlled with a keayboard. To do this, save your commands in a simple text file - say fileName.mpl - and then from the command line run it with:

maple fileName.pl


You could also have the commands of the file fileName.mpl executed inside the maple GUI. To do this open up maple and run:

read "/path/to/file/fileName.mpl";


This is far from ideal, but it may be a superior method to edit large chunks of maple code, assuming you can control your editor with the keyboard.

I should also note that you can use keys tab and shift+tab to jump to the next/prevoius execution block (although shift+tab is still broken on linux in a worksheet mode).


Edit: Configuring keyboards bindings is not possible right now - but I agree, it would be great if maplesoft would implement that.

yes, exactly - in my work I often have a case where a I deal with a tensor product of (say) two hilbert spaces - one very small, the other large or infinite. So it would be nice to be able to represent the small one using the matrix formalism (i.e. with LinearAlgebra) and keep the operators on the other in the operator-form, and yet have the simplifications/etc work correctly.

Do you have an idea when we can expect an update to be publically released?

thanks

>According to that, the output for diff(Dagger(P(t)), t) would be 'unevaluated' (that is, as you are entering it, without performing any operation). That is what I have in the version of Maple under development after the bug got fixed. Opinions?

yes - that is what I would expect.

mytable:=table([B=4,C=2,A=3]);

sortedIndices:=sort([indices(mytable, 'nolist')]);

 


now to get the ith (say for i=2) entry from the table you can do

i:=2;

mytable[sortedIndices[i]];

 

 

I don't think you can do that (unless you extract the data for a given realization and say interpolate the points "in-between"). You can however pass in a "timegrid" (http://www.maplesoft.com/support/help/Maple/view.aspx?path=Finance%2fTimeGrid) which may be non-uniform. This might be helpful if you know what points you want to look at.

I installed the 32bit version. Right now it does nothing when I pass it the -cw flag, but I'll sort out later why.

In any case, even if the bindings would work with the classic version of the interface, I'd still be losing out on the performance superiority of the 64 bit version , which from what I saw can be significent in some tasks.

It would be great if the ability to change key bidnigns would be implenented in the future versions of maple.

thanks for your help.

 

I am also curious about this. I use tables all the time, as I find them useful for grouping variables together, but I do not know what the internal implementation is like. Someone from Maple who knows the internal implementation would be best to answer this.

Although, perhaps a way to gain some insight might be be to create a (VERY) large table and see how the access time scales as the size increases.

1) Maple has a "Physics" package which you might find useful (see http://www.maplesoft.com/support/help/Maple/view.aspx?path=Physics/* ). You can check the help-page to see what can be done with it and it may do what you need, but I have had some issues when dealing with operators acting on different Hilbert spaces (you can search mapleprimes for details). To a large extent QM is just linear algebra with complex numbers (ha!), so you can also do A LOT with the LinearAlgebra package.
2) The answer will depend on what it is you want to do. Personally, I use Maple daily, and I work in QM.  

I cannot answer your questions 3-5, because I've only had a very limited experience with Mathcad.

I might add, that one feature which is very useful for physics in general (but unfortunately rather limited in Maple) is the "Explore" command, which lets you dynamically vary multiple parameters of a plot (or a solution). Its equivalent (but much more versatile) command in Mathematica (called Manipulate), is the main reason, why many people I know use Mathematica instead of Maple. I really hope Maplesoft updates "Explore" at one stage... but perhaps that's another story for another post.

 

I agree that what you describe (and in particular the way you describe it, where it could be easily changed in real time) would be useful for the gui mode.

It is sort of possible right now if you work in the termial (and call your code with "maple <filename.mpl>"). You can use the macro $ifdef to mark off code you do not want executed, and simly comment out the macros if you do want the code to run - this can be made simple with a good editor. Something like this.

$ifdef notdefined
a:=1 #this will not be executed if never defined 'notdefined'

$endif

Yes it is possible as Alejandro suggests above.

Note however, that there are some problems when trying to control what the plots look like. For example there is a bug with the fonts when exporting to jpeg or gif. See for example:

http://www.mapleprimes.com/questions/124192-Exporting-Plots-To-Files

Thanks for your answers.

My ultimate goal is to produce publication-quality plots, ideally in the eps format.

I enlarge the gifs (by setting the size in savePlotGIF function) because I find that after conversion to eps, when latex shrinks them, the quality is better than it would be without increasing the original size. As I menioned the exporting with variable font does seem to work when ran from the GUI interface, but my other point is that I would like to obtain the same results from the terminal (I have access to powerful remote, headless machiens and running the gui on every run complicates things). 

Axel: I would like to "save" plots programatically, and not really "export" the worksheet by hand.

Acer: I will take a look at your method, it does seem nice! Could you verify that you get the same behavior in the resulting figures when the worksheets are executed from the terminal?

1 2 3 4 Page 3 of 4