Maple 2018 Questions and Posts

These are Posts and Questions associated with the product, Maple 2018

I am learning how to do animations in Maple, and I need to export an animation I made to animated gif file.

nTerms := 20:
lam    := evalf([BesselJZeros(0,1..nTerms)]):
c      := seq(1/lam[n]^2*BesselJ(1,lam[n]/2)/BesselJ(1,lam[n])^2,n=1..nTerms):
mySol  := proc(r,t)
   local n;
   4/Pi*sum(c[n]*BesselJ(0,lam[n]*r)*sin(lam[n]*t),n=1..nTerms);
end proc:

maxTime := 5: (*seconds*)
delay   := 0.03:
nFrames := round(maxTime/delay):
frames  := Array([seq(0,i=1..nFrames)]):

frames  := [seq( plot3d([ r, theta, mySol(r,(i*delay)) ],
                   r      = 0..1,
                   theta  = 0..2*Pi,
                   coords = cylindrical,
                   axes   = none,                    
                   title  = sprintf("%s %3.2f %s","time ",(i*delay),"seconds")
                ),
             i=0..nFrames-1)
           ]:
plots:-display(convert(frames,list),insequence=true);

And the above makes

 

I have few questions which I could not find an answer for.

How to save the above sequence of images frames (in the list frames) to an animated gif file programmatically? Currently, I use plots:-display(frames,insequence=true); and then right-click on the screen out, select export->GIF  and this does save the file as animated file.

The problem with the above method, is that I have no control on telling Maple some options. For example, I want to control the amount of delay between each frame when it is played in the web page. I also want to tell Maple for example to play this once in the gif file.

These options are suppored in Mathematica. But I do not see how to do them in Maple. In Mathematica, given a list of frames (generted from a Plot command), which is the variable "frames" in the above Maple code, then one can do this

Export["anim.gif",frames,"DisplayDurations"->Table[.2,{Length@frames}]]

Now when loading anim.gif in a browser, the delay between each frame is 0.2 seconds. The "DisplayDurations" set the delay between each frame when played in the browser  automatically.

One can also add the option

"AnimationRepetitions" -> 1

and this will make the animation play one time in the browser when first loaded. Now Maple generated animation gif file plays continuously which I do not want to, this is even though inside the notebook, Maple says it will play "single" time. But this option does not seem to be exported to the animation gif file

 

 

Is there a way to configure these options? When I right-click, and export the animation to GIF file, I see no export options to change.

I could not use the export("anim.gif",frames)  command in Maple, the generated GIF file is not animated.

thank you

I am looking at the help pages, and I see Maple code using symbols never seen in Maple language before.

I tried to do ?&under to get help on this new Maple language command/symbol, but help does not show it. I read help Neutral Operators but do not understand it.

What does the following mean in plain Maple code?

And what does the following mean using Plain Maple code:

 

Could the above be written without using these `&` things?  I am having hard time understanding what the code is doing because of these. Never used them before.

These are from help on "Definition of a Structured Type in Maple"

I need my results are nice and neat in final presentation so how can I change the way it present matrix in maple, its so messy in hear like picture . It happend resulted in Maple can reduce the same ratio such as As^2+Bs^2=(A+B)s^2, I tried all my best to find way to simply it but its so hard due to my noob in maple. Please help me make it nice and neat in array of matrix [    ]. 

I have the following equation:

eqn := m*`ℓ`^2*(diff(q[1](t), t, t))+k[t]*`ℓ`^2*q[1]+5*k[r]*q[1]-4*k[r]*q[2]+k[r]*q[3]-5*P*`ℓ`*q[1]+2*`ℓ`*P*q[2]+2*`ℓ`*T*q[1]-`ℓ`*T*q[2] = 0;

And I want to execute the following substitutions:

k[r]/(k[t]*`ℓ`^2) = alpha;
P/(k[t]*`ℓ`) = sigma
T/(k[t]*`ℓ`) = theta

For that, I have tried:

expand(eqn/(k[t]*`ℓ`^2));
eqn1:= algsubs({k[r]/(k[t]*`ℓ`^2) = alpha, P/(k[t]*`ℓ`) = sigma, T/(k[t]*`ℓ`) = theta}, %);

And:

eqn1:= algsubs(k[r]/(k[t]*`ℓ`^2) = alpha, %);
eqn2:= algsubs(P/(k[t]*`ℓ`) = sigma, %);
eqn3:= algsubs(T/(k[t]*`ℓ`) = theta, %);

But none of these have worked. Does anyone know how to solve this?

Thanks in advance.

Hi all,

I have an differential equation in terms of the D-operator and am trying to convert it to diff form. Using convert/Diff works fine as long as partially evaluated functions don't appear in the equation. However, I can't figure out how to get the two to cooperate.

For instance, running

D[2](eta)(t,x)+D[2](phi)(t,x,0)+D[2](phi)(t,x,0):
convert(%, Diff);

returns

D[2](eta)(t,x) + Diff(phi(t,x,0),x)

Why is the eta term not converted to diff(eta(t,x),x)?

Thanks a lot!

In Maple 2018 help written:

The interpolation methods available in the Interpolation package all work as follows. First, the user calls one of the commands in the package, submitting the input points and the values at these points. This returns an object encapsulating all the data and options submitted. This object can then be used like a normal mathematical function, e.g. for plotting, integration, or just to evaluate at a given point.

The Interpolation[Interpolate] command was introduced in Maple 2018
 

My test example:

with(Interpolation):

points := [seq(x, x = 0 .. 10, 1)]; data := [seq(sqrt(1.+x^2), x = 0 .. 10, 1)];

f := Interpolate(points, data);

f(1); # OK works :).

int(f(x), x = 0 .. 1); # Not working ?

int(f(x), x = 0 .. 1,numeric); # Not working ?

eval(diff(f(x), x), x = 2);# Not working ?

plot(f(x), x = 0 .. 10);#  OK works :)

plot([f(x), diff(f(x), x)], x = 0 .. 10);# Not working ?

plot([f, diff(f, x)], 0 .. 10);# Only a half  working ?

 

Thanks.


 

 

I want ot replace the free variable introduced by the BackwardsSubstitution procedure with a number. But though the variable looks like x1 I think it must be something else.

problem.maple

Hi all,

I found some strange behavior while usings tensors from Physics; I wanted to make sure I wasn't missing something here.

It seems that changing the metric (for instance, to +++-) causes raising and lowering problems. As an example:

with(Physics):
Setup(metric=`+++-`):

# Define our system of equations
Coordinates(X):

# Define tensors
{U[~mu] = [u(X),0,0,1],
A[~mu]=[0,0,0,n(X)]}:
Define(op(%)):

F[mu,nu]=d_[mu](A[nu]) - d_[nu](A[mu]):
Define(%):

# Multiply tensors
TensorArray(F[~0,~mu].U[mu]);

This produces

-diff(n(X),x1)*u(X)-2*diff(n(X),x4)

However, only the first term should be present. It seems that changing the mulitplication to F[0,~mu].U[mu] produces the correct output, as does removing the Setup call. Also, manually defining F produces the expected output; only defining it via A seems to generate the discrepancy.

Any idea if this is a bug or a feature?

Thanks!

how i can write these boundary conditions for dsolve?

(diff(u(r), r))^(n-1)*(diff(r*(diff(u(r), r)), r))/r    be [finite] at r =0

and  u(0) = finite?

Thanks..

 

Hello!

I can't seem to figure out how to use the Physics package within a procedure. In particular, I can't get tensors to be recognized within the body of the proc.

As an example, here's a short program that works correctly when not in a procedure:

with(Physics):
Coordinates(X,quiet):
d_[mu](X[~mu]);
# Returns 4; Correct

However, placing this code inside a proc causes the tensor X to not be recognized as a tensor:

Test := proc()
  uses Physics:

  Coordinates(X,quiet):
  d_[mu](X[~mu]);
end proc:
Test();
# Returns 0; Wrong

Apparently, Physics:-Coordinates still defines the tensor X (as can be checked by calling Physics:-Define()). However, the derivative d_[mu] (X[~mu]) seems to be treating X as a standard symbol. Any idea how I would go about correcting this?

Thanks!


I have a procedure which works. ⊕(a,b) gives annwer.   a ⊕ b also gives answer. That was a surprise, discovered from a typing mistake. If b is negative is needs to be enclosed in delay evulation quotes.

2  questions 

Can anyoone expllain this useful property? Any way around having to use delay evaluation quotes for negative numbers?

restart

NULL

``

NULL

`⊕` := proc (a, b) (a+b)/(1-a*b) end proc

proc (a, b) (a+b)/(1-a*b) end proc

(1)

`⊕`(1, 2)

-3

(2)

`⊕`(1, 2)

-3

(3)

`⊕`(`⊕`(`⊕`(1, 2), '-5'), 4)

-32/9

(4)

``

`⊕`(1, 1/2)

3

(5)

`⊕`(1/2, '-1')

-1/3

(6)

"(=)"

-1/3

(7)

`⊕`(0, h)

h

(8)

`⊕`(h, 0)

h

(9)

`⊕`(1/h, '-h')

(1/2)/h-(1/2)*h

(10)

`⊕`(1/h, -h)

(1/2)/h-(1/2)*h

(11)

-`⊕`(h, 1/h^2)

-(h+1/h^2)/(1-1/h)

(12)

"(=)"

(-h^3-1)/(h*(h-1))

(13)

NULL


 

Download Circle_Sum.mw

On the maple cloud, I see that current version is 38 for Physics 

After I installed, I typed

Physics:-Version();

It gives 
  "......\maple\toolbox\2018\Physics Updates\lib\Physics Updates.maple", 2018, May 8, 17:49 hours

I was expecting to see "38".  Why does Physics:-Version(); does not give the version number as shown on Maple cloud? Using only a date for a version number is not a good idea. There should be a number there. (date can also be included, but a number should be the official version number).

Is there another command to use to obtain Version number "38"?

Does each package shown on cloud support packageName:-Version()? I tried this command on another package I have, but I got an error saying it does not Version() 

OrthogonalExpansions:-Version();
Error, Version is not a command in the OrthogonalExpansions package
 

Yet, on cloud, it says the version number is "1" for the above package. What does the version number shown on the cloud then really mean?

I have PDE i trying to solve the equation using series.

pdsolve(diff(u(x, y), x, x)+diff(u(x, y), y, y) = Pi, series, order = 2);

Give me: "Error, (in DifferentialAlgebra:-RosenfeldGroebner) unexpected occurrence of the non-rational constants {Pi} in the given input" ?

pdsolve(diff(u(x, y), x, x)+diff(u(x, y), y, y) =gamma, series, order = 2);#gamma = 0.5772156649,Gives ERROR ?

If I  change instead of Pi is e or exp(1) works fine.

pdsolve(diff(u(x, y), x, x)+diff(u(x, y), y, y) = exp(1), series, order = 2);#OK.

 

It's a bug, design or  something else ?

 

Error, (in dsolve/numeric/process_input) system must be entered as a set/list of expressions/equations
moadele_asli2.mw

First 56 57 58 59 60 61 Page 58 of 61