Maple 2024 Questions and Posts

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

Consider the following exact algebraic number expr
 

restart;

kernelopts('version'):

Physics:-Version():

expr := Physics:-`*`(2-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2), sqrt(1-(1-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2))^2))+Physics:-`*`(Physics:-`*`(3+Physics:-`*`(4, 1-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2)), 1/12), sqrt(3-Physics:-`*`(4, (1-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2))^2)))+Physics:-`*`(Physics:-`*`(2, Physics:-`*`(2-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2), 1/3)), sqrt(Physics:-`*`(Physics:-`*`(2, 2-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2)), 1-Physics:-`*`(2, 1-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2)))))+Physics:-`*`(Physics:-`*`(1+Physics:-`*`(2, 1-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2)), 1/6), sqrt(Physics:-`*`(2, (1/4)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2)^2-Physics:-`*`(3, (1-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345, index = 2)-1/2)^2))^2)))):

CodeTools:-Usage(PolynomialTools:-MinimalPolynomial(expr));

memory used=0.97MiB, alloc change=12.00KiB, cpu time=31.00ms, real time=27.00ms, gc time=0ns

 

27*_X^2+70*_X-433

(1)

evalf[30](eval(27*_X^2+70*_X-433, _X = expr));

0.262508598220109180966e-6

(2)

"evalf((mp:=CodeTools:-Usage(evala(':-Minpoly'(expr,_X)))));"

memory used=70.25GiB, alloc change=48.00MiB, cpu time=23.63m, real time=21.81m, gc time=3.18m

 

-422.3889573*_X+2208.949800*_X^4-225.8139518*_X^3-230.2173498*_X^2+59.33811620+_X^10-19.92850932*_X^9+166.6440365*_X^8-755.9985571*_X^7+1997.484781*_X^6-3014.379082*_X^5

(3)

type(mp, polynom(rational, _X))

false

(4)


 

Download wrong_minpoly.mw 
I would like to find its minimal polynomial (without a priori knowledge). 

According to the documentation, 

if is an exact algebraic number, and and are not given, then PolynomialTools:-MinimalPolynomial(expr) will call  to compute an exact minimal polynomial of . If a name is not specified for the variable , then  will be used.

Regretfully, it is easy to see that the minimal polynomial of expr cannot be the returned 27*_X^2 + 70*_X - 433. And when I invoke  directly, the result is still not correct (and this evaluation takes a rather long time). 
Another help page mentions that 

the call mp := evala(Minpoly(expr, _X)) computes the monic minimal polynomial of  in the variable  over the field of rational numbers (or multivariate rational functions); the resulting polynomial will not contain any algebraic numbers or functions.

However, as type(mp, polynom(rational, _X)) gives , we know that cannot be the desired minimal polynomial of expr either. 
So, what is the proper way to compute the minimal polynomial of expr in Maple? 

Code: 

use alpha=1-(1/2)/(1-(RootOf(16*_Z*(_Z*(2*_Z*(_Z*(8*_Z*(_Z*(_Z*(_Z*(32*_Z*(8*_Z-33)+1513)-812)-13)+267)-1469)-330)+811)+279)+345,index=2)-1/2)**2) in 
	expr:=(1+alpha)*sqrt(1-alpha**2)+(3+4*alpha)/12*sqrt(3-4*alpha**2)+2*(1+alpha)/3*sqrt(2*(1+alpha)*(1-2*alpha))+(1+2*alpha)/6*sqrt(2*((1-alpha)**2-3*alpha**2)) 
end:
CodeTools:-Usage(PolynomialTools:-MinimalPolynomial(expr));

Of note, the minimal polynomial of an algebraic number zeta is the unique irreducible monic polynomial of smallest degree p(x) with rational coefficients such that p(zeta)=0 and whose leading coefficient is 1

As the following worksheet shows, 
 

restart

kernelopts('version');

Physics:-Version();

`Maple 2024.0, X86 64 WINDOWS, Mar 01 2024, Build ID 1794891`

`The "Physics Updates" version in the MapleCloud is 1732 and is the same as the version installed in this computer, created 2024, April 12, 17:58 hours Pacific Time.`

with(RealDomain):

eval(MTM:-det(<
   a, b/2, d/2 |
   b/2, c, e/2 |
   d/2, e/2, f
  >), PDETools:-Solve(MTM:-det(<
     x**2 + y**2, x1**2 + y1**2, x2**2 + y2**2, x3**2 + y3**2 |
     x, x1, x2, x3 |
     y, y1, y2, y3 |
     1, 1, 1, 1
    >) = inner([a, b, c, d, e, f], [x**2, x*y, y**2, x, y, 1]),
   {f, e, d, c, b, a}, 'independentof' = {y, x}))/MTM:-det(<
  x1, x2, x3 |
  y1, y2, y3 |
  1, 1, 1
 >): simplify(`%`);

-(1/4)*(x1^2-2*x1*x2+x2^2+(y1-y2)^2)*(x2^2-2*x2*x3+x3^2+(y2-y3)^2)*(x1^2-2*x1*x3+x3^2+(y1-y3)^2)

eval(MTM:-det(<
   a, b/2, d/2 |
   b/2, c, e/2 |
   d/2, e/2, f
  >), PDETools:-Solve(MTM:-det(<
     x**2 - y**2, x1**2 - y1**2, x2**2 - y2**2, x3**2 - y3**2, x4**2 - y4**2 |
     x*y, x1*y1, x2*y2, x3*y3, x4*y4 |
     x, x1, x2, x3, x4 |
     y, y1, y2, y3, y4 |
     1, 1, 1, 1, 1
    >) = inner([a, b, c, d, e, f], [x**2, x*y, y**2, x, y, 1]),
   {f, e, d, c, b, a}, 'independentof' = {y, x}))/(MTM:-det(<
   x2, x3, x4 | 
   y2, y3, y4 | 
   1, 1, 1
  >)*MTM:-det(<
   x3, x4, x1 | 
   y3, y4, y1 | 
   1, 1, 1
  >)*MTM:-det(<
   x4, x1, x2 | 
   y4, y1, y2 | 
   1, 1, 1
  >)*MTM:-det(<
   x1, x2, x3 | 
   y1, y2, y3 | 
   1, 1, 1
  >)): simplify(`%`);

(1/4)*((x2-x3)*x1-x2*x4+x3*x4+(y2-y3)*(y1-y4))*((x3-x4)*x1+(x4-x3)*x2+(y3-y4)*(y1-y2))*((x2-x4)*x1-x2*x3+x3*x4+(y2-y4)*(y1-y3))


 

Download Why_not_consider_subexpressions?.mw

the underlined part is evidently not the simplest. (For instance, shouldn't RealDomain:-simplify(x2^2 - 2*x2*x3 + x3^2 + (y2 - y3)^2, 'size') and RealDomain:-simplify((x2-x3)*x1-x2*x4+x3*x4+(y2-y3)*(y1-y4), 'size') be converted into RealDomain:-simplify((x2 - x3)^2 + (y2 - y3)^2, 'size') and RealDomain:-simplify((x2 - x3)*(x1 - x4) + (y2 - y3)*(y1 - y4), 'size')?) 
If I understand correctly, , by default, should try combining every part of an expression with every other to apply a vast range of potential transformations to look at many different forms of it and make progress in picking out the simplest possible one. So, why is simplify unable to touch certain sub-expressions when they are encountered at intermediate stages in a computation? 

Could someone be able to spot why I get different solution when solving for the constant of integration from this Maple dsolve solution manually than when asking Maple to do it directly?

This is the ode 

ode:=x*y(x)*diff(y(x), x) = (x + 1)*(y(x) + 1);
ic:=y(1) = 1;

If I ask Maple to solve it with the IC all at once, it gives solution which odetest verifies OK.

If I ask Maple to solve it with no IC, then solve the constant myself and plug the constant back into the solution I get solution which does not verify any more.

I am not able to find why. Could someone spot the error in this? Please see worksheet below. I suspect the problem is when plugging back the constant of integration into the general solution, but have no idea now what it is. Clearly Maple did something much smarter than what I did by just plugging the constant back into the solution. May be need to specify what branch to use when plugging the constant back? but how do I know which one?
 

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

Physics:-Version()

`The "Physics Updates" version in the MapleCloud is 1730 and is the same as the version installed in this computer, created 2024, April 17, 19:33 hours Pacific Time.`

ode:=x*y(x)*diff(y(x), x) = (x + 1)*(y(x) + 1);
ic:=y(1) = 1;
sol_no_IC:=dsolve(ode);
 

x*y(x)*(diff(y(x), x)) = (x+1)*(y(x)+1)

y(1) = 1

y(x) = -LambertW(-exp(-x-1)/(x*c__1))-1

sol_with_IC_direct:=dsolve([ode,ic]);
odetest(sol_with_IC_direct,[ode,ic]);

y(x) = -LambertW(-1, -2*exp(-x-1)/x)-1

[0, 0]

#this verifies Maple found correct constant also:

solve(rhs(sol_with_IC_direct)=rhs(sol_no_IC),c__1)

1/2

#now solve for constant of integration manually. This gives invalid solution. Why?

eq:= 1=limit(rhs(sol_no_IC),x=1);

1 = -LambertW(-exp(-2)/c__1)-1

PDEtools:-Solve(eq,c__1);

c__1 = 1/2

sol_with_ic:=eval(sol_no_IC,%)

y(x) = -LambertW(-2*exp(-x-1)/x)-1

odetest(sol_with_ic,[ode,ic]);

[0, 2+LambertW(-2*exp(-2))]

 

 

Download why_wrong_solution.mw

In my view, <x || (1 .. 2); y || (1 .. 2); 1 $ 2> should return a Matrix without any error messages; however, 

<x || (1 .. 2); y || (1 .. 2); 1 $ 2>; # Arguments are shielded??? 
Error, (in Matrix) this entry is too wide or too narrow: 1

If I understand right, each argument of a function is evaluated in turn (unless the modifier is used). 
So why is it not equivalent to <x1, x2; y1, y2; 1, 1>

 

I am trying to find the minimum values of a table, but not of all of its indices, just some that comply to a certain pattern.

The minimum of the values of a table are found by using min(entries(atable)).

If the indices of atable are "a1", "a2", "b1", "b2", I would like to just have the ones starting with "a".

Can be done by a loop, but is there a easier way?

I any trying to seperate the real and imaginary components but they are mixed up inside and outside a square root.

Their seems to be a problem displaying the worksheet.

restart



expand((a+I*b)*(a-I*b))
(a+I*b)+(a-I*b)
# z = x *Iy    I need to seperate out solution to [x,y] & [x,-y]
#https://math.stackexchange.com/questions/44391/foci-of-a-general-conic-equation
eq := T*z^2 - (R + S*I)*z +G-K + H*I
sol:=solve(eq,z)
expand(sol[1]*sol[2])=a^2+b^2
simplify(sol[1]+sol[2]=2*a)
simplify(sol[1]-sol[2]=2*b)

Maple Worksheet - Error

Failed to load the worksheet /maplenet/convert/2024-04-20_Q_Seperate_Real_&_Imaginary.mw .

Download 2024-04-20_Q_Seperate_Real_&_Imaginary.mw

Is it wrong to call limit like this

limit(expr,[y = y0,x=x0]);

vs

limit(expr,y = y0);
limit(%,x=x0);

The first one gives internal Maple error.  Worksheet attached. I would have expected both to work the same.

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1727 and is the same as the version installed in this computer, created 2024, April 17, 19:33 hours Pacific Time.`

kernelopts('assertlevel'=2):

expr:=3/2*(y-1)^(2/3)-3/2*x^2-c__1 = 0;
y0:=-7;
x0:=3;
limit(expr,[y = y0,x=x0]);
 

(3/2)*(y-1)^(2/3)-(3/2)*x^2-c__1 = 0

-7

3

Error, (in limit/multi/ldegree1) assertion failed

expr:=3/2*(y-1)^(2/3)-3/2*x^2-c__1 = 0;
y0:=-7;
x0:=3;
limit(expr,y = y0);
limit(%,x=x0);

(3/2)*(y-1)^(2/3)-(3/2)*x^2-c__1 = 0

-7

3

-3+(3*I)*3^(1/2)-(3/2)*x^2-c__1 = 0

-33/2+(3*I)*3^(1/2)-c__1 = 0

 

 

Download limit_internal_error_maple_2024.mw

I still see these Maple internal errors in Maple 2024.

Now calling odetest.

The problem is that it is not possible to catch them.

Any suggestion what to do and what causes it?

11196

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1727 and is the same as the version installed in this computer, created 2024, April 17, 19:33 hours Pacific Time.`

sol:=y(x) = (exp(RootOf(-sin(x)*tanh(1/2*_Z+1/2*c__1)^2+sin(x)+exp(_Z)))+sin(x))/sin(x);
ode:=diff(y(x),x)-cot(x)*(y(x)^(1/2)-y(x)) = 0;

y(x) = (exp(RootOf(-sin(x)*tanh((1/2)*_Z+(1/2)*c__1)^2+sin(x)+exp(_Z)))+sin(x))/sin(x)

diff(y(x), x)-cot(x)*(y(x)^(1/2)-y(x)) = 0

try
   odetest(sol,ode,y(x));
catch:
   print("cought error ");
end try;

Error, (in anonymous procedure called from depends) too many levels of recursion

 

 

Download too_many_levels_of_recursion_calling_odetest_maple_2024.mw

Hopefully, this is a question relating to Mathematica, which I find virtually unreadable, and the Statistics package, which I am minimally familiar with, that someone can answer quickly.

Hence, could someone translate the following Mathematica code into Maple code? (The MmaTranslator failed at the 2nd line.)

func[x_] := 1/(1 + Sinh[2*x]*(Log[x])^2);

Distrib[x_, average_, var_] :=   PDF[NormalDistribution[average, var], 1.1*x - 0.1];
n = 10;
RV = RandomVariate[TruncatedDistribution[{0.8, 3}, NormalDistribution[1, 0.399]], n];
Int = 1/n Total[func[RV]/Distrib[RV, 1, 0.399]]*Integrate[Distrib[x, 1, 0.399], {x, 0.8, 3}]

I think I found another clitch in odetest.

dsolve gives correct solution to this first order ode with IC. But odetest does not verify that the solution is satisfied for the IC part, but only for the ode itself. 

Below worksheet confirms the solution is also valid for the IC.   So why odetest does not give 0 for the IC part?

``

restart;

19644

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1727. The version installed in this computer is 1725 created 2024, April 15, 17:29 hours Pacific Time, found in the directory C:\Users\Owner\maple\toolbox\2024\Physics Updates\lib\`

libname;

"C:\Users\Owner\maple\toolbox\2024\Physics Updates\lib", "C:\Program Files\Maple 2024\lib"

ode:=x^2*diff(y(x),x)*cos(y(x))+1=0;
ic:=y(infinity)=Pi/3; #16/3*Pi;
sol:=dsolve([ode,ic]);
odetest(sol,[ode,ic])

x^2*(diff(y(x), x))*cos(y(x))+1 = 0

y(infinity) = (1/3)*Pi

y(x) = arcsin((1/2)*(3^(1/2)*x+2)/x)

[0, (1/3)*Pi]

#we see that odetest think the solution does not verify the IC. But it does

IC_eq:=Pi/3=limit(rhs(sol),x=infinity)

(1/3)*Pi = (1/3)*Pi

Download odetest_does_not_verfiy_correct_solution_maple_2024_april_18_2024.mw

I think what odetest did is not use limit when plugging in the values. That is why.

If we do not use limit, this is what happens:

IC_eq:=Pi/3=eval(rhs(sol),x=infinity)

And this explains the odetest output. It should have used limit.

ps. just in case also reported to Maplesoft support.

Every last query I make in the AI Formula Assistant returns this message...

This happens even when I use a basic canned query shown in use-case examples (e.g., surface area, sphere).

I have accepted the Terms of Use.  Is there some other setting I need to enable? Thanks.

For the following program using dsolve to solved a differential equation with a sum of exponential inputs, the time required has a huge dependence on subtle difference in paramters.

For example, if Cl := 0.32, calculation time is 1.4 sec.    If Cl := 0.33,  calculation time is 39 sec.

Also, calculation time seems to have huge dependence  on whether or not I truncate M

Can someone please explain what is going on?

restart;
st := time();
N := 4;

T := 5.0/60;
M := 6905;
dose := t -> M*sum(Heaviside(t - 24*k/N)*exp((-t + 24*k/N)/T), k = 0 .. 2*N - 1);
Cl := 0.32;
deq := diff(C(t), t) = dose(t) - Cl*C(t);
sol := t -> rhs(dsolve({deq, C(0) = 0}));
p := plot(sol(t), t = 0 .. 48);
time() - st;
                             1.360
 

Hi,

I am the administrator of Maple in my school, and all the students use Maple in part of their exams. Is it possible  to block the access to ChatGPT thru eg. the firewall or otherwise during exams. 

The reason for this question is that the students must have access to some internet sources during exams, but definately not CharGPT.

Kind regards 

Per Kirkegaard

Hello, I try to solve the equations of the odometric model with the Maple 2024 but I have not the answers as with the hands, can you help me to verify it ?

dsolve(diff(phi(t), t) = tan(10*t)/5)

dsolve(diff(x(t), t) = V*cos(ln(1 + tan(10*t)^2)/100))

dsolve(diff(y(t), t) = V*sin(ln(1 + tan(10*t)^2)/100))

Best regards, Edern Ollivier.

I noticed that Student:-ODEs:-ODESteps does not use the newer subscripted constant of integrations for solution of odes which looks much nicer.

Is there a way to make it use same constant of integrations as dsolve() does? Compare  

This is on a worksheet using typesetting level extended. Worksheet is attached


 

restart

18836

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1724 and is the same as the version installed in this computer, created 2024, April 15, 17:29 hours Pacific Time.`

#to make Maple use the new constant of integrations. Is this still needed in Maple 2024?
dsolve(diff(y(x),x$9)=1,arbitraryconstants=subscripted):
pdsolve(diff(psi(x,t),x$9)=0,arbitraryfunctions=subscripted):

ode := diff(y(x), x$2) + 2*y(x) = 0;
Student:-ODEs:-ODESteps(ode,y(x));

ode := diff(y(x), x, x)+2*y(x) = 0

"[[,,"Let's solve"],[,,((&DifferentialD;)^2)/(&DifferentialD;x^2) y(x)+2 y(x)=0],["&bullet;",,"Highest derivative means the order of the ODE is" 2],[,,((&DifferentialD;)^2)/(&DifferentialD;x^2) y(x)],["&bullet;",,"Characteristic polynomial of ODE"],[,,r^2+2=0],["&bullet;",,"Use quadratic formula to solve for" r],[,,r=(0+/-([]))/2],["&bullet;",,"Roots of the characteristic polynomial"],[,,r=(-&ImaginaryI; sqrt(2),&ImaginaryI; sqrt(2))],["&bullet;",,"1st solution of the ODE"],[,,y[1](x)=cos(sqrt(2) x)],["&bullet;",,"2nd solution of the ODE"],[,,y[2](x)=sin(sqrt(2) x)],["&bullet;",,"General solution of the ODE"],[,,y(x)=C1 y[1](x)+C2 y[2](x)],["&bullet;",,"Substitute in solutions"],[,,y(x)=C1 cos(sqrt(2) x)+C2 sin(sqrt(2) x)]]"

#compare to this output
dsolve(ode,y(x));

y(x) = c__1*sin(2^(1/2)*x)+c__2*cos(2^(1/2)*x)


 

Download make_step_solution_use_new_constant_of_integration.mw

 

First 25 26 27 28 29 30 31 Page 27 of 31