Maple 2020 Questions and Posts

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

Recently Maple started freezing on me for a few minutes; after that it continues to work and then freezes again and so on (it does not so much freezes as it pauses).  I do not know what changed on my system (which is Windows 10) for this to happen.  I had been using Maple 2019 when this started and then upgraded to Maple 2020 but that did not solve my problem.

It does not seem to have to do with the type of computations I am doing.

I have problem with usage of solve for the solution of the system of six and eight symbolic equations. I need to get expressions for variables: R__xl, R__xs, R__xsi, R__zl, R__zs, R__zsi, dbeta__l(t), dbeta__s(t). I tried to find solution for 8 equations, but I got the message: Warning, solutions may have been lost. I thought that the system is non-linear and tried to solve it for six variables (R__xl, R__xs, R__zl, R__zs, R__zsi, R__xsi), in this case equations are linear, but Maple ignored the solve command and did not give a solution or error. Could someone help me with this problem?

Quasi-static.mw

Hello

I am not sure how to choose between Threads:-Seq and Grid:-Seq.  

The problem:  a procedure, proc1, that calls two other procedures, proc2 and proc3, verifies if a set of parameters fulfills a certain condition. Proc1, proc2 and proc3 are not part of Maple available functions.  

Right now I am using Grid:-Seq to return the result of applying proc1 to chunks of a thousand parameters.  I wonder whether I could use Thread:-Seq instead.   What are the advantages of using one instead of the other?  And when do I choose one over the other?  

 

I would appreciate if you could provide simple examples to explain the differences.  

 

Many thanks.

 

Ed

PS.  There is a problem with Grid:-Seq as reported in one of my previous questions.

I have load the new Physics-Version 678, but it is not active. How can I do this?

Here the output:

                            restart

                           version()

 User Interface: 1455132
         Kernel: 1455132
        Library: 1455132
       MapleIDE: 928330

                            1455132

                      interface(version)

Standard Worksheet Interface, Maple 2020.0, Windows 10, March 4

   2020 Build ID 1455132


                      kernelopts(version)

   Maple 2020.0, X86 64 WINDOWS, Mar 4 2020, Build ID 1455132

                       Physics:-Version()

The "Physics Updates" version in the MapleCloud is 678 and is

   the same as the version installed in this computer, created

   2020, May 20, 10:21 hours, found in the directory

   C:\Users\wgellien\maple\toolbox\Physics Updates\lib\

 


                            restart

                     Physics:-Version(678)

Warning, this package updates content shipped in a standard Maple install.  Use the 'restart' command to clear your session before using these commands.
Kernel(The "Physics Updates" version "678" is installed but is

   not active. The active version of Physics is within the

   library C:\Users\wgellien\maple\toolbox/Physics Updates/lib\P\

  hysics Updates.maple, created 2020, May 20, 14:46 hours),

  [The "Physics Updates" version "678" is installed but is not

   active. The active version of Physics is within the library

   C:\Users\wgellien\maple\toolbox/Physics Updates/lib\Physics

   Updates.maple, created 2020, May 20, 14:46 hours]

 


With kind regards

Wolfgang Gellien

Beware!

In Maple 2019 we get the strange value

cos((Pi/2) -1e-12);
                                                  -10
                       -2.051033808 10   

 



In Maple 2020 we get the correct answer

cos(Pi/2-1e-12);
                                                                      -13
                9.999999999996916397514419 10   

That error in Maple 2019 certainly messed up quite a few of my calcualtions!

 

 

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.

 

Hi, I'm on Maple 2020 on Mac, and running this:

Captura-de-Pantalla-2020-05-16-a-la-s-23-14-57" />

In fact, that isn't the Chromatic number of that graph. Is not possible to color that graph with 2 colors becuase C7 (Cycle with 7 vertex) is a subgraph which is imposible to color with 2 colors. Am I doing something wrong? Can you replicate this? Is this a bug or is me?

Thanks

 

Maple formerly accepted

rule1 := forall(string(y), TD(y) = D(y)):

but now that statement prodices an error message:

Error, (in forall) expecting bound variable(s) to be a name or list of unique names


The entire value of this forall structure is that it should apply to objects of specific types, but it is not obvious how to express those types; the Help page for 'forall' is essentially useless in relation to this question. 

 

Any help why this code fail

restart;
PDE := diff(u(x,y), y$2 ) + diff(u(x,y), x$2) = 0;
BC:= u(x,0)=0, u(x,100)=100, u(0,y)=0, u(10,y)=0;
sol:=pdsolve([PDE,BC],numeric);

gives

Error, (in pdsolve/numeric/process_PDEs) PDEs can only contain dependent variables with direct dependence on the independent variables of the problem, got {u(0, y), u(10, y), u(x, 0), u(x, 100)}
 

But sol:=pdsolve([PDE,BC])  works OK and gives analytical solution.

What error Am I doing in the above code in this case?

Maple 2020 with Physics 642

I'd like to find chromatic number of some graphs. But I find a strange thing of function ChromaticNumber. 

with(GraphTheory):
g1:=Graph(4):
DrawGraph(g1);
ChromaticNumber(g1)

It is Ok!

But when I use following codes, an error will be issued.

with(GraphTheory):
graphsof4 := [NonIsomorphicGraphs(4, output = graphs, outputform = graph)]:
DrawGraph(graphsof4[1]);
ChromaticNumber(graphsof4[1]);

 

 

 

 

 

I try to take a partial derivative of compound expressions. Usage of diff, Diff, substitution variables instead of time-variant variables (subs) couldn't help me.

restart; PDEtools[declare](`θ__l`(t), `β__l`(t), `θ__si`(t), `β__si`(t), psi(t), x(t), z(t)); PDEtools[declare](prime = t); V__1lx := diff(x(t), t)-(1/2)*l__b*sin(psi(t))*(diff(psi(t), t))-l__1c*sin(`θ__l`(t)-psi(t))*(diff(`θ__l`(t), t)-(diff(psi(t), t))); V__1lz := diff(z(t), t)-(1/2)*l__b*cos(psi(t))*(diff(psi(t), t))-l__1c*cos(`θ__l`(t)-psi(t))*(diff(`θ__l`(t), t)-(diff(psi(t), t))); V__1l := simplify(V__1lx^2+V__1lz^2, size); diff(V__1l, psi); Diff(V__1l, psi)

Diff((diff(x(t), t)-(1/2)*l__b*sin(psi(t))*(diff(psi(t), t))+l__1c*sin(-theta__l(t)+psi(t))*(diff(theta__l(t), t)-(diff(psi(t), t))))^2+(diff(z(t), t)-(1/2)*l__b*cos(psi(t))*(diff(psi(t), t))-l__1c*cos(-theta__l(t)+psi(t))*(diff(theta__l(t), t)-(diff(psi(t), t))))^2, psi)

(1)

``


Download DiffExpr.mw

Should I use implicitdiff? If yes, how does it work?

Also, I don't understand, why the derivative of theta_l is displayed so strange, as if the derivative is taken from the index l?

P.S. This question is a continuation of my last topic: https://www.mapleprimes.com/questions/229551-Operations-On-Several-Defined-Functions

Since we are getting many questions on how to create Math apps to add to the Maple Cloud. I wanted to go over the different GUI aspects of how you go about creating a Math App in Maple. The following Document also includes some code examples that are used in the the Math App but doesn't go into them in detail. For more details on the type of coding you do in a Math App see the DocumentTools package help page.

Some of the graphical features of the Math app don't display on Maple Primes so I'd recommend downloading this worksheet from here: HowToMathApp.mw to follow along.


 

NULL

How to make a Math App (An example of using the Document Tools).

 

This Document will provide a beginners guide on one way to make a Math app in Maple.

It will contain some coding examples as well as where to find different options in the user interface.

Step 1 Insert a Table

 

 

• 

When making a Math App in Maple I often start with a table. You can enter a table by going to Insert > Table...

  

 

• 

I often make the table 1 x 2 to start with as this gives an area for input and an area for the output (such as plots).

NULL

 

Add a plot component to one of the cells of the table

 

 

• 

From the Components  Palette you can add a Plot Component . Add it to the table by clicking and dragging it over.

 

 

NULL

NULL

Add another table inside the other cell

 

 

• 

In the other cell of the table I'll add another table to organize my use of buttons, sliders, and other components.
NULL

NULL

Add some components to the new table

 

 

• 

From the Components Palette I'll add a slider, or dial, or something else for interaction.

 

• 

You may also want a Math region for an area to enter functions and a button to tell Maple to do something with it.

 

NULL

NULL

Arrange the Components to look nice

 

 

• 

You can change how the components are placed either by resizing the tables or changing the text orientation of the contents of the cells.

 

NULL

Write some code for the interaction of the buttons.

 

 

• 

Using the DocumentTools  package there are lots of ways you can use the components. I often will start writing my code using a code edit region  as it provides better visualization for syntax. On MaplePrimes these display as collapsed so I will also include code blocks for the code.

 

NULL

NULL

Let's write something that takes the value of the slider and applies it to the dial

 

 

• 

Note that the names of the components will change in each section as they are copies of the previous section.

 

with(DocumentTools):

14

with(DocumentTools):
sv:=GetProperty('Slider2',value);
SetProperty('Dial2',value,sv);
• 

This code will only execute when run using the  button. Change the value of the slider below then run the code above to see what happens.

 

NULL

NULL

Move the code 'inside' the slider

 

 

• 

Instead of putting the code inside the code edit region where it needs to be executed, we'll next add the code to the value changed code of the slider.

 

• 

Right click the Slider then select "Edit Value Changed Code".

 

 

• 

This will open the code editor for the Slider

 

 

• 

Enter your code (ensuring you're using the correct name for the slider and dial).

 

• 

Notice that you don't need to use the with(DocumentTools): command as "use DocumentTools in ... end use;" is already filled in for you.

 

• 

Save the code in the Slider and hit the  button inside it once.

• 

Now move the slider.

 

• 

On future uses of the App you won't need to hit  as the code will be run on startup.

``

NULL

NULL

Add some more details to your App

 

 

• 

Let's make this app do something a bit more interesting than change the contents of a dial when a slider moves.

 

• 

The plan in the next few steps is to make this app allow a user to explore parameters changing in a sinusoidal expression.

 

• 

I'm going to add a second Math Component, put the expression A*sin(t*theta+phi)into both then uncheck the box in the context panel that says "Editable".

 

• 

To make the Math containers fit nicely I'll check the Auto-fit container box and set the Minimum Width Pixels to 200.

 

``

Add code to change the value of phi in the second Math Container when the Slider changes

 

 

Note: Maple uses Radians for trigonometric functions so we should convert the value of phi to Radians.

use DocumentTools in

 

use DocumentTools in 
phi_s:=GetProperty(Slider5,value);
expr:= GetProperty(MathContainer6,expression);
new_expr:=algsubs(phi=phi_s*Pi/180,expr);

SetProperty(MathContainer7,expression,new_expr);
end use:

``

``

Make the Dial go from 0 to 360°

 

 

• 

Click the Dial and look at the options in the context panel on the right.

 

• 

Update the values in the Dial so that the highest position is 360 and the spacing makes sense for the app.

  NULL

``

Have the Dial update the theta value of the expression

 

 

• 

Add the following code to the Dial

 

use DocumentTools in
use DocumentTools in 
theta_d:=GetProperty(Dial7,value);
phi_s:=GetProperty(Slider7,value); #This is added so that phi also has the value updated

expr:= GetProperty(MathContainer10,expression);
new_expr0:=algsubs(theta=theta_d*Pi/180,expr);
new_expr:=algsubs(phi=phi_s*Pi/180,new_expr0);  #This is added so that phi also has the value updated

SetProperty(MathContainer11,expression,new_expr);
end use:

 

• 

Update the value in the slider to include the value from the dial

 

use DocumentTools in

 

use DocumentTools in 

theta_d:=GetProperty(Dial7,value); #This is added so that theta also has the value updated
phi_s:=GetProperty(Slider7,value); 

expr:= GetProperty(MathContainer10,expression);
new_expr0:=algsubs(theta=theta_d*Pi/180,expr); #This is added so that theta also has the value updated
new_expr:=algsubs(phi=phi_s*Pi/180,new_expr0);  

SetProperty(MathContainer11,expression,new_expr);

end use:

 

``

``

Notice that the code in the Dial and Slider are the same

 

 

• 

Since the code in the Dial and Slider are the same it makes sense to put the code into a procedure that can be called from multiple places.

 

Note: The changes in the code such as local and the single quotes are not needed but make the code easier to read and less likely to run into errors if edited in the future (for example if you create a variable called dial8 it won't interfere now that the names are in quotes).

 

 

UpdateMath:=proc() 

UpdateMath:=proc()
local theta_d, phi_s, expr, new_expr, new_expr0;
use DocumentTools in 
theta_d:=GetProperty('Dial8','value'); #Get value of theta from Dial
phi_s:=GetProperty('Slider8','value'); #Get value of phi from slider

expr:= GetProperty('MathContainer12','expression');
new_expr0:=algsubs('theta'=theta_d*Pi/180,expr);  # Put value of theta in expression
new_expr:=algsubs('phi'=phi_s*Pi/180,new_expr0);  # Put value of phi in expression
SetProperty('MathContainer13','expression',new_expr); # Update expression
end use:
end proc:

 

• 

Now change the code in the components to call the function using UpdateMath().

 

• 

Since the code above is only defined there it will need to be run once (but only once) before moving the components. Instead of leaving it here you can add it to the Startup code by clicking  or going to Edit > Startup code.  This code will run every time you open the Math App ensuring that it works right away.

 

• 

The startup code isn't defined in this document to allow progression of these steps.

 

``

Make the button initialize the app

 

 

• 

Since the startup code isn't defined in this document we are going to move this function into the button.

 

UpdateMath:=proc()

 

UpdateMath:=proc()
local theta_d, phi_s, expr, new_expr, new_expr0;
use DocumentTools in 
theta_d:=GetProperty('Dial9','value'); #Get value of theta from Dial
phi_s:=GetProperty('Slider9','value'); #Get value of phi from slider

expr:= GetProperty('MathContainer14','expression');
new_expr0:=algsubs('theta'=theta_d*Pi/180,expr);  # Put value of theta in expression
new_expr:=algsubs('phi'=phi_s*Pi/180,new_expr0);  # Put value of phi in expression
SetProperty('MathContainer15','expression',new_expr); # Update expression
end use:
end proc:
• 

First click the button to rename it, you'll see the  option in the context panel on the right. Then add the code above to the button in the same way as the Slider an Dial (Right click and select Edit Click Code).

 

``

``

Now it is easy to add new components

 

 

• 

Now if we want to add new components we just have to change the one procedure.  Let's add a Volume Gauge to change the value of A.

 

• 

Click in the cell containing the Dial, the context panel will show the option to Insert a row below the Dial.

• 

Now drag a Volume Gauge into the new cell.

 

• 

Click in the cell and choose the alignment (from the context panel) that looks best to you. In this case I chose center:

 

``

 

NULL

``

Update the procedure code for the Gauge

 

 

• 

Add two lines for the volume gauge to get the value and sub it into the expression

UpdateMath:=proc()

UpdateMath:=proc()
local theta_d, phi_s, expr, new_expr, new_expr0;
use DocumentTools in 
theta_d:=GetProperty('Dial11','value'); #Get value of theta from the Dial
phi_s:=GetProperty('Slider11','value'); #Get value of phi from the Slider
A_g:=GetProperty('VolumeGauge1','value'); #Get value of A from the Guage

expr:= GetProperty('MathContainer18','expression');
new_expr0:=algsubs('theta'=theta_d*Pi/180,expr);  # Put value of theta in expression
new_expr1:=algsubs('phi'=phi_s*Pi/180,new_expr0);  # Put value of phi in expression
new_expr:=algsubs('A'=A_g,new_expr1);  # Put value of A in expression

SetProperty('MathContainer19','expression',new_expr); # Update expression
end use:
end proc:
• 

Now add

UpdateMath();

  to the Gauge.

  ``

``

Plot the changing expression

 

 

• 

Make a procedure to get the value in the second Math Container and plot it

 

PlotMath:=proc()

PlotMath:=proc()
	local expr, p;
	use DocumentTools in 

	expr:=GetProperty('MathContainer21','expression'); 

	p:=plot(expr,'t'=-Pi/2..Pi/2,'view'=[-Pi/2..Pi/2,-100..100]):

	SetProperty('Plot14','value',p)
	end use:
end proc:
• 

Put this procedure in the Initialize button and the call to it in the components.

 

NULL

``

Tidy up the app

 

 

• 

Now that we have an interactive app let's tidy it up a bit.

 

• 

The first thing I'd recommend in your own app is moving the code from the initialize button to startup code. In this document we choose to use the button instead to preserve earlier versions.

 

• 

You can also remove the borders around the components by clicking in the table and selecting "Interior Borders" > "None" and "Exterior Borders" > "None" from the context panel.

NULL

``

``

Now you have a Math App

 

 

• 

You can upload your Math App to the Maple Cloud to share with others by going to "File" > "Save to Cloud".

 

• 

I'd recommend also including a description of what your app does. You can do this nicely using another table and Text mode.

 

 

 

``

``

NULL

HowToMathApp.mw

How I can determine the trace of the matrix.

My answer has a lot of differences comparing the result provided in the pdf file (end of the file).

Also, I think we should use from  EQ(4).

what is the problem?

Please help me..

Best

Doc2.pdf

1111.mw


 

restart; x__2 := beta*gamma+2*beta+delta*gamma+delta-alpha-sqrt(alpha^2-2*alpha*(beta*gamma+delta*gamma+2*beta+delta)+(beta*gamma+delta*gamma+delta)^2)/(2*(beta+delta))

y__2 := 1-x__2

J := Matrix([[1-2*x__2-y__2, -x__2], [beta*y__2^2/x__2^2, delta-2*beta*y__2/x__2-alpha*gamma/(gamma+y__2)^2]])

 

 

                            

and y__2*(delta-beta*y__2/x__2)-alpha*y__2/(gamma+y__2) = 0``

Error, reserved word `and` unexpected

 
  NULL

 

 

NULL

TTR := Trace(J)

TTR := 1-2*x__2-y__2+delta-2*beta*y__2/x__2-alpha*gamma/(gamma+y__2)^2

-beta*gamma-2*beta-delta*gamma+alpha+(alpha^2-2*alpha*(beta*gamma+delta*gamma+2*beta+delta)+(beta*gamma+delta*gamma+delta)^2)^(1/2)/(2*beta+2*delta)-2*beta*(1-beta*gamma-2*beta-delta*gamma-delta+alpha+(alpha^2-2*alpha*(beta*gamma+delta*gamma+2*beta+delta)+(beta*gamma+delta*gamma+delta)^2)^(1/2)/(2*beta+2*delta))/(beta*gamma+2*beta+delta*gamma+delta-alpha-(alpha^2-2*alpha*(beta*gamma+delta*gamma+2*beta+delta)+(beta*gamma+delta*gamma+delta)^2)^(1/2)/(2*beta+2*delta))-alpha*gamma/(gamma+1-beta*gamma-2*beta-delta*gamma-delta+alpha+(alpha^2-2*alpha*(beta*gamma+delta*gamma+2*beta+delta)+(beta*gamma+delta*gamma+delta)^2)^(1/2)/(2*beta+2*delta))^2

(1)

s := diff(TTR, alpha)

1+(1/2)*(-2*beta*gamma-2*delta*gamma+2*alpha-4*beta-2*delta)/((alpha^2-2*alpha*(beta*gamma+delta*gamma+2*beta+delta)+(beta*gamma+delta*gamma+delta)^2)^(1/2)*(2*beta+2*delta))-2*beta*(1+(1/2)*(-2*beta*gamma-2*delta*gamma+2*alpha-4*beta-2*delta)/((alpha^2-2*alpha*(beta*gamma+delta*gamma+2*beta+delta)+(beta*gamma+delta*gamma+delta)^2)^(1/2)*(2*beta+2*delta)))/(beta*gamma+2*beta+delta*gamma+delta-alpha-(alpha^2-2*alpha*(beta*gamma+delta*gamma+2*beta+delta)+(beta*gamma+delta*gamma+delta)^2)^(1/2)/(2*beta+2*delta))+2*beta*(1-beta*gamma-2*beta-delta*gamma-delta+alpha+(alpha^2-2*alpha*(beta*gamma+delta*gamma+2*beta+delta)+(beta*gamma+delta*gamma+delta)^2)^(1/2)/(2*beta+2*delta))*(-1-(1/2)*(-2*beta*gamma-2*delta*gamma+2*alpha-4*beta-2*delta)/((alpha^2-2*alpha*(beta*gamma+delta*gamma+2*beta+delta)+(beta*gamma+delta*gamma+delta)^2)^(1/2)*(2*beta+2*delta)))/(beta*gamma+2*beta+delta*gamma+delta-alpha-(alpha^2-2*alpha*(beta*gamma+delta*gamma+2*beta+delta)+(beta*gamma+delta*gamma+delta)^2)^(1/2)/(2*beta+2*delta))^2-gamma/(gamma+1-beta*gamma-2*beta-delta*gamma-delta+alpha+(alpha^2-2*alpha*(beta*gamma+delta*gamma+2*beta+delta)+(beta*gamma+delta*gamma+delta)^2)^(1/2)/(2*beta+2*delta))^2+2*alpha*gamma*(1+(1/2)*(-2*beta*gamma-2*delta*gamma+2*alpha-4*beta-2*delta)/((alpha^2-2*alpha*(beta*gamma+delta*gamma+2*beta+delta)+(beta*gamma+delta*gamma+delta)^2)^(1/2)*(2*beta+2*delta)))/(gamma+1-beta*gamma-2*beta-delta*gamma-delta+alpha+(alpha^2-2*alpha*(beta*gamma+delta*gamma+2*beta+delta)+(beta*gamma+delta*gamma+delta)^2)^(1/2)/(2*beta+2*delta))^3

(2)

NULL

NULL


 

Download 1111.mw

The help for option threadsafe (on page ?option) includes this sentence: 

  • Portions of the kernel may recognize this option and allow the procedure to be called in multiple threads simultaneously.

Huh? What exactly does that mean? Isn't it already capable of being called in multiple threads simultaneously?

I understand the significance of this option for procedures to be compiled, mentioned later in the same paragraph. But is there any benefit for a non-compiled procedure that will be used in multithreaded code? If my code has numerous one-liner arrow procedures, is there any point to cluttering up my code by turning them all into procs with option threadsafe? (Y'all know how I hate cluttered code.)

 

Friends, as above in the picture,I want T to differentiate diff(x,t),taken diff(x,t) as a variable.

The answer is m*diff(x,t)+m__1/2 

Is there any way to do that? Substitute diff(x,t) with another variable and then substitute back isn't convenient.

differential_question.mw

First 49 50 51 52 53 54 55 Page 51 of 55