nm

8552 Reputation

19 Badges

12 years, 347 days

MaplePrimes Activity


These are replies submitted by nm

@acer 

using x::numeric makes the function accept  1/2 as input.

So now NC(1, 1/2); returns 1. 

But  1/2 is 0.5 and the only digit is

NC(1, 0.5);  returns correctly.

That is why I used 

the_num::{integer,float}

@emendes 

In the example you sent my old mac had no problem to run the code: "Time out ok" in 120.736 (quite close to twice the estipulated time)

Could you please try with higher timeouts? try 200 seconds for example, then 300 seconds? Does it freez after that? As I mentioned the time could be different depending on the PC/memory and other factors.

I am using Maple 2022.2 on windows.

@dharr 

Thanks for trying. If I understand you right, you did get it to freeze, but at longer timeout. It depends on the PC and how fast it is to get solve or timelimit into the code path where it hangs. I have fast PC so with me 60 seconds was enough.

The issue with using task manager to kill the server is secondary. For me, I had to do that as (!) click did not do it. It does turn gray, but the server.exe remains running at high CPU. So (!) did not kill the server.

The main issue is that depending on what timelimit is used, it can cause a freeze. So it is all non-determinstic. It is not possible to do large scale development in Maple this way.

Note I am not talking about timelimit taking a little longer to timeout than asked. This is not the issue. It is actual freezing, or taking 10 hrs when the timeout is 30 seconds. This is the main problem that Maplesoft seems unable to fix for 30 years now.

@Carl Love 

You are correct., According to definition it should be degree 2. Corrected the tests so they all now pass

tests:=[[diff(y(x),x)=y(x)^(1/2),1],
[diff(y(x),x$2)+diff(y(x),x)^(1/2)=y(x),2],
[(1+diff(y(x),x)^2)^(3/2)=diff(y(x),x$2),2],
[3*y(x)^2*diff( y(x),x)^3- diff(y(x),x$2)=sin(x^2),1],
[sqrt(1+ diff(y(x),x)^2)=y(x)*diff(y(x),x$3),2],
[sqrt(1+ diff(y(x),x)^2)=y(x)*diff(y(x),x$3),2],
[sin(diff(y(x),x))+ diff(y(x),x$2)+3*x,FAIL],
[exp(diff(y(x),x$2))+sin(x)*diff(y(x),x)=1,FAIL],
[k*diff(y(x),x$2)^2=(1+ diff(y(x),x$2)^2)^3,6],
[x*diff(y(x),x$2)^3*diff(y(x),x)-5*exp(x)*diff(y(x),x$2)+y(x)*ln(y(x)),3],
[2*ln(x)*diff(y(x),x)^2+7*cos(x)*diff(y(x),x$2)^4*diff(y(x),x)^7+x*y(x)=0,4],
[y(x)-x*diff(y(x),x)-1/2/diff(y(x),x)^2=0,3],
[diff(y(x), x, x) - a*(c + b*x + y(x))*(diff(y(x), x)^2 + 1)^(3/2) = 0,2]]:

for i from 1 to nops(tests) do 
  deg := ODE_degree(tests[i,1]);
  if deg <> tests[i,2] then
     print("Failed on ",tests[i,1]," .Expected degree ",tests[i,2]," got ",deg);
  else
     print("Passed on ",tests[i,1]," .Expected degree ",tests[i,2]," got ",deg);
   fi;
od:

 

@Carl Love 

Hello. I found a bug. Added it to tests.

For the following ode

Which clearly has degree 1 by just looking at it, since the highest derivative has degree 1.  But ODE_degree gives 2. I think this happens because the ODE_degree tries to normalize all powers to integers, so it squares the ode, resulting in (y'')^2 ? 

 

#see https://www.mapleprimes.com/questions/227477-Finding-Order-And-Degree-Of-ODE-In-Maple
ODE_degree:=proc(e::{algebraic, `=`(algebraic)})
 try
      (e-> degree(
         e, 
         indets(
            e, 
            'typefunc'(
               (O-> `if`(O>1, 'typefunc'('`@@`'(identical(D),O)), specfunc(D)))
                  (PDEtools:-difforder(e))
            )
         )
      ))
         (
            ((e::satisfies(e-> degree(e, indets(e, specfunc(Diff)))::posint))-> 
               convert(e,D)
            ) 
               (frontend(
                  numer@evala@':-Norm',
                  [convert((numer@`if`(e::`=`, lhs-rhs, x->x))(e), Diff)], 
                  [
                     {
                         specfunc(Diff), `+`, `*`, 
                         'satisfies'(e-> hastype(e, specfunc(Diff)))^rational
                     }, 
                     {}
                  ]
               ))
         )
   catch:
     FAIL;
   end try;
end proc;   

And

ode:=diff(diff(y(x),x),x)-a*(c+b*x+y(x))*(diff(y(x),x)^2+1)^(3/2) = 0;
ODE_degree(ode)

                          2

 

Here is the updated tests

tests:=[[diff(y(x),x)=y(x)^(1/2),1],
[diff(y(x),x$2)+diff(y(x),x)^(1/2)=y(x),2],
[(1+diff(y(x),x)^2)^(3/2)=diff(y(x),x$2),2],
[3*y(x)^2*diff( y(x),x)^3- diff(y(x),x$2)=sin(x^2),1],
[sqrt(1+ diff(y(x),x)^2)=y(x)*diff(y(x),x$3),2],
[sqrt(1+ diff(y(x),x)^2)=y(x)*diff(y(x),x$3),2],
[sin(diff(y(x),x))+ diff(y(x),x$2)+3*x,FAIL],
[exp(diff(y(x),x$2))+sin(x)*diff(y(x),x)=1,FAIL],
[k*diff(y(x),x$2)^2=(1+ diff(y(x),x$2)^2)^3,6],
[x*diff(y(x),x$2)^3*diff(y(x),x)-5*exp(x)*diff(y(x),x$2)+y(x)*ln(y(x)),3],
[2*ln(x)*diff(y(x),x)^2+7*cos(x)*diff(y(x),x$2)^4*diff(y(x),x)^7+x*y(x)=0,4],
[y(x)-x*diff(y(x),x)-1/2/diff(y(x),x)^2=0,3],
[diff(y(x), x, x) - a*(c + b*x + y(x))*(diff(y(x), x)^2 + 1)^(3/2) = 0,1]]:

for i from 1 to nops(tests) do 
  deg := ODE_degree(tests[i,1]);
  if deg <> tests[i,2] then
     print("Failed on ",tests[i,1]," .Expected degree ",tests[i,2]," got ",deg);
  else
     print("Passed on ",tests[i,1]," .Expected degree ",tests[i,2]," got ",deg);
   fi;
od:

All pass except the last one.

fyi, in Mathematica it is `Sin` and not `sin`

You could try the Mma translator also. But it does not know how to translate this to maple

MmaTranslator:-FromMma(`Cases[{Sin[x]/(Sin[2-x]+1)-12,Sin[x/2]^2},Sin[_],Infinity]`)

Warning, there is no Maple equivalent to Cases

So manual translation is needed in this case.

@ecterrab 

Sorry, but I have no idea what a TTY Maple is.

I open new worksheet and issue the command Physics:-Version(latest); and this always used to work. It gives a message that I need to close Maple and restart after that.

Recently this no longer works. But I tried the icon method and that worked now. So I will use that instead from now on.

Is the command Physics:-Version(latest); issued from a worksheet no longer supported? Here is a smal movie.

@ecterrab 

Thanks for the fix, I was going to try it, but I am still not able to update the Physics package. Is the server still down?

I closed all of Maple and restarted it 3 times, and each time I get

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

Should I wait and try again some other time? Here is the worksheet attached so you can see. I am on windows 10

interface(version);

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

Physics:-Version(latest);

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

interface(version);

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

ode:=exp(y(x))+cos(x)*y(x)+(exp(y(x))*x+sin(x))*diff(y(x),x) = 0;
sol1:=y(x) = -LambertW(x/(sin(x)*exp(_C1/sin(x)))) - _C1/sin(x);
sol2:=y(x) = -LambertW(x/(sin(x)*exp(_C1/sin(x)))) + _C1/sin(x);

exp(y(x))+cos(x)*y(x)+(exp(y(x))*x+sin(x))*(diff(y(x), x)) = 0

y(x) = -LambertW(x/(sin(x)*exp(_C1/sin(x))))-_C1/sin(x)

y(x) = -LambertW(x/(sin(x)*exp(_C1/sin(x))))+_C1/sin(x)

odetest( sol1,ode)

0

odetest( sol2,ode)

Error, (in tools/map) too many levels of recursion

 

Download sign.mw

@Thomas Richard 

The error is simply due to sign change. Compare this below. This is clearly a bug. It is no problem if odetest can't verify it. This is not the issue.

The big problem is that Maple generates an exception that can not be even cought by the user. This brings down the whole application when this happens and there is no workaround. 

restart;

interface(version);

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

ode:=exp(y(x))+cos(x)*y(x)+(exp(y(x))*x+sin(x))*diff(y(x),x) = 0;
sol1:=y(x) = -LambertW(x/(sin(x)*exp(_C1/sin(x)))) - _C1/sin(x);
sol2:=y(x) = -LambertW(x/(sin(x)*exp(_C1/sin(x)))) + _C1/sin(x);

exp(y(x))+cos(x)*y(x)+(exp(y(x))*x+sin(x))*(diff(y(x), x)) = 0

y(x) = -LambertW(x/(sin(x)*exp(_C1/sin(x))))-_C1/sin(x)

y(x) = -LambertW(x/(sin(x)*exp(_C1/sin(x))))+_C1/sin(x)

odetest( sol1,ode)

0

odetest( sol2,ode)

Error, (in tools/map) too many levels of recursion

 

Download sign.mw

@tomleslie 

Sure. I know I can use value() to evaluate the inert integral.

when it appears to be convenient not to evaluate

But that is really what I am asking. How does it decide when it is "not convenient"

if I want to duplicate Maple's result, I can not write

  If not  integral_result::convenient   then
     return inert_version_of_integral
 else
    return integral_result
 fi;

I wish I could.

So it must have some rules it decided what is and what is not  convenient and I am asking what are these rules/measures it uses as I would like to be able to do the same and also to learn something on how dsolve does these things.

@ecterrab 

Hello Edgardo

I seem not to have good job explaining the problem. I did not mean dsolve itself returns mixed c__i and _Ci. But that it seems only _C1 and _C2 are automatically translated to c__1 and c__2 and _C3 and _C4 remain the same. So when I build my own solution manually, I get mixed constants. Here is one more example

(having problem uploading worksheet, will try screen shot)

Download problem_with_C_2.mw

restart;
dsolve(diff(y(x),x)=1,arbitraryconstants=subscripted);
pdsolve(diff(psi(x,t),x$2)=0,arbitraryfunctions=subscripted);
_C1;_C2;_C3;_C4
mysoluiton:= y(x)=_C1*y1(x)+_C2*y1(x)+_C3*y1(x)+_C4*y1(x);

THis is the output

 

My question is simply, why only _C1 and _C2 are translated and not higher ones? My understading is that once the arbitraryconstants=subscripted is used once, it now automatically translate each _Ci to c__i for any i.

But may be this  is not how it works and I misunderstood it.

@Preben Alsholm 

Yes, infinity is not a real number. But you do agree that -infinity satisfies the equation in the question. Therefore it is a solution.

In addition, in differential equations, having an +- infinity as constant of integration is a valid value and allowed. So my question is, does Maple have methods to find these non finite value solutions or must one find them manually using limit and trial and error? which is what I do now.

@Athar Kharal 

fyi, updated answer. I changed both to select member. I do not know if "has" is slower or faster than "member" or "in" commands. You could do your own timing and decide which is faster. I changed the first one to also use "member" instead of "has".

@Carl Love 

I just realized I was causing all these trouble with signum myself. Sometimes when simplifying an expression using the assumption real, these signum now show up in the result. The result is not much simpler anyway, but I get some signums showing up.

I should not using simplify with real much anymore. I have to be careful when to use it. Here is an example

r:=(x^2-6)^(1/2)/(x^2-4)^(1/4)*(x+(x^2-4)^(1/2))^(1/(x^2-4)^(3/2)*((x^2-4)^3)^(1/2)*3^(1/2))*exp(-1/2*((x^2-4)^3)^(1/2)*(arctanh(1/2*(2^(1/2)*3^(1/2)*x-4)*2^(1/2)/(x^2-4)^(1/2))+arctanh(1/2*(4+2^(1/2)*3^(1/2)*x)*2^(1/2)/(x^2-4)^(1/2)))/(x^2-4)^(3/2));

Now

simplify(r) assuming real

having signums there causes odetest to fail in many cases. So the fix is not to using simplify with real assumption before.

So now I do not have to do anything to get rid of signum since it no longer shows up in the first place.

I also noticed using simplify with the size option does not cause this problem even when using real (even though in this example, the size does not change, but at least no signums show up)

simplify(r,size) assuming real

 

I do not know why simplify thinks that having signum() show up is considered "simpler" than before. (may be due to removing the sqrt at the cost of replacing it by signum). I prefer to see the sqrt than signum.  I did not notice this before.

someone who knows where to look in the code could probably find out for sure, but my guess it does both. May be it stores Pi for million digits or 1000 digits. But if more digits are needed, there are algorithms that quicky find Pi for any number of digits needed, such as Spigot_algorithm

Same for Euler constant.

First 7 8 9 10 11 12 13 Last Page 9 of 71