Maple 2024 Questions and Posts

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

Dear all, in the example below I create a matrix(3x2) and each element contains a vector. How can I avoid the double brackets of the matrix elements or eliminate the double brackets?

Thanks for help

I know this question has been asked time and time again. Starting of with the expr . That is the end goal I want to achieve.  How would I reduce the expansion to get it into 1-f(x,y,z)/g(x,y,z) format?. I have tried all sorts of approaches.
 

restart

#

expr:=1 - (x__1*x__2 + y__1*y__2 - z__1*z__2)^2/((x__1^2 + y__1^2 - z__1^2)*(x__2^2 + y__2^2 - z__2^2))

1-(x__1*x__2+y__1*y__2-z__1*z__2)^2/((x__1^2+y__1^2-z__1^2)*(x__2^2+y__2^2-z__2^2))

(1)

normal( (1) );

(x__1^2*y__2^2-x__1^2*z__2^2-2*x__1*x__2*y__1*y__2+2*x__1*x__2*z__1*z__2+x__2^2*y__1^2-x__2^2*z__1^2-y__1^2*z__2^2+2*y__1*y__2*z__1*z__2-y__2^2*z__1^2)/((x__1^2+y__1^2-z__1^2)*(x__2^2+y__2^2-z__2^2))

(2)

simplify( (2) );

((y__2^2-z__2^2)*x__1^2-2*x__2*(y__1*y__2-z__1*z__2)*x__1+(y__1^2-z__1^2)*x__2^2-(y__1*z__2-y__2*z__1)^2)/((x__1^2+y__1^2-z__1^2)*(x__2^2+y__2^2-z__2^2))

(3)

radnormal(%)

(x__1^2*y__2^2-x__1^2*z__2^2-2*x__1*x__2*y__1*y__2+2*x__1*x__2*z__1*z__2+x__2^2*y__1^2-x__2^2*z__1^2-y__1^2*z__2^2+2*y__1*y__2*z__1*z__2-y__2^2*z__1^2)/((x__1^2+y__1^2-z__1^2)*(x__2^2+y__2^2-z__2^2))

(4)

Test:=combine(%)

(x__1^2*y__2^2-x__1^2*z__2^2-2*x__1*x__2*y__1*y__2+2*x__1*x__2*z__1*z__2+x__2^2*y__1^2-x__2^2*z__1^2-y__1^2*z__2^2+2*y__1*y__2*z__1*z__2-y__2^2*z__1^2)/((x__1^2+y__1^2-z__1^2)*(x__2^2+y__2^2-z__2^2))

(5)

 

n:={op(numer(Test))}

{x__1^2*y__2^2, x__2^2*y__1^2, -x__1^2*z__2^2, -x__2^2*z__1^2, -y__1^2*z__2^2, -y__2^2*z__1^2, -2*x__1*x__2*y__1*y__2, 2*x__1*x__2*z__1*z__2, 2*y__1*y__2*z__1*z__2}

(6)

d:={op(expand(denom(Test)))}

{x__1^2*x__2^2, x__1^2*y__2^2, x__2^2*y__1^2, y__1^2*y__2^2, z__1^2*z__2^2, -x__1^2*z__2^2, -x__2^2*z__1^2, -y__1^2*z__2^2, -y__2^2*z__1^2}

(7)

d subset n

false

(8)

d intersect n

{x__1^2*y__2^2, x__2^2*y__1^2, -x__1^2*z__2^2, -x__2^2*z__1^2, -y__1^2*z__2^2, -y__2^2*z__1^2}

(9)

add(%[i],i=1..nops(%))

x__1^2*y__2^2-x__1^2*z__2^2+x__2^2*y__1^2-x__2^2*z__1^2-y__1^2*z__2^2-y__2^2*z__1^2

(10)

factor( (10) );

x__1^2*y__2^2-x__1^2*z__2^2+x__2^2*y__1^2-x__2^2*z__1^2-y__1^2*z__2^2-y__2^2*z__1^2

(11)

n minus d

{-2*x__1*x__2*y__1*y__2, 2*x__1*x__2*z__1*z__2, 2*y__1*y__2*z__1*z__2}

(12)

 


 

Download 2024-07-20_Q_Simplify_Reformat.mw

This is some serious problem in Latex in Maple 2024.1

I went back to using _C1, _C2 for my own constants of integration.

But I want to get the nice latex for c__1,c__2.

So to do that, my understanding is that I just need to call Maple's dsolve after restart on some random ode in order to set c__1,c__2 for display only and also for latex.

This below seems to confirm this.  But now the latex generated is all wrong and messed up on some places. 

My question is: I want to use use _C1,_C2 (i.e. the traditional constants) in my own code I write which generates solution to an ode, but for Latex, I'd like these to come out as c__1,c__2 since they look nicer.

What is the correct way to do this? What Am I doing wrong here? I do not see it.

interface(version);

`Standard Worksheet Interface, Maple 2024.1, Windows 10, June 25 2024 Build ID 1835466`

#EXAMPLE showing using _C1 for input and latex. All works OK
restart;

sol:=y(x) = x+_C1/x^2;

y(x) = x+_C1/x^2

#correct latex. No problem compiling, but not nice looking _C1
latex(sol)

y \! \left(x \right) = x +\frac{\textit{\_C1}}{x^{2}}

#Example showing what happens when making call to dsolve initially
restart;

dsolve(diff(y(x),x$2)=0); #this call is used to just activate display of nicer constants

y(x) = c__1*x+c__2

sol:=y(x) = x+_C1/x^2;

y(x) = x+c__1/x^2

#bad latex, gives error when compiling with texlive
latex(sol)

y \! \left(x \right) = x +\frac{c}{_}

 

 

Download latex_problem_maple_2024_july_18_2024.mw

And to confirm this is new problem in Maple 2024, I run the same exact worksheet now in Maple 2023.2, and there it works correctly. i.e. Latex generated is correct in both cases. Here is the Maple 2023.2 worksheet, you can see below the difference in Latex.

interface(version);

`Standard Worksheet Interface, Maple 2023.2, Windows 10, November 24 2023 Build ID 1762575`

#EXAMPLE showing using _C1 for input and latex. All works OK
restart;

38296

sol:=y(x) = x+_C1/x^2;

y(x) = x+_C1/x^2

#correct latex. No problem compiling, but not nice looking _C1
latex(sol)

y \! \left(x \right) = x +\frac{\textit{\_C1}}{x^{2}}

#Example showing what happens when making call to dsolve initially
restart;

38296

dsolve(diff(y(x),x$2)=0); #this call is used to just activate display of nicer constants

y(x) = c__1*x+c__2

sol:=y(x) = x+_C1/x^2;

y(x) = x+c__1/x^2

#good Latex now in Maple 2023.2.
latex(sol)

y \! \left(x \right) = x +\frac{c_{1}}{x^{2}}

 

 

Download latex_problem_maple_2023.2.mw

If it makes any difference to Maple, I am using the typesetting EXTENDED now for everything. But I do not think Latex should care about this, but thought to mention it just in case.

Hello

Consider,  as an example,  the following (simple) transcendental equation. 

alpha*((epsilon-1)*x+y-3*x*z-epsilon/3*x^3+b*sin(w)+3)

How to retrieve the coefficients and the terms considering that the unknowns are x,y,z and w?   Something like [x,y,x*z,x^3,sin(w),1] and their coefficients.  

many thanks

I have thought before that Maple's dsolve will try to return implicit solution automatically if unable to find explicit one or for some  other reasons it prefers implicit.

But In this ode, we see Maple returns no solution at all for this first order quadrature ode, even though it can find solution when given implicit option.

Is this a correct behaviour? Should it not have returned this solution automatically?

interface(version);

`Standard Worksheet Interface, Maple 2024.1, Windows 10, June 25 2024 Build ID 1835466`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1774 and is the same as the version installed in this computer, created 2024, July 16, 17:18 hours Pacific Time.`

restart;

ode:=diff(y(x),x)=sin(y(x));
IC:=y(a)=b;

diff(y(x), x) = sin(y(x))

y(a) = b

maple_sol:=dsolve([ode,IC]);

maple_sol:=dsolve([ode,IC],explicit);

maple_sol:=dsolve([ode,IC],implicit);

x-ln(csc(y(x))-cot(y(x)))-a+ln(csc(b)-cot(b)) = 0

 

 

Download why_no_solution_by_dsolve_july_18_2024.mw

I called dsolve with timelimit on this ode.  All of Maple instantly locks up.

I do not mean the worksheet, but everything. I have each worksheet using its own engine,. Not able to open new worksheet, nothing clicks. The whole front end locks up. Can't click on anything. 

Killing every mserver.exe does not even resolve this. I had to terminate all of Maple from the task manager. The strange thing, is that looking at task manager I see mserver.exe doing nothing. zero CPU. Only the front end process is at high CPU (the one with the Java icon).  It looks like the Java frontend is locked up for some reason.

 

Do others see the same thing? does this happen on the mac also? Please make sure to save all your work before trying to run this on your PC.

Maple 2024.1 on windows 10. This is first order Riccati ode.

interface(version);

`Standard Worksheet Interface, Maple 2024.1, Windows 10, June 25 2024 Build ID 1835466`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1774 and is the same as the version installed in this computer, created 2024, July 16, 17:18 hours Pacific Time.`

ode:=(a2*x^2+b2*x+c2)*diff(y(x),x)=y(x)^2+(a1*x+b1)*y(x)+a0*x^2+b0*x+c0;

(a2*x^2+b2*x+c2)*(diff(y(x), x)) = y(x)^2+(a1*x+b1)*y(x)+a0*x^2+b0*x+c0

DEtools:-odeadvisor(ode);

[_rational, _Riccati]

#WARNING. This will freeze all of Maple.
timelimit(30,dsolve(ode));


Download maple_lock_up_july_17_2024.mw

These are GUI options on my end.

 

 

 

 

UPDATE 1

in Maple 2023.2 also on windows 10,  there is no lock up at all. same code. The solution to the ode is very large. I tried using both typesetting level  to EXTENDED  and  typesetting level MAPLE STANDARD and no hang.

I wonder if this has something to do with why Maple 2024.1 locks up? But I have not changed anything in my end. I made no change in options or anything else. same PC, same graphics card. 

UPDATE 2

Found the BUG!!  

In Maple 2024.1, if I change the display option typesetting level  to EXTENDED, the front end do not hang.

If I change the display typesetting level MAPLE STANDARD, the ftont end hangs.

But why??


 

interface(version);

`Standard Worksheet Interface, Maple 2024.1, Windows 10, June 25 2024 Build ID 1835466`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1774 and is the same as the version installed in this computer, created 2024, July 16, 17:18 hours Pacific Time.`

ode:=(a2*x^2+b2*x+c2)*diff(y(x),x)=y(x)^2+(a1*x+b1)*y(x)+a0*x^2+b0*x+c0;

(a2*x^2+b2*x+c2)*(diff(y(x), x)) = y(x)^2+(a1*x+b1)*y(x)+a0*x^2+b0*x+c0

DEtools:-odeadvisor(ode);

[_rational, _Riccati]

interface(typesetting=extended):

timelimit(30,dsolve(ode));

`[Length of output exceeds limit of 1000000]`

interface(typesetting=standard):

#WARNING, this will hang MAPLE now. WHY??
timelimit(30,dsolve(ode));


 

Download maple_lock_up_july_17_2024_2.mw

ps. Reported to Maplesoft support. July 17, 2024. Hopefully this will be fixed in Maple 2024.2

 

Hello

I am trying to understand how to use Maple to solve a PDE.  Below it is a problem (Henon-Heilles system) where the answer is known.  

with(PDEtools);

infolevel[pdsolve]:=3:

declare(Hamil(x,y,u,v));

PDEHamil := u*diff(Hamil(x, y, u, v), x) + v*diff(Hamil(x, y, u, v), y) + (-2*x*y - x)*diff(Hamil(x, y, u, v), u) + (-x^2 + y^2 - y)*diff(Hamil(x, y, u, v), v) = 0;

pdsolve(PDEHamil)

Maple returns no solution, but one solution is:

sH:=1/2*(u^2+v^2)+1/2*(x^2+y^2-2/3*y^3)+x^2*y;

simplify(eval(subs(Hamil(x,y,u,v)=sH,PDEHamil)));
    0=0

What am I missing?

Many thanks.

I was working with a Dataframe when I wanted to change the datatype of multiple columns at the same time as this is quite a large dataframe. I found in the helpfile that I can change datatype by the following command: 

SubsDatatype(Data, plts, float) which then change the datatype of "plts" into float. I had hoped that using multiple columns in the command would work in this way: SubsDatatype(Data, [plts, act], float)  but apparently not. Is there a way to do this or do I have to do it column by column?

Additionally I have another question about dataframes. I would like to replace "0" in the dataframe by a "blank" as you can do in excel. How do you do this in a dataframe?

Thanks in advance for any help given!

Using ScatterPlot (or ErrorPlot), one can add error bars to a 2d point plot of data. However, the bars are single lines. I wish to create a plot with H-type error bars in both the horizontal and vertical directions.  Below is an example showing how the bars should appear. (This image is taken from a previous question about adding error bars.) 

I do not need to reproduce this figure exactly. The location of the data points and the size of the error bars are irrelevant. The closest I have seen is using BoxPlot.

Has this question been asked and answered? If so, I cannot find it. 

I am wondering if Maple DETools package has functions or command to deal with the following problem: algebraic invariant curve. Some first order ODE preserves such type of curve as their solutions. For example, the following ODE has an algebraic curve y(x)=0 as its particular solutions:

> odetest(y(x)=0, y'(x)=y(x)^3-2*x*y(x)^2,y(x));

> 0

The ODE in general does not have algebraic solutions. The solutions are computed in terms of special functions. In some cases the algebraic curve could have multi-variate forms . I am wondering about one question: Does Maple have tools to find solutions of algebraic curve for ODE, without knowing the information of general solutions? I have already tried PDETools:-casesplit, but it seems to classify such curves to the same case to the general solution. 

I will be glad if anyone could give me some advice.

Hello,

I need to check if Maple can solve a specific PDE. Since I don't know much about the PDEtools package, I wonder if a user familiar with it and experienced in solving PDEs could help me.

with(PDEtools);
declare(u(x,y,z,w));
PDE1:=alpha*(y+b*(w))*diff(u(x,y,z,w),x)+(x+z-b*(w))*diff(u(x,y,z,w),y)-c*y*diff(u(x,y,z,w),z)+d*(y-x)*diff(u(x,y,z,w),w)=0;
Sol1:=pdsolve(PDE1);

Maple returns NULL as the solution. Any ideas on how to obtain a solution, if possible? In other similar PDEs, u(x,y,w,z) has a quadratic form.

Many thanks,

When you look at negative horiztonal values on a basic plot, the axis labels can be obscured by gridlines or the plot itself. I have been told many times to keep axis labels and gradation labels outside of the plotting area to avoid adding more information than is neccessary in the actual plotting area. Is there a way to move the label to the other side and rotate it by 180 degree? How do people normally deal with this issue?

See my example of how the axis labels can be obscured by gridlines.

axis_label_on_wrong_side_of_axis.mw

I am trying to improve the positioning of the gammas in the diagram (at bottom) as they are too close to the points and lines. gamma1 and gamma2 have been assigned values. This best I could come up with is shown below.

restart;

with(plots):with(plottools):

with(Typesetting):

`gamma2`:=<3|5|2>

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

(1)

Pgamma2:=[3/2,5/2]

[3/2, 5/2]

(2)

display(point(Pbeta2,symbol=solidcircle,symbolsize=14),textplot([Pgamma2[],Typeset((`gamma2` )),align={above}]))

 

 

 

Download 2024-07-10_Typeset_gamma.mw

Hello

I am trying to solve some PDEs using Maple.  In one of them, Maple returns

SolL:= HL(x, y, z) = f__1(1/2*(2*sigma*z - x^2)/sigma, rho^2 - 2*rho*z + y^2 + z^2)

How to retrieve only the arguments of f__1?  

Many thanks

The change from _C1 to c__1 is causing me so many problems as I still do not fully understand it.

I have nothing in my Maple ini file. 

I was solving from a solution to an ode for the constant of integration, which I know is c__1 inside a proc.

But this was failing to solve for it. When I copy same code to global (worksheet), it works. So it is clearly issue of name space related to c__1 vs. _C1. 

So even though the solution now has the subscripted version and not the traditional one (since that is the default now), it does not solve for it when inside a proc.

If instead I solve for _C1, then it works. Even though the solution has c__1. This is bizzar to me. 

I also tried adding   global c__1; inside the proc, but this did not help. (did not show this version in the worksheet).

Why is solving for c__1 fail inside a proc but works outside? Clearly the c__1 in the solution of the ode is not the same c__1 I typed in to solve for, even though on the screen they look the same. 

So c__1 is not really the same as _C1 in all aspects. Right?

Here is worksheet. Example 1 below shows how it fails inside proc

Maple 2024.1. Does this happen for others on Linux or the Mac?
 

restart;

interface(version);

`Standard Worksheet Interface, Maple 2024.1, Windows 10, June 25 2024 Build ID 1835466`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1767 and is the same as the version installed in this computer, created 2024, June 28, 12:19 hours Pacific Time.`

Example (1) solving for constant of integration fails inside proc but works outside

 

restart;

foo:=proc(ode::`=`)
local sol,the_constant;
   sol:=dsolve(ode);
   print("sol is ",sol);
   the_constant:=solve(sol,c__1);
   print("the constant is ",the_constant);
end proc;

proc (ode::`=`) local sol, the_constant; sol := dsolve(ode); print("sol is ", sol); the_constant := solve(sol, c__1); print("the constant is ", the_constant) end proc

#this does not work
ode:=diff(y(x),x) = 3/4*y(x)/x;
foo(ode)

diff(y(x), x) = (3/4)*y(x)/x

"sol is ", y(x) = c__1*x^(3/4)

"the constant is "

restart;

#this works
ode:=diff(y(x),x) = 3/4*y(x)/x;
sol:=dsolve(ode);
print("sol is ",sol);
the_constant:=solve(sol,c__1);

diff(y(x), x) = (3/4)*y(x)/x

y(x) = c__1*x^(3/4)

"sol is ", y(x) = c__1*x^(3/4)

y(x)/x^(3/4)

 

Example (2). Solving for _C1 works, even though the ode has c__1  , why??

 

restart;

foo:=proc(ode::`=`)
local sol,the_constant;
   sol:=dsolve(ode);
   print("sol is ",sol);
   the_constant:=solve(sol,_C1);  #notice solving for _C1 now
   print("the constant is ",the_constant);
end proc;

proc (ode::`=`) local sol, the_constant; sol := dsolve(ode); print("sol is ", sol); the_constant := solve(sol, _C1); print("the constant is ", the_constant) end proc

ode:=diff(y(x),x) = 3/4*y(x)/x;
foo(ode)

diff(y(x), x) = (3/4)*y(x)/x

"sol is ", y(x) = c__1*x^(3/4)

"the constant is ", y(x)/x^(3/4)

restart;

ode:=diff(y(x),x) = 3/4*y(x)/x;
sol:=dsolve(ode);
print("sol is ",sol);
the_constant:=solve(sol,c__1); #these both work OK in global
the_constant:=solve(sol,_C1);  #these both work OK in global

diff(y(x), x) = (3/4)*y(x)/x

y(x) = c__1*x^(3/4)

"sol is ", y(x) = c__1*x^(3/4)

y(x)/x^(3/4)

y(x)/x^(3/4)

 

 

Example (3). Forcing arbitraryconstants = subscripted it still does not work inside proc. Why??

 

restart;

foo:=proc(ode::`=`)
local sol,the_constant;
   sol:=dsolve(ode,arbitraryconstants = subscripted);   
   print("sol is ",sol);
   the_constant:=solve(sol,c__1);
   print("the constant is ",the_constant);
end proc;

proc (ode::`=`) local sol, the_constant; sol := dsolve(ode, arbitraryconstants = subscripted); print("sol is ", sol); the_constant := solve(sol, c__1); print("the constant is ", the_constant) end proc

ode:=diff(y(x),x) = 3/4*y(x)/x;
foo(ode)

diff(y(x), x) = (3/4)*y(x)/x

"sol is ", y(x) = c__1*x^(3/4)

"the constant is "

 


 

Download constant_of_integration_solving_july_9_2024_maple_2024.mw

 

1 2 3 4 5 6 7 Last Page 1 of 12