Maple 2020 Questions and Posts

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

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

 

I need to solve general linear programming problem with multi-precision support. What are my options with Maple 2020?

 

THE ISSUE: It's returning a list of [1] when it should be returning [1,1,1,7]

##Find remainder##
rm := proc(a, b) local n; n := 0; while 0 <= b - n*a do n := n + 1; end do; b - (n - 1)*a; end proc;
rm := proc (a, b) local n; n := 0; while 0 <= b-n*a do n := n+1 

   end do; b-(n-1)*a end proc


rm(8, 3657);
                               1

rm(16, 12345);
                               9

##FINDING THE WHOLE NUMBER PORTION ##
whole := proc(a, b) local r, i; r := 0; i := 0; if a < b then r := rm(a, b); i := (b - r)/a; else 0; end if; end proc;
whole := proc (a, b) local r, i; r := 0; i := 0; if a < b then 

   r := rm(a, b); i := (b-r)/a else 0 end if end proc


whole(8, 3657);
                              457

whole(16, 12345);
                              771

 


j = whole(8, 3657);
                            j = 457

k = rm(8, 3657);
                             k = 1

L := [];
                            L := []

L := [op(L), rm(8, 8657)];
                            L := [1]

j = whole(8, 457);
                             j = 57


##GETTING THE LIST OF DIGITS (BEFORE REVERSING)##
HELPER := proc(a, b, L) local j; j := whole(a, b); [op(L), rm(a, b)]; if 0 < j then HELPER(a, j, L); else ; end if; L; end proc;
HELPER := proc (a, b, L) local j; j := whole(a, b); [op(L), 

   rm(a, b)]; if 0 < j then HELPER(a, j, L) else  end if; L end 

   proc


CNS := proc(a, b) HELPER(a, b, L); end proc;
          CNS := proc (a, b) HELPER(a, b, L) end proc

 

CNS(8, 3657);
                              [1]

 

HELPER(8, 3657, L);
                              [1]

 

Hello

I wonder if someone on the list can give me some guidelines on how to use Grid:-Seq.

I have applied Grid:-Set and Grid:-Seq to one of my problems where parallelization is a possibility.   In this problem, I have a massive list of lists that needs to be processed in chunks and then a new list is returned.

What I've found so far:

1) Grid-Seq won't work if I use a procedure from a private module that calls local (or exported) functions of the same module.  Solution:  I need to use savelib (there is a bug in Grid:-Seq)

2) Grid-Seqs seems to be working fine up to a point where it simply stops.  For example:   Starting with 431895 sets, the procedure divides them into 864 sets of 500 elements (the last one does not usually contain 500 elements).  Then I use res:=Grid:-Seq['tasksize'=9](myFunction(newSets[i],...,....),i=1..864).   The messages sent out by Grid:-Seq are 

Seq: using tasksize=9; number of elements= 864, number of partitions = 96

......

Seq: done sending all partitions

Seq: received results from all nodes; collating results

After two hours running and using 36 cores, the result is available in res.  The next step is to use the results in res for another cycle of calculations.  1503462 sets = 3007 sets of 500 elements.  The messages sent out by Grid:Seq are 

Seq: using tasksize=9; number of elements= 3007, number of partitions = 335

......

Seq: done sending all partitions

The last message showed up on the screen after an hour. During the process, I saw the current tasks finishing and new ones starting.  However I could not see "Seq: received results from all nodes; collating result" after a day running.  I am using timelimit to be sure that all calculations will finish no matter what.  

I have checked the system information and found that: 1) all 72 cores are running but they are jumping from 0% to 100% (in the example that works I could see all of them in 100% solid), 2) Memory is at 156 GB (200 Gb is the limit) and no swap to disk.

I have also noticed:

  1. If I use Maple 2017, not even the first example works.
  2. tasksize=9 somehow helps with similar problems.  If the size is left for Maple to decide, it seems that the problem happens for sets of smaller size.
  3. On linux I had to use "kill -9" to remove maple from every single core. My impression is that Grid:-Seq does not clean up the processes after they finished.  
  4.  The problem seems to be on "results from all nodes; collating result".

 

I know that the explanation above in rather vague, but if someone has any clue or guidelines on how to solve this problem, please share it with me.

 

Many thanks

 

Ed

 

 

 

I think the Maple Physics package has the promise to revolutionize the teaching of physics. Two recent tutorials have been very helpful (“Vectors in Spherical coordinates using tensor notation” and “A Complete Guide for performing Tensors computations using Physics”).   Unfortunately, despite these, I still have problems even when trying to use it for simple things. No doubt this is primarily a sign of my limitations. However, in the hope that others might share this, I have the following question.

As an exercise, I would like to use the Maple Physics Tensor notation to derive the expression for acceleration in spherical coordinates – identifying Coriolis force, etc.  I can’t get past the first step – how to define the tensor dx/dt.   That is, how do I write the time derivative of the Maple space coordinates [X].  I assume that this can be done in about 3 steps, if someone would be kind enough to humor my ignorance. Thanks in advance.

I am trying to  find the funtion of this graph 

I tried
f := x -> a12*x^12 + a1*x^11 + a2*x^10 + a3*x^9 + a4*x^8 + a5*x^7 + a6*x^6 + a7*x^5 + a8*x^4 + a9*x^3 + a10*x^2 + a11*x + a13;
solve([f(-4) = 3, f(-3) = 1, f(-2) = 1, f(-1) = 1, f(0) = 0, f(1) = -1, f(3) = -5, f(4) = -5, f(5) = 1, eval(diff(f(x), x), x = -2.5) = 0, eval(diff(f(x), x), x = -1.5) = 0, eval(diff(f(x), x), x = 3.5) = 0, f(6) = 3], [a12, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a13]);

I got

[[a12 = 4.697405911*10^(-6), a1 = -0.00006250181861, a2 = -1.444112429*10^(-6), a3 = 0.002660698702, a4 = -0.004689494622, a5 = -0.04291772722, a6 = 0.08407481146, a7 = 0.3251529098, a8 = -0.4752692626, a9 = -1.066462933, a10 = 0.3958806924, a11 = -0.2183704462, a13 = 0.]]

plot(4.697405911*10^(-6)*x^12 - 0.00006250181861*x^11 - 1.444112429*10^(-6)*x^10 + 0.002660698702*x^9 - 0.004689494622*x^8 - 0.04291772722*x^7 + 0.08407481146*x^6 + 0.3251529098*x^5 - 0.4752692626*x^4 - 1.066462933*x^3 + 0.3958806924*x^2 - 0.2183704462*x, x = -4 .. 5)

It doesn't like the graph of the first picture. 

Since Maple comes with source code that one can display. Even though it is stripped of all comments, which makes it hard to follow sometimes, I was wondering if there are any tools to help one get the large picture of what is there without having to step and go through all the thousands and thousands of the help pages jumping from one to another and losing the path.

I am looking for something similar to the tree program one finds on Unix, but applied to Maple's logical package hierarchy.

Since Maple has thousands of packages and subpackages and some has sub subpackages and then thousands of commands below all these, such an automated tool will be useful.

For example, I could ask it to show me top level packages and subpackages only (and not show the names of all the functions below that). This will help one see what is out there at a glance. i.e. see the big picture.

Here is an example of tree command I found on the net. But instead of looking at directories, the maple one will look at logical package tree.

 

For example, I just made short example for the Student package now

 

But doing the above by hand for everything is not practical. The above is just partial view of one package, and there are hundreds others. 

It will be nice if there is a tool, where one can tell to show the Maple package tree and the level of details to show. This will help one learn Maple better also.

The output of such tool does not even have to graphical. It could plain text, something like this

 

Student
      LinearAlgebra
               Basis
               IntersectionBasis
               etc.....
      Calculus1
               ......
               ......
Physics
DataSets
.....

      
       

   

Alignment is done using tabs for example to help show the structure.

Any suggestions?

 

Taking the example below from the help page, showstat displays the content of a procedure. This is convenient when writing code. However, to perform copy & paste, I would like to get rid of the displayed line number. Is that possible?

f := proc(x) if x <= 2 then print(x); print(x^2) end if; print(-x); x^3 end proc:
showstat(f);

f := proc(x)
   1   if x <= 2 then
   2       print(x);
   3       print(x^2)
       end if;
   4   print(-x);
   5   x^3
end proc

 

The uploaded worksheet contains an apparently unsolvable ode.

Please see the text in the worksheet for a description of the problem.

Roller_coaster_loop.mw

Hi, 

I work for the University of Dundee as a packager for the staff and student desktops.

We have a licence for 2020 applied to our licance server, I only require the software.

Is your free version the full package that once it sees the licence server will unlock all the features do I need to download a specific version from yourselves,

Best regards

Colin 

Hello everyone! I'm pretty new to Maple and struggling with some basics.

 

I want to use a for-loop to print out the square numbers from 11 to 20. And the outputs should be presented within a list.

This is what I have so far:

|> for i from 11 to 20 do print(i^2) od;


                              121

                              144

                              169

                              196

                              225

                              256

                              289

                              324

                              361

                              400

But I don't know how I can put all these results in a list, so that in the end it looks like this:

L: = [121,144,169,196,225,256,289,324,361,400]

 

I'm grateful for every answer :)

 

 

With Maple 2020, I have been experiencing some odd behavior of simple 2D plots. For example, I plotted two functions on the same graph, and the default view did not contain the full upper or lower limits of both functions. (Sorry, I chose to move on and so I am unable to reproduce this outcome – but it has happened more than once.)  

Now I am experiencing another limited view of a plot, this time a single function. In creating a simple example of the SIR model, I have dsolve output a list of procedures so that I can plot them as functions. But when I plot one of the functions, it does not plot the entire function from the lower to the upper limit. Am I alone in experiencing this outcome? Is there something I am doing wrong that is causing this behavior?

 

restart; plots:-setoptions(size = [300, 300])

s_eq := diff(s(t), t) = -ir*i(t)*s(t); i_eq := diff(i(t), t) = ir*i(t)*s(t)-rr*i(t); d_eq := diff(d(t), t) = dr*i(t); ics := s(0) = s0, i(0) = i0, d(0) = 0

"i0:=1.E3:    P0:=3.E8:    drate:=0.02:     s0:=0.6*P0:    ir:=(0.1)/(s0):   rr:=1/(30.):  dr:=rr*drate:   "

sol := dsolve({d_eq, i_eq, ics, s_eq}, numeric); tf := 120; plots:-odeplot(sol, [t, d(t)], 0 .. tf)

 

sol := dsolve({d_eq, i_eq, ics, s_eq}, numeric, output = listprocedure); i := eval(i(t), sol); s := eval(s(t), sol); d := eval(d(t), sol)

tf; plot(d(t), t = 0 .. tf)

120

 

 

plot(d(t), t = 0 .. tf, view = [0 .. 150, 0 .. 40000])

 

``


 

Download plot_view_problem.mw

 

When I use something like plots[display](Array([p1,p2]));  And the plots p1,p2 have been resized before to be small, there is lots of wasted empty space in the final result. I have to manually adjust the size of each Array entry with the mouse to make the fit better. But this solution is not practical. 

Is there an option to do this automatically? Here is an example

restart;

p1:=plot(sin(x), x=-Pi..Pi, size=[300,300]):
p2:=plot(cos(x), x=-Pi..Pi, size=[300,300]):
plots[display](Array([p1,p2]));   #one option
plots[display](Vector[row]([p1,p2])); #another option

Manually, using the mouse, I can, after some adjustments and trrial and errors, get the final result such that the wasted space is removed.

I am asking, becuase if I want to save/export the above final plot as PDF to include in a Latex document, it will look bad with that wasted space there.

How to do this adjustment using code?

In Mathematica for example, this is done using Grid and the Spacing option. I could not find something similar in Maple but I could have overlooked it.

 

 

First 45 46 47 48 49 50 Page 47 of 50