Maple 2019 Questions and Posts

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

I am trying to get jacobian computed for lorenz equations, not showing matrix, using Maple 2019 newest version. any guidance?

 

 

 

 

Hi everybody!

 

Quick question for you guys. I have access to Maple 2019 on my main computer and Maple 2018 on a remote Desktop (but I don't want to use because it's super slow and bad (normal rdp stuff)). The problem I have is for the same document, same line, same instruction, Maple 2019 on my computer is failling to do it correctly (unable to do the matrix correctly) and in the Remote Maple 2018 it's doing it just fine. I really don't understand. If someone can give me a little help it would be highly apreciated!

 

Maple 2018 (what it's supposed to do):

 

Maple 2019 (what it is not suppose to do):

restart;

with(DifferentialGeometry);
with(Tensor);

DGsetup([x, t], M1);

g := evalDG((dt &t dt) - t^2*(dx &t dx))
Geodesics()

 

I created a two dimensional cross-section of a spacetime described by this metric above. 

I would like to plot the geodesics in polar coordinates using the time t as the radius (normalized to our current time equal to unity).

That is, I would like to plot the geodesics starting at x=0, t=1 (x=0 maps to the top of the polar plot). X is the polar angle.

This plot is likely to map to this figure. Never mind the details of wiggles, or titles, etc.  I am new to maple and could use an initial push.

Glyph2.maple

The above link is a maple workbook containing the package Glyph2 together with the install script and two worksheets illustrating the difficulty I am having with the code in the procedure assignaltbasis (near the end of the code in Glyph2.mpl).

The problematic code is shown standalone is basisdemo worksheet, but reproduced below for reference. Interestingly, even though the table should be evaluated in a seq command, outside the module it works without eval. Inside the module evaluation does not make any difference.

indxs := [1, 2, 3, 4];
altbasis := [seq(seq(e[i[]], i = combinat:-choose(indxs, 2*k)), k = 1 .. 2)];
gen := table([seq(op(gen[i]) = bivec[i], i = 1 .. nops(gen))]);
exprs := [seq(exteriorp(seq(gen[op(2*i - 1 .. 2*i, b)], i = 1 .. nops(b)/2)), b = altbasis)];

The worksheet Basischangedemo shows how the exported procedure “assignaltbasis” is used in the module and the error that results if a bivector basis is used. From experimentation I have found that the error results because “assignaltbasis” passes the table name to the procedure “exteriorp” instead of the bivectors that should have resulted from evaluation of the table. Including the eval command within the seq procedure does not make any difference to the result. I am unclear whether this is a problem with evaluation of the table or a problem that results from namespace conflict.

I have a further namespace problem with the local variables, AltRoot, AltToStd, and StdToAlt which store the results from assignaltbasis.  If I declare these variables as exports, I get an error message “attempt to assign to a protected variable”. Therefore I added an exported procedure “ShowAltBasis” to display the results.  As you can see, this procedure produces the fully-qualified names of each blade making the result difficult to read. I would prefer to get rid of the “Glyph2:-” qualification.

The waters are muddied even further because the other worksheet, “basisdemo”, contains the core code extracted from assignaltbasis showing that the code using the table actually works (outside the module). From this I conclude that a namespace conflict exists within the module, preventing the table from fully evaluating.

My understanding is that within the module local and exported names are more or less equivalent, so I am puzzled why local and exported names in assignaltbasis are so problematic.

I would appreciate any advice about these issues. Clearly my understanding of maple’s namespaces is incomplete.

We often use the vector notation "< >" as in <x, y, z>.  However, when I use it with a function, it does not evaluate the same way as a simple list "[ , ]". 
 

"restart;  g(r):=k*r;"

proc (r) options operator, arrow, function_assign; k*r end proc

(1)

g1 := g([x, y]); g2 := g(`<,>`(x, y))

g1 := k*[x, y]

 

Vector[column](%id = 18446745825756564886)

(2)

k := 1; g1; g2

k := 1

 

[x, y]

 

Vector[column](%id = 18446745825756564886)

(3)

 

The value of k is not applied in g2.  Can someone point me in the direction as to the difference between the two types of entities as interpreted by Maple?  

Download HowToDefineTensorRankZero.mw

Using the latest Physics package, I try define a tensor of rank zero, but an error accurs:

> Define(Theta = varepsilon[mu, ~mu](X));
Error, (in Physics:-Define) expected left-hand-side of tensor definition as a tensor with non-numerical indices, received: Theta

The same error occurs when I try:
> Define(Theta[] = varepsilon[mu, ~mu](X));
Error, (in Physics:-Define) expected left-hand-side of tensor definition as a tensor with non-numerical indices, received: Theta[]

So my question is: how can I define a tensor of rank zero? 
Hope someone can help me out. 

Regards, Wouter

Fyi, this solution to 1D wave pde is wrong. The solution does not even satisfy the PDE itself. Compared it to a numerical solution and they are not the same solution. Do not have time now to write the hand solution. But it is clear the solution is not valid.

I do not know now how to roll back to earlier version of the Physcis packages to see if this used to work OK before. Since when typing Physics:-Version(420) It gives error

Error, (in Physics:-Version) unable to determine the Physics Updates version, could you please report the problem to support@maplesoft.com

And Physics:-Version(425) seems to hang. I am not sure if these commands are supposed to automatically download the physics package from the cloud and install it on my PC or what.

Any way, could someone please verify the solution they get is the same as shown below? May be someone with earlier physics package could try to see if they get different solution?

restart

Physics:-Version()

`The "Physics Updates" version in the MapleCloud is 429 and is the same as the version installed in this computer, created 2019, September 23, 0:14 hours, found in the directory C:\Users\me\maple\toolbox\2019\Physics Updates\lib\`

pde:=diff(u(x,t),t$2)=4*diff(u(x,t),x$2);
ic:=u(x,0)=0,D[2](u)(x,0)=sin(x)^2;
bc:=u(-Pi,t)=0,u(Pi,t)=0;
sol:=pdsolve([pde,ic,bc],u(x,t))

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

u(x, 0) = 0, (D[2](u))(x, 0) = sin(x)^2

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

u(x, t) = t*sin(x)^2

pdetest(sol,pde)

-8*t*(2*cos(x)^2-1)

simplify(diff(rhs(sol),t$2)-4*diff(rhs(sol),x$2))

-16*t*cos(x)^2+8*t

 


 

Download sept_23_2019.mw

I'm trying to debug a problem with define_external, and I would love some help!

I have a Maple module that contains this line of Maple code:

EigValsVecsC := define_external('EigValsVecsC', LIB = cat(dll_home,"\\operators.dll"), 'm'::ARRAY(datatype=float[8]), 'n'::integer[4], 'eig_vals'::ARRAY(datatype=float[8]), 'eig_vecs'::ARRAY(datatype=float[8]), 'THREAD_SAFE');

Running the Maple code to create the module produces this error message:

"Error, (in ModuleLoad) external linking: error loading external library C:\Users\zander\maple\toolbox\EigLib\misc\operators.dll: The specified procedure could not be found."

I've discovered that there's a single line of C++ code (in the C++ function EigValsVecsC) that I can comment out to make the problem go away.  Here's the line of C++ code:

MKL_INT info = LAPACKE_dsyev(LAPACK_ROW_MAJOR, 'V', 'U', eig_vecs.rows(), eig_vecs.raw(), eig_vecs.rows(), eig_vals.raw());

To clarify:

  • C++ compilation succeeds for operators.dll (which contains the function EigValsVecsC), with this one line either commented or uncommented.
  • The C++ function EigValsVecsC works correctly when not called from Maple (i.e., called from Visual Studio or the command line), with this one line either commented or uncommented.  (Of course, it doesn't work fully correctly with this one line commented, since this one line is the whole point of the function.  But it runs successfully and does the correct massaging of inputs.)
  • When this one line of C++ code is commented, the Maple module builds successfully, and I can call EigValsVecsC in Maple and get results back showing that, in the C++ code, the inputs to the commented line are being set up properly.

The relevant include statement in the C++ code is:

#include "mkl_lapacke.h"

I don't have to comment out the include statement (though the compiler may well be ignoring it if it's never used, when the call to LAPACKE_dsyev is commented out).

I have no good theories about what the problem may be.  I've been trolling the Web for any helpful information, and I've come up with nothing.

Can anyone help?  Thanks!

 

with(inttrans)

eq1 := 2*(diff(y__1(t), t)) = -2*y__1(t)-3*y__2(t)+2*u__1

eq2 := diff(y__2(t), t) = 4*y__1(t)-6*y__2(t)+2*u__1+4*u__2

help("laplace")

We have two coupled differential equations relating two outputs (y__1, y__2 ) with two inputs u__1, u__2

The objective of the exercise is to obtain the four transfer functions relating the outputs to the inputs, in other words, we must find:

To save time, we will from now on write Y__1 instead of Y__1(s) , etc.

In order to find tese relations, we must solve Y__1 and Y__2 as a function of U__1 and U__2

Since our model is defined in the time-domain, the first step is to perform Laplace Transform:

Note tha y__1(0) and y__2(0)are zero because y__1 and y__2 are deviation variables, as indicated in the problem description of this exercise.

Now we have a set of two equations with two unknowns, which can be solved algebraically
(this is the advantage of the Laplace Transform). For example, from equation (3) we can
isolate Y__2:

We can substitute the expression (5) in equation (4) to obtain Y__1, as follows:

We can multiply both sides by -3 and expand the products to get:

Now we must group the factors multiplying Y__1, U__1 and U__2

Note that this relation is analogous to:

Y__1 = G__11*U__1+G__12*U__2

Since the effects of `U__1 ` and U__2 are additive, if we want to obtain the relation between one output and only one input ( for example Y__1 and "`U__1`)" we can set the other input to zero, i.e. U__2 = 0.

We still have to obtan the relation between Y__2 and the inputs. We can use equation (5) and (6):

Finally we can find the relations:

 



 

Download Transfer_function.mw

 

Hello

I have this problem:

in which I have to find the four transfer functions relating the outputs(yand y2) to the inputs (u1,u2).

The u and y are deviation variables. 

The objective is to find the four transfer functions:

So I have done it by hand but I was wondering if there are any maple commands, that could be used to solve such a question?

 

I found the transfer functions to be:

I have a vector calculus question. I was given three points, p,q, and r, and I got Maple to calculate vectors pq and pr. I also got Maple to calculate the cross product vector, pq x pr. The problem says to draw the triangle formed by p,q, and r, as well as the cross product vector. I tried to use the polygonplot tool to plot the triangle formed by the three points, but I am confused as to how to get the cross product vector to appear on the plot with the triangle. What tool do I use to plot the triangle with the cross product vector on it, so I can have a picture of the cross product vector starting at p, showing that it is orthogonal to vector pq and pr?

Thank you.

Hello MaplePrimes users

How do I find expressions of an integer as a sum of four squares in Maple?

I have some trouble solving the pde of:
ut + u^2*ux = u, u(x,0) = x, with x::real and t>0.

I think that I have 2 problems.

1.
The first part of the code I define u(x,t) with both the variable rp.
Then I define the variable q copying the definition of u(x,t).
When I try to insert q and u(x,t) in the initial equation - one is able to be reduced to one term while the other isn't.
So I'm not really sure what is happening here.

2.
When I use Maple's pdsolve() I get a result, but when I insert the answer in the initial equation - then it isn't correct.
I tried to show this in the last part of the code.

 

 

 

# ut + u^2*ux = u, u(x,0) = x

restart

rp := (-1 + sqrt(1 + 4*exp(t)^2*t*x))/(2*exp(t)^2*t);

(1/2)*(-1+(1+4*(exp(t))^2*t*x)^(1/2))/((exp(t))^2*t)

(1)

u := (x,t) -> rp*exp(t):
'u(x,t)' = u(x,t);

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

(2)

q := (-1 + sqrt(1 + 4*exp(t)^2*t*x))/(2*exp(t)*t); # Copying the result from above and defining q the same

(1/2)*(-1+(1+4*(exp(t))^2*t*x)^(1/2))/(exp(t)*t)

(3)

# Now doing the same operations on supposedly the same term, but one is able to be reduced with assumptions while the other isn't.

L_nothing := diff(u(x,t),t) + u(x,t)^2*diff(u(x,t),x) ;
L_real := diff(u(x,t),t) + u(x,t)^2*diff(u(x,t),x) assuming x::real;
L_t := diff(u(x,t),t) + u(x,t)^2*diff(u(x,t),x) assuming t>0;
L_all := diff(u(x,t),t) + u(x,t)^2*diff(u(x,t),x) assuming t>0, x::real;

(1/4)*(8*(exp(t))^2*t*x+4*(exp(t))^2*x)/((1+4*(exp(t))^2*t*x)^(1/2)*exp(t)*t)-(1/2)*(-1+(1+4*(exp(t))^2*t*x)^(1/2))/(exp(t)*t)-(1/2)*(-1+(1+4*(exp(t))^2*t*x)^(1/2))/(exp(t)*t^2)+(1/4)*(-1+(1+4*(exp(t))^2*t*x)^(1/2))^2/(exp(t)*t^2*(1+4*(exp(t))^2*t*x)^(1/2))

 

(1/4)*(8*(exp(t))^2*t*x+4*(exp(t))^2*x)/((1+4*(exp(t))^2*t*x)^(1/2)*exp(t)*t)-(1/2)*(-1+(1+4*(exp(t))^2*t*x)^(1/2))/(exp(t)*t)-(1/2)*(-1+(1+4*(exp(t))^2*t*x)^(1/2))/(exp(t)*t^2)

 

(1/2)*(-1+(1+4*(exp(t))^2*t*x)^(1/2))/(exp(t)*t)+(1/4)*(-1+(1+4*(exp(t))^2*t*x)^(1/2))^2/(exp(t)*t^2*(1+4*(exp(t))^2*t*x)^(1/2))

 

(1/2)*(-1+(1+4*(exp(t))^2*t*x)^(1/2))/(exp(t)*t)

(4)

L_nothing := diff(q,t) + q^2*diff(q,x) ;
L_real := diff(q,t) + q^2*diff(q,x) assuming x::real;
L_t := diff(q,t) + q^2*diff(q,x) assuming t>0;
L_all := diff(q,t) + q^2*diff(q,x) assuming t>0, x::real;

(1/4)*(8*(exp(t))^2*t*x+4*(exp(t))^2*x)/((1+4*(exp(t))^2*t*x)^(1/2)*exp(t)*t)-(1/2)*(-1+(1+4*(exp(t))^2*t*x)^(1/2))/(exp(t)*t)-(1/2)*(-1+(1+4*(exp(t))^2*t*x)^(1/2))/(exp(t)*t^2)+(1/4)*(-1+(1+4*(exp(t))^2*t*x)^(1/2))^2/(exp(t)*t^2*(1+4*(exp(t))^2*t*x)^(1/2))

 

(1/4)*(8*(exp(t))^2*t*x+4*(exp(t))^2*x)/((1+4*(exp(t))^2*t*x)^(1/2)*exp(t)*t)-(1/2)*(-1+(1+4*(exp(t))^2*t*x)^(1/2))/(exp(t)*t)-(1/2)*(-1+(1+4*(exp(t))^2*t*x)^(1/2))/(exp(t)*t^2)+(1/4)*(-1+(1+4*(exp(t))^2*t*x)^(1/2))^2/(exp(t)*t^2*(1+4*(exp(t))^2*t*x)^(1/2))

 

(1/4)*(8*(exp(t))^2*t*x+4*(exp(t))^2*x)/((1+4*(exp(t))^2*t*x)^(1/2)*exp(t)*t)-(1/2)*(-1+(1+4*(exp(t))^2*t*x)^(1/2))/(exp(t)*t)-(1/2)*(-1+(1+4*(exp(t))^2*t*x)^(1/2))/(exp(t)*t^2)+(1/4)*(-1+(1+4*(exp(t))^2*t*x)^(1/2))^2/(exp(t)*t^2*(1+4*(exp(t))^2*t*x)^(1/2))

 

(1/4)*(8*(exp(t))^2*t*x+4*(exp(t))^2*x)/((1+4*(exp(t))^2*t*x)^(1/2)*exp(t)*t)-(1/2)*(-1+(1+4*(exp(t))^2*t*x)^(1/2))/(exp(t)*t)-(1/2)*(-1+(1+4*(exp(t))^2*t*x)^(1/2))/(exp(t)*t^2)+(1/4)*(-1+(1+4*(exp(t))^2*t*x)^(1/2))^2/(exp(t)*t^2*(1+4*(exp(t))^2*t*x)^(1/2))

(5)

restart

pde := diff(u(x,t),t) + u(x,t)^2*diff(u(x,t),x) = u(x,t);
ic := u(x,0) = x;

diff(u(x, t), t)+u(x, t)^2*(diff(u(x, t), x)) = u(x, t)

 

u(x, 0) = x

(6)

pdsolve([pde, ic]);

u(x, t) = exp(t)*((2*exp(2*t)*x-2*x+1)^(1/2)-1)/(exp(2*t)-1)

(7)

u := (x,t) -> exp(t)*(sqrt(2*exp(2*t)*x - 2*x + 1) - 1)/(exp(2*t) - 1);

proc (x, t) options operator, arrow; exp(t)*(sqrt(2*exp(2*t)*x-2*x+1)-1)/(exp(2*t)-1) end proc

(8)

L := diff(u(x,t),t) + u(x,t)^2*diff(u(x,t),x) assuming t>0, x::real;

exp(t)*((2*exp(2*t)*x-2*x+1)^(1/2)-1)/(exp(2*t)-1)+2*exp(t)*exp(2*t)*x/((2*exp(2*t)*x-2*x+1)^(1/2)*(exp(2*t)-1))-2*exp(t)*((2*exp(2*t)*x-2*x+1)^(1/2)-1)*exp(2*t)/(exp(2*t)-1)^2+(1/2)*(exp(t))^3*((2*exp(2*t)*x-2*x+1)^(1/2)-1)^2*(2*exp(2*t)-2)/((exp(2*t)-1)^3*(2*exp(2*t)*x-2*x+1)^(1/2))

(9)

LL := simplify(L) = u(x,t)

exp(t)*(2*exp(2*t)*x-(2*exp(2*t)*x-2*x+1)^(1/2)-2*x+1)/((2*exp(2*t)*x-2*x+1)^(1/2)*(exp(2*t)-1)) = exp(t)*((2*exp(2*t)*x-2*x+1)^(1/2)-1)/(exp(2*t)-1)

(10)

evalb(LL)

false

(11)

# Obviously not correct solution... or what?

``

 

 

Download asol1-1.mw

 

 

I just  found what seems to be a serious problem and I am not able to figure if it is related to my own installation or not.

After I installed Physics 426 (Published on Sept 17, 2019) using the Maple GUI install button (which now works for my PC), I found I am not able to integrate basic things.

It seems to affect int when using some build in function with definite integration, but it could be others also. I need to test more. 

Could someone see if they get same problem as well?  

Could also someone please remind me of the library  commands to issue in order to remove current Physics version 426 and install earlier Physics version package, say 425, or any other version, so that  to see if this is related to version of a physics package or not?

restart;

version()

 User Interface: 1399874
         Kernel: 1399874
        Library: 1399874

1399874

interface(version)

`Standard Worksheet Interface, Maple 2019.1, Windows 10, May 21 2019 Build ID 1399874`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 426 and is the same as the version installed in this computer, created 2019, September 20, 23:28 hours, found in the directory C:\Users\me\maple\toolbox\2019\Physics Updates\lib\`

infolevel[int] := 3:

int(exp(x),x=0..1)

Definite Integration:   Integrating expression on x=0..1

Definite Integration:   Using the integrators [distribution, piecewise, series, o, polynomial, ln, lookup, cook, ratpoly, elliptic, elliptictrig, meijergspecial, improper, asymptotic, ftoc, ftocms, meijerg, contour]
LookUp Integrator:   unable to find the specified integral in the table
int/elliptic: trying elliptic integration
Integration Warning:   Integration method ftoc encountered an error in IntegrationTools:-Definite:-Main:
 mismatched multiple assignment of 2 variables on the left side and 1 value on the right side

Definite Integration:   Returning integral unevaluated.

int(exp(x), x = 0 .. 1)

restart;

int(sin(n*x),x=0..Pi)

int(sin(n*x), x = 0 .. Pi)

int(tan(x),x=0..Pi)

int(tan(x), x = 0 .. Pi)

int(cos(x),x=0..1)

int(cos(x), x = 0 .. 1)

int(sin(x),x=0 .. Pi)

int(sin(x), x = 0 .. Pi)

int(cos(x),x)

sin(x)

int(x,x=0 .. 1)

1/2

 

Download int_not_working.mw

Why Maple 2019.1 gives an error when no initial conditions are given for the following heat PDE with periodic BC?

I am using Physics 426 (current version). On windows 10.

When adding ic as some arbitrary function f(x), then the error goes away. But no ic needs to be given to solve this PDE. The answer can be left using arbitrary constants in this case.

I also found that this seems to happen when the BC are periodic. When using the normal Dirichlet B.C. and omitting the initial conditions, the error went away.

Am I doing something wrong or is this a bug?

restart;

pde:=diff(u(x,t),t)=diff(u(x,t),x$2); #try with NO IC
bc:=u(-Pi,t)=u(Pi,t),D[1](u)(-Pi,t)=D[1](u)(Pi,t);
pdsolve([pde,bc],u(x,t))

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

u(-Pi, t) = u(Pi, t), (D[1](u))(-Pi, t) = (D[1](u))(Pi, t)

Error, (in pdsolve/BC/2nd_order/Series/TwoBC) invalid boolean expression: NULL

restart;

pde:=diff(u(x,t),t)=diff(u(x,t),x$2)-u(x,t); #now try with IC
bc:=u(-Pi,t)=u(Pi,t),D[1](u)(-Pi,t)=D[1](u)(Pi,t);
ic:=u(x,0)=f(x);
pdsolve([pde,bc,ic],u(x,t)); #solution is correct

 

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

u(-Pi, t) = u(Pi, t), (D[1](u))(-Pi, t) = (D[1](u))(Pi, t)

u(x, 0) = f(x)

u(x, t) = exp(-t)*_C7[0]+Sum(exp(-t*(n^2+1))*(sin(n*x)*_C1[n]+cos(n*x)*_C7[n]), n = 1 .. infinity)

restart;

pde:=diff(u(x,t),t)=diff(u(x,t),x$2); #now try with NO IC, but not periodic BC
bc:=u(0,t)=1,u(Pi,t)=0;
pdsolve([pde,bc],u(x,t)); #solution is correct

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

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

u(x, t) = ((Sum(sin(n*x)*exp(-n^2*t)*_C1(n), n = 1 .. infinity))*Pi+Pi-x)/Pi

 

 

Download problem_09_20_2019.mw

First 33 34 35 36 37 38 39 Last Page 35 of 47