nm

10713 Reputation

19 Badges

12 years, 247 days

MaplePrimes Activity


These are questions asked by nm

I was watching Maple's video for conference 2024. In one of the presentation, this example is given

But in my Mapple 2024.2 I get an error typing the same command:

interface(version);

`Standard Worksheet Interface, Maple 2024.2, Windows 10, October 29 2024 Build ID 1872373`

restart;

my_ode:={diff(x(t),t$2)-t^2*x(t)=0, x(0)=1,D(x)(0)=1}:
MultivariatePowerSeries:-PowerSeries(my_ode,t,x);

Error, invalid input: too many and/or wrong type of arguments passed to MultivariatePowerSeries:-PowerSeries; first unused argument is t

 

 

Download powerSeries_nov_14_2024.mw

Link to the video is here  it is around 39:00 in time. 

Any one knows why I get an error using same command shown in the video?

I wanted to draw vertical line (as y axis) and add a solid disk at some y location (to indicate some point location). I used plottools:-disk  to make the small disk and used plottools:-line to make the y-axis then used plots:-display to combine them.

All is ok, except the disk is transparent. i.e. I can see the y-axis line below it. Is there a way to make it not transparent? i.e. solid color, so that the y-axis below it do not show?

interface(version);

`Standard Worksheet Interface, Maple 2024.2, Windows 10, October 29 2024 Build ID 1872373`

#plot vertical line
L:=plottools:-line([0,0],[0,3],color="blue"):
c1:=plottools:-disk([0,1],.1,color="red"):
c2:=plottools:-disk([0,2],.1,color="green"):
plots:-display([L,c1,c2],scaling=constrained,axes=none)

 


i.e. 

Download plotools_nov_9_2024.mw

[moderator: The Physics update Library fixes this bug with the same error generated and reported by the same Mapleprimes member on another ODESteps example.]

I have removed Physics update from libname path. 

Now I find I get error calling latex command. When Physics update is on libname, no error.

The error is 

         Error, (in Typesetting:-Parse) too many levels of recursion

I am using worksheet with typesetting extended. But also when I change it to typesetting standard, same error. 

Does this mean one must keep Physics update on libname path for Maple to work OK?

Is this error expected if Physics update is not on libname?

Worksheet below that shows this problem

restart;

interface(version);

`Standard Worksheet Interface, Maple 2024.2, Windows 10, October 29 2024 Build ID 1872373`

CASE 1. With Physics update in libname path, no error

 

restart;

libname;

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

ode:=[diff(x__1(t),t)=2*x__1(t)+x__2(t),diff(x__2(t),t)=2*x__1(t)+3*x__2(t)];

[diff(x__1(t), t) = 2*x__1(t)+x__2(t), diff(x__2(t), t) = 2*x__1(t)+3*x__2(t)]

the_output:=Student:-ODEs:-ODESteps(ode,output=typeset):

latex(the_output,'output'=string):

 

CASE 2.  Removing Physics from libname path, gives internal error

 

restart;

libname:=libname[2];

"C:\Program Files\Maple 2024\lib"

ode:=[diff(x__1(t),t)=2*x__1(t)+x__2(t),diff(x__2(t),t)=2*x__1(t)+3*x__2(t)];

[diff(x__1(t), t) = 2*x__1(t)+x__2(t), diff(x__2(t), t) = 2*x__1(t)+3*x__2(t)]

the_output:=Student:-ODEs:-ODESteps(ode,output=typeset):

latex(the_output,'output'=string):

Error, (in Typesetting:-Parse) too many levels of recursion

 

 

 

Download internal_error_from_latex_when_libname_changed_nov_2_2024.mw

I think I just found one of the most serious problems in Maple I've seen (other than timelimit hanging).

This is using Maple 2024.2 on windows 10.

I'll explain in words the problem, then give worksheet below to reproduce this. I can reproduce this all the time.

I have implicit solution in y(x) to an ode.

If I first solve for y(x) from the solution, so solution is now explicit, then call odetest to check if this explicit solution is correct, and if I use assumptions on the odetest call, and then after that call odetest on the original implicit solution, then odetest fails to verify the implicit solution.

But, if I change the order, and first call odetest to verify the implicit solution first, it verifies it OK !  

So the problem ONLY happens if I change the order of calling odetest and if I use assumptions on the odetest call that was used before on the explicit solution.

This tells me that Maple remembers something from earlier call. Does it remember the assumptions used? If so, this is very risky. As some part of program might call odetest with some assumptions, and another part of the program can use no assumptions.  I thought assuming is only applied to the call it is used at only and will not affect future calls.

Is there a way then to clear all assumptions used on earlier call to Maple command before using the command again? Or to tell Maple not to remember assumptions used on a call?

This is a big problem. It took me 14 hrs of debuging to find it. Order of calls to odetest should not make it behave different.

I hope someone could find solution to this, since now I have no idea what to do as I need to use odetest on explicit and implicit solutions and I do not want the order of calling Maple command to make difference in results.

This worksheet shows the problem. 3 cases are given. Notice that when using assumptions on earlier call to odetest, how it fails to verify the implicit solution in later call.

restart;

interface(version);

`Standard Worksheet Interface, Maple 2024.2, Windows 10, October 29 2024 Build ID 1872373`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1824 and is the same as the version installed in this computer, created 2024, October 31, 14:22 hours Pacific Time.`

kernelopts('assertlevel'=2):

CASE 1. Calling odetest on explicit first with assumptions, make odetest hang when calling on implicit after

 

restart;

IMPLICIT_SOL:=ln(10*x^2 + (10*y(x) + 12)*x + 5*y(x)^2 + 8*y(x) + 4)/5 - (4*arctan((5*y(x) + 5*x + 4)/(5*x + 2)))/5 = (3*ln(2))/5 + (4*arctan(3))/5;
ode:=2*x+3*y(x)+2+(y(x)-x)*diff(y(x),x) = 0;
IC:=y(0) = -2;

(1/5)*ln(10*x^2+(10*y(x)+12)*x+5*y(x)^2+8*y(x)+4)-(4/5)*arctan((5*y(x)+5*x+4)/(5*x+2)) = (3/5)*ln(2)+(4/5)*arctan(3)

2*x+3*y(x)+2+(y(x)-x)*(diff(y(x), x)) = 0

y(0) = -2

#find explicit solution first
EXPLICIT_SOL:=solve(IMPLICIT_SOL,y(x)):

#NOw check the explicit solution. Using assumptions to see the problem
timelimit(30,  ( odetest(y(x)=EXPLICIT_SOL,[ode,IC]) assuming positive, y(x)::positive) );

Error, (in evalr) time expired

#Now odetest hangs on the implicit solution

timelimit(30,  odetest(IMPLICIT_SOL,[ode,IC]) );

Error, (in is/internal/rename) time expired

 

 

(1/5)*ln(10*x^2+(10*y(x)+12)*x+5*y(x)^2+8*y(x)+4)-(4/5)*arctan((5*y(x)+5*x+4)/(5*x+2)) = (3/5)*ln(2)+(4/5)*arctan(3)

y(x)

2*x+3*y(x)+2+(y(x)-x)*(diff(y(x), x)) = 0

y(0) = -2

CASE 2. Calling odetest on implicit solution first, then it DOES NOT hang !!

 

restart;

IMPLICIT_SOL:=ln(10*x^2 + (10*y(x) + 12)*x + 5*y(x)^2 + 8*y(x) + 4)/5 - (4*arctan((5*y(x) + 5*x + 4)/(5*x + 2)))/5 = (3*ln(2))/5 + (4*arctan(3))/5;
ode:=2*x+3*y(x)+2+(y(x)-x)*diff(y(x),x) = 0;
IC:=y(0) = -2;

(1/5)*ln(10*x^2+(10*y(x)+12)*x+5*y(x)^2+8*y(x)+4)-(4/5)*arctan((5*y(x)+5*x+4)/(5*x+2)) = (3/5)*ln(2)+(4/5)*arctan(3)

2*x+3*y(x)+2+(y(x)-x)*(diff(y(x), x)) = 0

y(0) = -2

#notice, no hang now, since called before
timelimit(30,  odetest(IMPLICIT_SOL,[ode,IC]) );

[0, 0]

#NOw check the explicit solution. This will timeout which is OK
EXPLICIT_SOL:=solve(IMPLICIT_SOL,y(x)):
timelimit(30,  ( odetest(y(x)=EXPLICIT_SOL,[ode,IC]) assuming positive, y(x)::positive) );

Error, (in type/complex) time expired

#check again that odetest still verifies the implicit solution OK

timelimit(30,  odetest(IMPLICIT_SOL,[ode,IC]) );

[0, 0]

 

CASE 3. Calling odetest with no assumptions on explicit solution, then it also does not hang

 

restart;

IMPLICIT_SOL:=ln(10*x^2 + (10*y(x) + 12)*x + 5*y(x)^2 + 8*y(x) + 4)/5 - (4*arctan((5*y(x) + 5*x + 4)/(5*x + 2)))/5 = (3*ln(2))/5 + (4*arctan(3))/5;
ode:=2*x+3*y(x)+2+(y(x)-x)*diff(y(x),x) = 0;
IC:=y(0) = -2;

(1/5)*ln(10*x^2+(10*y(x)+12)*x+5*y(x)^2+8*y(x)+4)-(4/5)*arctan((5*y(x)+5*x+4)/(5*x+2)) = (3/5)*ln(2)+(4/5)*arctan(3)

2*x+3*y(x)+2+(y(x)-x)*(diff(y(x), x)) = 0

y(0) = -2

#Now check the explicit solution. but DO NOT use assumptions
EXPLICIT_SOL:=solve(IMPLICIT_SOL,y(x)):
timelimit(30, odetest(y(x)=EXPLICIT_SOL,[ode,IC]));

Error, (in factor/remember) time expired

#check again that odetest still verifies the implicit solution OK

timelimit(30,  odetest(IMPLICIT_SOL,[ode,IC]) );

[0, 0]

 


 

Download order_of_ode_test_makes_difference_oct_31_2024.mw

 

update NOV 2, 2024 6 AM

I found the cause.

Removing PHYSICS from libname, then the problem goes away !

So this is caused by PHYSICS package. For some reason, having Physics package in the libname causes odetest to hang/fail compared to when the physics package is not in the libname path. Worksheet below.

restart;

interface(version);

`Standard Worksheet Interface, Maple 2024.2, Windows 10, October 29 2024 Build ID 1872373`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1824 and is the same as the version installed in this computer, created 2024, October 31, 14:22 hours Pacific Time.`

libname;

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

CASE 1. without PHYSICS on libname, it works !!

 

restart;

kernelopts('assertlevel'=2):

libname;

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

libname:=libname[2]; #remove PHYSICS

"C:\Program Files\Maple 2024\lib"

libname;

"C:\Program Files\Maple 2024\lib"

IMPLICIT_SOL:=ln(10*x^2 + (10*y(x) + 12)*x + 5*y(x)^2 + 8*y(x) + 4)/5 - (4*arctan((5*y(x) + 5*x + 4)/(5*x + 2)))/5 = (3*ln(2))/5 + (4*arctan(3))/5;
ode:=2*x+3*y(x)+2+(y(x)-x)*diff(y(x),x) = 0;
IC:=y(0) = -2;

(1/5)*ln(10*x^2+(10*y(x)+12)*x+5*y(x)^2+8*y(x)+4)-(4/5)*arctan((5*y(x)+5*x+4)/(5*x+2)) = (3/5)*ln(2)+(4/5)*arctan(3)

2*x+3*y(x)+2+(y(x)-x)*(diff(y(x), x)) = 0

y(0) = -2

#find explicit solution first
EXPLICIT_SOL:=solve(IMPLICIT_SOL,y(x)):

#NOw check the explicit solution. Using assumptions to see the problem
timelimit(30,  ( odetest(y(x)=EXPLICIT_SOL,[ode,IC]) assuming positive, y(x)::positive) );

Error, (in evalr/ln) time expired

#Now try odetest  on the implicit solution

infolevel[odetest]:=5;

5

timelimit(30,  odetest(IMPLICIT_SOL,[ode,IC]) );

odetest: Performing an implicit solution test

odetest: Performing an explicit (try soft) solution test

odetest: Performing an implicit solution (II) test

[0, 0]

 

 

CASE 2. With Physics on libname, it fails !

 

restart;

kernelopts('assertlevel'=2):

libname;

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

IMPLICIT_SOL:=ln(10*x^2 + (10*y(x) + 12)*x + 5*y(x)^2 + 8*y(x) + 4)/5 - (4*arctan((5*y(x) + 5*x + 4)/(5*x + 2)))/5 = (3*ln(2))/5 + (4*arctan(3))/5;
ode:=2*x+3*y(x)+2+(y(x)-x)*diff(y(x),x) = 0;
IC:=y(0) = -2;

(1/5)*ln(10*x^2+(10*y(x)+12)*x+5*y(x)^2+8*y(x)+4)-(4/5)*arctan((5*y(x)+5*x+4)/(5*x+2)) = (3/5)*ln(2)+(4/5)*arctan(3)

2*x+3*y(x)+2+(y(x)-x)*(diff(y(x), x)) = 0

y(0) = -2

#find explicit solution first
EXPLICIT_SOL:=solve(IMPLICIT_SOL,y(x)):

timelimit(30,  ( odetest(y(x)=EXPLICIT_SOL,[ode,IC]) assuming positive, y(x)::positive) );

Error, (in evalr/shake) time expired

#Now try odetest  on the implicit solution

infolevel[odetest]:=5;

5

timelimit(30,  odetest(IMPLICIT_SOL,[ode,IC]) );

odetest: Performing an implicit solution test

odetest: Performing an explicit (try soft) solution test

odetest: Performing an implicit solution (II) test

Error, (in is/internal/rename) time expired

 

 

Download order_of_ode_test_makes_difference_NOV_2_2024.mw

my question is: Is it safe to permanently remove Physics package from libname? Why is having physics package in libname (which is by default) causes this problem?

I do not use Physics package explicitly in my code. i.e. I do not do Physics:- calls. 

Any one knows what effect not having Physics on libname cause? Will Maple still work OK for everything if one is not calling Physics package explicitly?

What is the correct way to find all terms of the form  _Cn^m where n is non negative integer and m is exponent which can be 1?

The problem is finding _Cn with no exponent. Maple's   _Cn^anything does not match _Cn but only when there is an actual exponent present.

It is easy to find _Cn^m with m present and easy to find _Cn with no exponent, but how to combine the two is the problem. Here is an example.

Given e:=_C1^2+_C1+_C2^3+a+b; I want to obtain the set {_C1^2,_C1,_C2^3}  but I get instead {_C1, _C2, _C1^2, _C2^3} using ther following code

e:=_C1^2+_C1+_C2^3+a+b;
indets(e,   Or(  And(symbol, suffixed(_C, nonnegint)),
                 And(symbol, suffixed(_C, nonnegint))^anything  ));

If instead I do this

e:=_C1^2+_C1+_C2^3+a+b;
indets(e, And(symbol, suffixed(_C, nonnegint))^anything);

This gives {_C1^2, _C2^3} , so it did not pick the _C1 term since exponent is missing. If I do this instead

e:=_C1^2+_C1+_C2^3+a+b;
indets(e, And(symbol, suffixed(_C, nonnegint)));

This it gives {_C1, _C2} and if I do 

e:=_C1^2+_C1+_C2^3+a+b;
indets(e,   And(symbol, suffixed(_C, nonnegint))^Or(anything,identical(1)))

it gives {_C1^2, _C2^3}

What to do to obtain {_C1^2,_C1,_C2^3} 

I am trying to find all _Cn^m in an expression where m can be anything including not being there (or 1 basically) but in Maple, exponent 1 is not counted as exponent.

Update

Another input example is e:=_C1^2+_C1+ _C1*_C2^3+a+b;  This should be produce the set {_C1^2,_C1,_C2^3} 

Any trick to use for this?

Maple 2024.1

 

First 9 10 11 12 13 14 15 Last Page 11 of 194