Rouben Rostamian

MaplePrimes Activity


These are questions asked by Rouben Rostamian

Consider

restart;
L := [1,2,3,4];
x[j];
seq(%, x[j] in L);
x[j];

What would you expect the output of the last line to be?

Answer:   Maple says 4.   Why?

 

I want to write a proc, say f, that takes an single argument Z, as in
f := proc(Z::?) ...
where the only acceptable Z values are pairs [x,y], where x and y are selected from the set {a,b,c,d}. The entries a,b,c,d of that set are prescribed symbolic constants. 

Thus, the following are legal calls to f:
f([a,a]), f([a,b]), f([d,c])
but these are illegal:
f([a]), f([a,b,c]), f([a,x])

I don't know what to put for the "::?" in the proc's definition in order to enforce those constraints.  Any ideas?

Extra: In fact, I would prefer to ban the f([a,a]) option as well (no repeated symbols) but that's of secondary importance since it is easy to inspect and handle that within the proc's body.

Before Maple 2020, it was possible to start up Maple from the Linux commandline with multiple files, as  in

maple   -x   worksheet-1.mw   worksheet-2.mw   ...   worksheet-n.mw

That started up Maple's Java interface and loaded the n worksheets in separate tabs.

That no longer seems to work in Maple 2020 — now the command exits silently when invoked with multuple files.  Why?

Aside: Loading a single file works as expected, but not multiple files.

 

restart;

kernelopts(version);

`Maple 2020.0, X86 64 LINUX, Mar 4 2020, Build ID 1455132`

convert([1,2,3], Vector[row]);

Vector[row](3, {(1) = 1, (2) = 2, (3) = 3})

convert([1,2,3], Vector[col]);

This worksheet shows an unexpected behavior of pdsolve().  It solves the heat equation on the interval (−1,1) but fails on the interval (0,1).  I see no technical reason for this happening — it's probably due to a little bug lurking somewhere.

restart;

kernelopts(version);

`Maple 2020.0, X86 64 LINUX, Mar 4 2020, Build ID 1455132`

Physics:-Version();

`The "Physics Updates" package is not installed`

Solve the heat equation on the interval -1 < x and x < 1 and

boundary conditions u(-1, t) = 0, u(1, t) = 0.

pde := diff(u(x,t),t) = diff(u(x,t),x,x);

diff(u(x, t), t) = diff(diff(u(x, t), x), x)

bc := u(-1,t)=0, u(1,t)=0;

u(-1, t) = 0, u(1, t) = 0

ic := u(x,0) = cos(Pi/2*x);

u(x, 0) = cos((1/2)*Pi*x)

pdsol := expand(pdsolve({pde,bc,ic}));

u(x, t) = cos((1/2)*Pi*x)*exp(-(1/4)*t*Pi^2)

That's good.  Apply pdetest to verify it:

pdetest(pdsol, [pde,bc,ic]);

[0, 0, 0, 0]

Now, solve the same problem on the interval 0 < x and x < 1 and

boundary condition u__x(0, t) = 0 and u(1, t) = 0.  It should be

evident that the solution remains the same as the one calculated

above, due to symmetry, and here is the verification:

bc_new := D[1](u)(0,t)=0, u(1,t)=0;

(D[1](u))(0, t) = 0, u(1, t) = 0

pdetest(pdsol, [pde,bc_new,ic]);

[0, 0, 0, 0]

But for some reason Maple's pdsolve fails to solve the PDE.  Actually

its response is somewhat erratic -- sometimes it returns nothing at all,

and sometimes it exits with an error message.

pdsolve({pde,bc_new,ic});

 

Download pdsolve-fails.mw

 

5 6 7 8 9 10 11 Last Page 7 of 16