nm

10129 Reputation

19 Badges

12 years, 122 days

MaplePrimes Activity


These are questions asked by nm

There is an integration method called orering in Maple. But see no mention on it at help page 

It shows up when using option 

method=_RETURNVERBOSE

And that is how I knew about it.

It gives division by zero when asked to integrate zero !

Any one knows what is this method? Will send bug email to Maplesoft suport just in case also.
 

interface(version);

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

int(0,x)

0

int(0,x,method=orering)

Error, (in IntegrationTools:-Indefinite) numeric exception: division by zero

int(1,x,method=orering)

x

 


 

Download division_by_zero_int_orering_method.mw

 

 

I wanted to keep a running total over a number of independent batch mode Maple scripts.

So I figured I use .m file.   

Each run will read the old variable from .m file, update it, and write it again.

All what it need to do is just check if the .m file exist or not to account for the very first run.

But to my surprise, I found the variable content do not update after doing SAVE A,"TMP.m"

It seems Maple sees A variable already in TMP.m and does not save the new value of A again?. Just guessing. I was expecting that after I do  read "TMP.m" that the variable in the file will overwrite same variable value in the local proc. 

After one time update, each time I read the variable, its value is same.

First time using save myself, so may be I am doing something wrong but do not see it. I was expecting to see   10,20,30,40,50,..... running total, but I see 10,20,20,20,20,...../

What Am I doing wrong? do I need to make the variable global for this to work?

Here is worksheet. Maple 2024 on windows 10.


 

24344

restart;

24344

currentdir("G:/public_html/my_notes/solving_ODE/new_version/tests/");
try  #remove TMP.m first time
    FileTools:-Remove("TMP.m");
catch:
    NULL;
end try;

#this function is called many times.
foo:=proc()
 local A:=0,B;
 A:=A+10;
 if FileTools:-Exists("TMP.m") then
     print("TMP.m exists, will read its content");
     B:=A; #save copy
     read "TMP.m";
     print("Read old value of A from file",A);
     A:= A + B; #update running total
     print("Now A is ",A," will now save this new value");     
     save A,"TMP.m";
  else
     print("TMP.m do not exist, first time saving to it");
     save A,"TMP.m";
  fi;
  print("A=",A);
end proc:
 

"C:\Program Files\Maple 2024"

foo();

"TMP.m do not exist, first time saving to it"

"A=", 10

foo();

"TMP.m exists, will read its content"

"Read old value of A from file", 10

"Now A is ", 20, " will now save this new value"

"A=", 20

foo();

"TMP.m exists, will read its content"

"Read old value of A from file", 10

"Now A is ", 20, " will now save this new value"

"A=", 20

foo();

"TMP.m exists, will read its content"

"Read old value of A from file", 10

"Now A is ", 20, " will now save this new value"

"A=", 20

foo();

"TMP.m exists, will read its content"

"Read old value of A from file", 10

"Now A is ", 20, " will now save this new value"

"A=", 20

 


 

Download T.mw

Just found very serious problem.

Was trying my code in command line maple (cmaple.exe) only to find latex() command fails now.

Same code works with no problem in worksheet.  Here is first the worksheet version.
 

33308

restart;

33308

interface(version);

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

ode:=diff(y(x),x)=x;
try
    s:=latex(ode,'output'=string):
    print("Latex command worked on ode");
catch:
    error lastexception;
end try:


the_output:=Student:-ODEs:-ODESteps(ode,y(x)):
try
    s:=latex(the_output,'output'=string):
    print("Latex command worked");
catch:
    error lastexception;
end try:

diff(y(x), x) = x

"Latex command worked on ode"

"Latex command worked"

 


 

Download worksheet_version_latex_OK_june_21_2024.mw

Now I do same thing but from command line. I put the above code in A.mpl file in some folder on windows:

ode:=diff(y(x),x)=x;
try
    s:=latex(ode,'output'=string):
    print("Latex command worked on ode");
catch:
    error lastexception;
end try:


the_output:=Student:-ODEs:-ODESteps(ode,y(x)):
try
    s:=latex(the_output,'output'=string):
    print("Latex command worked");
catch:
    error lastexception;
end try:

 

Then opened a command windows terminal and cd to the above folder and typed this command

"C:\Program Files\Maple 2024\bin.X86_64_WINDOWS\cmaple.exe"  -q A.mpl

And this is what happens. Latex works OK on generating latex for the ode, but not for the steps!It gives error

 

Error, latex, invalid input: %1 uses a %-2 argument, %3 (of type %4), which is missing, latex:-ModuleApply, 1, e, anything

Also I was not able to suppress the display of the odesteps on the terminal even though they do not display in worksheet, they still print in the terminal. But this is a side issue.

Why does Latex gives error in command line? 

I think it is related to those funny looking characters (bullets?) signs at the start of each ODE step that show in the terminal? 

But in worksheet latex has no problem converting the ODE steps to Latex. It is only in cmaple. 

Is there a way to correct this? It seems to be some character encoding is causing the problem for Latex on command line vs. worksheet.

 

Windows 10, Maple 2024

 

 

 

How did Student:-ODEs:-ODESteps([ode,ic]); managed to get this zero solution to this ode? I can't follow the logic it did.

Any ideas what it is doing in the 4th step there?
 

13496

interface(version);

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

ode := diff(y(x), x) = y(x)*(2*y(x) - x)/(x*(-2*x + 3*y(x)));
ic:=y(1)=-1;
dsolve([ode,ic]);

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

y(1) = -1

y(x) = (1/6)*(I*((-27*x^2+x^3+3*3^(1/2)*(-2*x^5+27*x^4)^(1/2))^(2/3)-x^2)*3^(1/2)-((-27*x^2+x^3+3*3^(1/2)*(-2*x^5+27*x^4)^(1/2))^(1/3)-x)^2)/(-27*x^2+x^3+3*3^(1/2)*(-2*x^5+27*x^4)^(1/2))^(1/3)

#now try ODEsteps
Student:-ODEs:-ODESteps([ode,ic]);
 

"[[,,"Let's solve"],[,,[(ⅆ)/(ⅆx) y(x)=(y(x) (2 y(x)-x))/(x (-2 x+3 y(x))),y(1)=-1]],["•",,"Highest derivative means the order of the ODE is" 1],[,,(ⅆ)/(ⅆx) y(x)],["•",,"Solve for the highest derivative"],[,,(ⅆ)/(ⅆx) y(x)=(y(x) (2 y(x)-x))/(x (-2 x+3 y(x)))],["•",,"Use initial condition" y(1)=-1],[,,0],["•",,"Solve for" 0],[,,0=0],["•",,"Substitute" 0=0 "into general solution and simplify"],[,,0],["•",,"Solution to the IVP"],[,,0]]"

odetest(y(x)=0,[ode,ic])

[0, -1]

 


 

Download strange_ode_steps_solution_june_20_2024.mw

I am getting Maple server crash each time running this solve command.

Could others reproduce it? I am using windows 10. Maple 2024.  Why does it happen?

Will report it to Maplesoft in case it is not known. Worksheet below.

22396

restart;

23484

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 1762 and is the same as the version installed in this computer, created 2024, June 13, 11:3 hours Pacific Time.`

sol:=(3^(1/2)*u(x)-1/3*3^(1/2)+(3*u(x)^2-2*u(x)-1)^(1/2))^(1/3*3^(1/2)) = x^(1/3*3^(1/2))*c__1;

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

eval(sol,u(x) = u);

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

timelimit(30,[solve(%,u)]);


 

Download maple_crash_calling_solve_june_18_2024.mw

This bug seems to have been introduced in Maple 2023 since it crashes there also.

But not in Maple 2022. No crash there. Same PC.

22396

restart;

interface(version);

`Standard Worksheet Interface, Maple 2022.2, Windows 10, October 23 2022 Build ID 1657361`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1762. The version installed in this computer is 1401 created 2023, March 2, 10:49 hours Pacific Time, found in the directory C:\Users\Owner\maple\toolbox\2022\Physics Updates\lib\`

sol:=(3^(1/2)*u(x)-1/3*3^(1/2)+(3*u(x)^2-2*u(x)-1)^(1/2))^(1/3*3^(1/2)) = x^(1/3*3^(1/2))*c__1;

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

eval(sol,u(x) = u);

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

solve(%,u);

(1/18)*3^(1/2)*(3*(x^((1/3)*3^(1/2))*c__1)^(3^(1/2))+2*3^(1/2)+4*(x^((1/3)*3^(1/2))*c__1)^(-3^(1/2)))

 

 

Download maple_NO_crash_calling_solve_june_18_maple_2022.mw

First 11 12 13 14 15 16 17 Last Page 13 of 185