nm

11353 Reputation

20 Badges

13 years, 20 days

MaplePrimes Activity


These are questions asked by nm

why   print(lastexception);  gives `[Length of output exceeds limit of 1000000]` while just doing lastexception; gives no problem?

 

restart;
eq:=x*y*p = y^2+x*(4*x^2+y^2)^(1/2);
try
   sol:= timelimit(20,`assuming`([solve(eq,y)],[real]));
catch:
   print(lastexception);
end try;
lastexception

I know one should use something like

print(StringTools:-FormatMessage( lastexception ))

But I do not know why print(lastexception) gives the length exceeds error. 

whattype(lastexception) gives exprseq

 

Maple 2020.1

 

Just wondering why

restart;
x:=2*{};
has(x,{})

Clearly {} is special. But is there a way to make it return true? 

 

Maple's infolevel is very nice feature, good for learning.

But I'd like to see more steps/info sometimes. Using infolevel set to max 5, does not show everything I like to see. Is there a way to print more info?

This is what I am   interested in. dsolve goes into Kovacic algorithm to solve second oder ODE. This algorithm is general algorithm to solve second oder linear ODE. 

https://www.sciencedirect.com/science/article/pii/S0747717186800104

restart;
infolevel[dsolve]:=5;
ode:=x^2*diff(diff(y(x),x),x)+x*diff(y(x),x)+(x^2-1/4)*y(x)=0;
dsolve(ode)

Changing printlevel to high value, does not really help here. It just prints lots of stuff I am not interested in.

What othere options are there to show more information about flow of logic, like the above?

I do not even know how to trace Kovacic code in Maple, since do not know what function/proc it is in without having to step though dsolve, which could take very long time to reach this specfic proc.

Is it possible to have Maple print the name of each proc it enter and leaves as it runs? That will be very useful addition added to printlevel. 

 

I have set of assumptions. The set happend to be empty at  time I used it. I forgot to change the set to list when calling assuming. This cased 'numeric exception: division by zero'
 

Is this normal and expected?

restart;
u1:=-ln(csc(x)-cot(x));
the_assumptions_on_x:={};
`assuming`([simplify(u1)],[the_assumptions_on_x])

Error, (in assuming) when calling 'signum'. Received: 'numeric exception: division by zero'
 

I fixed my code to use list at time of the call and the error went away

restart;
u1:=-ln(csc(x)-cot(x));
the_assumptions_on_x:={};
`assuming`([simplify(u1)],convert(the_assumptions_on_x,list))

The question is, why passing {} caused division by zero? 

Maple 2020.1

 

I found there is assume=[...] syntax. So I changed my code to use it, instead of .... assuming 

Now I find that some tests fail.  Should assuming and assume not give same result?

restart;
sol :=y(x)^(1/2) = -1+2*exp(x):
ode:=diff(y(x),x)-2*y(x) = 2*y(x)^(1/2):

odetest(sol,ode) assuming x::real, x>0

gives 0

but

odetest(sol,ode,assume=[x::real, x >0])

does not give zero. Please see screen shot below.

Reason I changed, since I started saving assumptions to use in a list. So it was easier to use assume=[....] than assuming ...., since assuming wants expression sequence in front of it and I did not know how to convert the list of assumptions I have collected to an expression sequence on the fly to use assuming, otherwise I would not have changed the code.

But my question is: Should both give same result? Why is the result different?

Help says

The assume routine sets variable properties and relationships between variables. Similar functionality is provided by the assuming command.

I am probably not using assume= correctly.   I thought I could use the same thing I had on assuming, just put it in a list. 
 

First 115 116 117 118 119 120 121 Last Page 117 of 199