Joe Riel

9660 Reputation

23 Badges

20 years, 13 days

MaplePrimes Activity


These are replies submitted by Joe Riel

It prepends dir to the filename, with an appropriate separator.  An advantage is that if you are writing a procedure that could be used by others, it works on *nix, Windows, and Macs.

It prepends dir to the filename, with an appropriate separator.  An advantage is that if you are writing a procedure that could be used by others, it works on *nix, Windows, and Macs.

Are you sure you want to do

   k := k/2;

What could go wrong (quiz)?

Are you sure you want to do

   k := k/2;

What could go wrong (quiz)?

You  could use ?FileTools[AbsolutePath]

use FileTools in
    dir := AbsolutePath("maple/lib", getenv("HOME")):
    files := map(AbsolutePath, ListDirectory(dir, 'returnonly' = "*.mpl"), dir);
end use;

You  could use ?FileTools[AbsolutePath]

use FileTools in
    dir := AbsolutePath("maple/lib", getenv("HOME")):
    files := map(AbsolutePath, ListDirectory(dir, 'returnonly' = "*.mpl"), dir);
end use;

First, ?readdata is a procedure, so you have to use parentheses with it.  Second, it returns a list, which you'll probably want to assign to something.  If you want to catenate all the lists you could do

[seq(readdata(file)[], file in files)];

 

First, ?readdata is a procedure, so you have to use parentheses with it.  Second, it returns a list, which you'll probably want to assign to something.  If you want to catenate all the lists you could do

[seq(readdata(file)[], file in files)];

 

Essentially that's what frontend does, but it handles the backsubstitution.  You can do that manually, in Maple 13, with

vars := [x,y,z]:
subs(vars(t)=~vars, ... );
  ...
subs(vars=~vars(t), ... );

Essentially that's what frontend does, but it handles the backsubstitution.  You can do that manually, in Maple 13, with

vars := [x,y,z]:
subs(vars(t)=~vars, ... );
  ...
subs(vars=~vars(t), ... );

I avoided that because it requires more manual work (recreating the rhs of the odes, in a slightly different format).  The reason for using ?frontend is so Maple treats the functions x(t), y(t), and z(t) as variables, which Jacobian requires. Neither is ideal in that they both depend on the user being able to solve for the derivatives.

I avoided that because it requires more manual work (recreating the rhs of the odes, in a slightly different format).  The reason for using ?frontend is so Maple treats the functions x(t), y(t), and z(t) as variables, which Jacobian requires. Neither is ideal in that they both depend on the user being able to solve for the derivatives.

Because I just typed that in rather than actually testing it. The proper command is ?FileTools[ListDirectory].

Because I just typed that in rather than actually testing it. The proper command is ?FileTools[ListDirectory].

As a simple extension to Doug's suggestion, we can add a halt event when the rocket hits the ground

sol:=dsolve({rocket_eq,ics},x(t),numeric,events=[[x(t), halt]]):
tf := eval(t, sol(10));
plots:-odeplot(sol, [[t,x(t)] ,[t,diff(x(t),t)]], t=0..tf, color=[black,red],legend=["position","velocity"]);

First 98 99 100 101 102 103 104 Last Page 100 of 195