itsme

569 Reputation

13 Badges

12 years, 316 days

MaplePrimes Activity


These are answers submitted by itsme

if the goal is really to execute the commands anyway, then another option might be to write your 'data' to a file, say, 'data.mpl' and let maple do all the parsing/executing in one go via

read("data.mpl");

 

like this.. say f is your function of theta, which depends on time

f:=theta(t)^2 + sin(theta(t) - phi) * cos(theta(t));

#here is it's derivative w.r.t time

der_f:=diff(f,t);

#can also simpliy:

simplify(der_f);

 

one way to do it, with only basic algsubs command is using a temp variable:

algsubs(p(x, n, q, t)/mu(x, n, q, t)-T(x, n, q, t)/p(x, n, q, t) = var1, cont);

collect(%, var1);

result := subs(var1 = p(x, n, q, t)/mu(x, n, q, t)-T(x, n, q, t)/p(x, n, q, t), %)


you could also probably use the freeze/thaw combination (see maple's help).

I'm not entirely sure what you mean by the last part of your question... but you can get a the coefficent of p(x, n, q, t)/mu(x, n, q, t)-T(x, n, q, t)/p(x, n, q, t) into a variable easily with somethilng like:

a_coeff := coeff(result, p(x, n, q, t)/mu(x, n, q, t)-T(x, n, q, t)/p(x, n, q, t))

then again use subs to substitute it into final equation.

 

in principle at least, maple (with a front end gui) should work fine with a "modern enough" macbook... how old is yours? what kind of issues were you having? did you try maybe reinstalling maple - could be that the installation got corrupted somehow.

Using an external editor is a perfectly valid mode of working with maple, given that the standard gui frontend is very limited in its editing capabilities. In the simplest operation mode, the idea is to create a text file in your editor (say emacs or vim) - the maple convention is that this file should have an extension .mpl. Then add maple commands to it, and simply run from a terminal by executing

maple myprogram.mpl

This works extremely well, especially for larger programs. There are however a few drawbacks to this approach:

- plotting is very broken (unusable in most cases) when done from the command line. You can, in your program, in principle save your plots to a file (say myplot.png), but any plots other than very simple x vs f(x) plots will not work properly. This for some (me) is a HUGE limitation, because it means that one can't properly create presentable plots in a batch mode, but instead has to babysit gui sessions (or more realistically just use other software)
- this kind of working mode is not good for interactive work... (although I should note I have not used Joe Riel's emacs extension since I prefer vim, but it may be a little more interactive-work-friendly - for example if it doesn't spawn a new process on each execution)

Note that it is also possible to nicely use scripts that you've written in your editor in a gui session. You can simply open a maple sesssion in a standard way and run your code (that you've written in an external editor) by executing

read("myprogram.mpl");

if you are using maple 2015, you should (in principle at least) be able to use:

Grid:-Set('Digits');

to set the the Digits variable for seconadry processes.

 

your best bet is to use the double underscore syntax... easiest to type, and usually copy/pastes without issues.

like so:

mu__001  #note there are two underscores.

it works very well in worksheet mode, but and my guess is it should also work in document mode (although i have not tried)

 

 

the first thing you might want to try is getting rid of the semicolon at the end of these calls, and use a colon in stead (but maybe assign the result to a variable).

i am finding that the biggest issue is that these calls try to print 10e7 number of items to the screen, which is a nightmare for maple... I have not tried to go as far as 10e7, but for me at least, grid seems to work with smaller list sizes, as long as i'm not trying to print everything.

is it possible that in the thread case you actually did not have a semicolon, while in the grid case you did??

you can try exporting to png, then converting to eps after.

for best results make the plots large (possibly also increase the font of labels, etc), then scale down in latex by including the "width" option of \includegraphics command. Like so:

\includegraphics[width=2.4in]{myplot.eps}

like this

 

restart:

F:=diff(y(x),x)^2 -y(x)^2 + 2*y(x)*x^2;
            
Physics[diff](F, diff(y(x),x));

While not exactly the result you want, I personally find using double underscore the most effective way to name variables. In your case I would call the variable as delta__x, the 'x' would be subscripted however, and what you're asking is slightly different.

...but IMO that's a small price to pay if you consider the alternatives from the other threads. The variables created this way are typeset nicely (i.e. the greek letters are shown in 2d output as greek letters), trivial to type, always (so far for me) copy/paste without any issues. They are also "atomic", so if you assign x later, it will have no effect on delta__x (in contrast to variables treated as delta[x] for example, which maple really thinks of as tables).

It really depends on your data/plots, and also how you will be using the plots (i.e. in latex docs for example)?

As others have already stated, you can export directly to eps - which is often desirable. However in some cases this won't work. For example if you have density plots with many points, the size of the exported files will be unmanageable (100s of MB).

What I have settled on (after much experimentation), is to always export to png. I make the plots "large" (as in 1000 pixels or more). This also requires increasing the fonts of labels, title, tickmakrs, etc... and often the line width of the curves. I then convert these to pdf or eps (i'm on linux and this is a trivial process with a package called imagemagic - you just do 'convert myfile.png myfile.pdf'). The final step is to force latex to scale down the plot via the 'width' directive in the actual document. This is done like so:

\includegraphics[width=2.4in]{myfile.pdf}

All this leads to very presentable figures (in most cases). If you need more control over how your plots look and feel, there are much better alternatives. For example a python package matplotlib is superior to maple plotting in basically every way - but of course the drawback is that you have to jump through hoops of first exporting your data from maple... then importing in python.

Your millage may vary if you're on a different OS or use different packages in your work flow.

I think one of the dots in the last definition for w is a decimal point and not a multiplication sign.

... Either way, I recommend not using the default 2d math input at all... your millage may vary, but using maple in a worksheet mode with only 1d input will eliminate most of copy/paste/input issues. You can change defaults in the preferences.

Besides using Carl's very nice suggestions above, you might also find the Finance package useful. The Finance package can solve stochastic differential equations "out-of-the-box" and it has some nice features related to plotting (for example showing many realizations at once, etc).

The other reply shows how to get a formatted time. Another command that is very useful when creating "informative" files names is sprintf - it makes it trivial to for example create dynamic file names based on (say) variable names and their values.

1 2 3 4 Page 1 of 4