nm

11363 Reputation

20 Badges

13 years, 38 days

MaplePrimes Activity


These are questions asked by nm

I noticed some problems with pdsolve in 2020. Using Maple 2020 on windows 10 with latest Physics 626.

This PDE now hangs when the timeout is increased. This does not happen in Maple 2019.2.1/
 

restart; 
pde := diff(w(x,y),x)+(a*sin(lambda*x + mu)^k * (y-b*x^n -c)^2 + y - b*x^n + b*n*x^(n-1) - c)*diff(w(x,y),y) = 0; 
cpu_time := timelimit(60*5,CodeTools[Usage](assign('sol',pdsolve(pde,w(x,y))),output='realtime'));

In Maple 2019.2 it gives

    Error, (in trig/reduce/reduce) time expired

Which is good. Since I can now go on to the next PDE.

The hang goes away in Maple 2020 when small timeout is used.  For example I just tried 30 seconds timeout instead of 300 or more seconds and it did expire ok.

This tells me that it depends where it was in the kernel at the time. But as a user, I have no way to control this and so I use the same timeout for all the problems.

Do others using Maple 2020 see the same issue? I know that the timeout does not happen at exactly the same amout given, but for this one, I waited for almost 40 minutes and it still did not time out.

Is this a new bug and is there a better way to handle this other than using timelimit()?

Thank you

This behavior by Maple is completely wrong if you ask me.

But given this is how Maple works, the question I have is how to explictly close a file opened by call to readline()?

I have a proc(), where inside it, it wants to read say first 3 lines by calling readline("input.txt") on a file. Then the proc() returns back to caller.

The first call reads the first 3 lines from the file OK.

I expected all resources to be removed after the call returns, including any files opened to be automatically closed. So next time proc() is called, I expected the first 3 lines to be read again.

It turns out the next time  proc() is called, now lines 4,5,6 are read. This is becuase the file remained open between calls!  Only way to close the file is to call restart() on the whole session. But I do not want to do this. 

Looking at help, I see no method to explicity close the file other than reading all the lines.

How does one explicitly close a file opened by readline() without reading the whole file?

Here is example

restart;

foo := proc()
local n,current_line;

   for n from 1 to 3 do
       current_line:= readline("input.txt");
       print("line read is ",current_line);
   od;
end proc;

And now the above is called as follows

currentdir("C:\\test"); #change as needed
foo()
                   "line read is ", "line 1"
                   "line read is ", "line 2"
                   "line read is ", "line 3"

Next call

foo()
                   "line read is ", "line 4"
                   "line read is ", "line 5"
                   "line read is ", "line 6"

Where input.txt is 

line 1
line 2
line 3
line 4
line 5
line 6

I know how to do all this using fopen() and fscanf() and explicit fclose(). I also know I can use FileTools package.

But wanted to check first if readline() will do what I wanted more easily if I can figure how to close the file explicitly.

I just updated to Maple 2020

interface(version)

Standard Worksheet Interface, Maple 2020.0, Windows 10, March 4
   2020 Build ID 1455132

Physics:-Version()
         The "Physics Updates" package is not installed

My question is: For new Maple 2020 installation, should one go and install latest Physics package from the cloud, which I see is at version 619 now, or is it allready included in the new Maple 2020?

 

 

 

 

 

 

I was trying this in Maple to check Mathematica's result, and got this error. But googling and the link Maple gives lead to nothing.

Any one knows why Maple gives this error message here?

restart;

phi:=Pi;
A := <
          <0, 0, exp(I*k1) + m1, exp(I*k2) + m2>|
          <0, 0, exp(I*phi)*(exp(-I*k2) + m2), exp(-I*k1) + m1>|
          <exp(-I*k1) + m1, exp(-I*phi)*(m2 + exp(I*k2)), 0, 0>|
          <exp(-I*k2) + m2, exp(I*k1) + m1, 0, 0>
     >:
LinearAlgebra:-Eigenvectors(A)

Error, (in LinearAlgebra:-Eigenvectors) multiplicity mismatch

 

fyi, Mathemtica's result is

ClearAll[k1, m1, m2, k2];
Phi = Pi;
H = {{0, 0, Exp[I k1] + m1, Exp[I k2] + m2}, {0, 0, 
    Exp[I Phi] (Exp[-I k2] + m2), Exp[-I k1] + m1}, {Exp[-I k1] + m1, 
    Exp[-I Phi] (m2 + Exp[I k2]), 0, 0}, {Exp[-I k2] + m2, 
    Exp[I k1] + m1, 0, 0}};
Eigenvectors[H]

 

I tried tracing in Maple, but so far no useful result:

infolevel[all]:=5;
LinearAlgebra:-Eigenvectors(A)

.
.
.
simplify/size: [1/(2+m1^2+m2^2+2*m1*((1/2)*exp(I*k1)+(1/2)*exp(-I*k1))+2*m2*((1/2)*exp(I*k2)+(1/2)*exp(-I*k2)))^(1/2) exp(-I*k1) exp(-I*k2) exp(I*k1) exp(I*k2) _t[1] _t[2] m1 m2 k1 k2]
simplify/size: [exp(-I*k1) exp(-I*k2) exp(I*k1) exp(I*k2) m1 m2 _t[1] _t[2] k1 k2]
simplify/size: [1/(2+m1^2+m2^2+2*m1*cos(k1)+2*m2*cos(k2))^(1/2) exp(-I*k1) exp(-I*k2) cos(k1) cos(k2) _t[1] _t[2] m1 m2 k1 k2]
simplify/do: applying  commonpow  function to expression
simplify/do: applying  power  function to expression
simplify/do: applying simplify/size function to expression

Error, (in LinearAlgebra:-Eigenvectors) multiplicity mismatch

 

Maple 2019.2.1 on windows

 

I'd like to solve this ODE

But not sure how to write it in Maple. In Mathematica, this is what I do

ClearAll[F, x, y, t];
ode = D[F[x[t], y[t]], x[t]]*D[x[t], t] + D[F[x[t], y[t]], y[t]]*D[y[t], t] == 0;
DSolve[ode, F[x[t], y[t]], {x[t], y[t]}]

and it gives

In Maple, I tried

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

Error, invalid input: diff received x(t), which is not valid for its 2nd argument

ode:=D[1](F)(x(t),y(t))*diff(x(t),t)+D[2](F)(x(t),y(t))*diff(y(t),t)=0;
dsolve(ode,F(x(t),y(t)))

Error, (in dsolve) expected the indeterminate function as, say, F(x) where x is of type "name" - and also cannot be a procedure name. Received: [F(x(t), y(t))]

 

What is the correct way to write this in Maple?

 

 

First 131 132 133 134 135 136 137 Last Page 133 of 200