nm

3646 Reputation

17 Badges

7 years, 362 days

MaplePrimes Activity


These are questions asked by nm

I need to check if expression is "special" kind of polynomial. Where powers are allowed to be non-integers and can be fractions. This is not polynomial in the mathematical sense ofcourse so can not use type(expr,polynom) on it, and did not see a way to tell type(expr,polynom) to accept non-integer exponents.

For an example, given p(x):=x^2+x^(1/3)+3+sqrt(x)+x^Pi+1/x*sin(x): it will return false, due to sin(x) term there. Without this term, it will return true, since all other terms have the form x^anything.

Currently, this is what I do

expr:=x^2+x^(1/3)+3+sqrt(x)+x^Pi+1/x*sin(x):

if type(expr,polynom(anything,x)) then
   print("Yes, normal polynomial");
else
   what_is_left:=remove(Z->type(Z,{`^`('identical'(x),algebraic),'identical'(x)}),expr);
   if has(what_is_left,x) then
      print("Not special polynomial");
   else
      print("Yes, special polynomial");
   fi;
fi;

While with

expr:=x^2+x^(1/3)+3+sqrt(x)+x^Pi+1/x:

It will print "Yes, special polynomial"

Is the above a good way to do this, or do you suggest a better way? It seems to work on the few tests  I did on it so far.

It is always "polynomial" in one symbol, such as x. So if it contains any function of x, other than  x^exponent, where exponent can only be numeric, or other symbol, it will fail the test. So this below will pass the a above test as well

expr:=x^2+x^(1/3)+3+sqrt(x)+x^a+1/x:

 

I was just praising Maple for not rewriting/simplifying  expressions automatically without the explicit user asking for it, when I found the following strange result

expr:=arccos(a-p) does not cause any change in the input. Good.

But when I change the letter ordering to expr:=arccos(p-a) now Maple changed it to Pi - arccos(a - p)

I have no idea why. Is there an option to tell Maple not to do that, even if it is mathematically correct? 

restart;
expr:=arccos(a-p);

restart;
expr:=arccos(p-a);

It seems to use lexicographical ordering to re-write things. Is it possible to turn that off?  Notice that I did not ask for simplification or anything. 

Maple 2020.1, Physics 724

I was checking my solution against Maple. Maple gives solution with integral and RootOf. I am not able to simplify it to better compare.

restart;
ode:=y(x)=ln(cos(diff(y(x),x)))+diff(y(x),x)*tan(diff(y(x),x));
sol:=dsolve(ode);

It is the second solution above I want to simplify/evaluate. So I tried

restart;
ode:=y(x)=ln(cos(diff(y(x),x)))+diff(y(x),x)*tan(diff(y(x),x));
sol:=dsolve(ode);
sol:=[sol][2];
DEtools:-remove_RootOf(sol)

But this did nothing. Then I tried adding useint in the dsolve command

restart;
ode:=y(x)=ln(cos(diff(y(x),x)))+diff(y(x),x)*tan(diff(y(x),x));
sol:=dsolve(ode,useint);

But this also kept the integral there. Then I tried eval

restart;
ode:=y(x)=ln(cos(diff(y(x),x)))+diff(y(x),x)*tan(diff(y(x),x));
sol:=[dsolve(ode,'explicit')];
eval(sol[2])

The solution I obtained is 

y(x) = -ln(_C1^2 - 2*_C1*x + x^2 + 1)/2 + ((-2*x + 2*_C1)*arctan(-x + _C1))/2

Which does verify to zero OK using odetest.

Any suggestions/tricks to use to get an more explicit solution from Maple I am overlooking?

Maple 2020.1 , Physics 724

I can post/attach my full solution if needed. 

 

 

I solved this ODE and got a solution and wanted to compre it with Maple. This is initial value first oder ODE. So it should have no constants in it. But Maple's solution contains something I never seen before _B1~

I wonder what it means? And odetest did not verify Maple's solution. 

restart;
ode:=diff(y(x),x)-y(x)/x+csc(y(x)/x)=0;
sol:=dsolve([ode,y(1)=0]);
simplify(odetest(sol,ode));

odetest does not gives zero.

This is my solution

mysol:=y(x)=x*arccos(ln(x)+1);
odetest(mysol,ode)

   0

Any idea what _B1~ means? The ~ looks like it is an assumed variable? may be leaked from inside Maple.

Maple 2020.1 on windows 10

 

I use odeadvisor a lot to tell me the type of the ode. It is one of the best tools in Maple.

But sometimes it overlooks some types of ODE's, if the ODE is written in different way. This does not happen alot. Here is an example

ode:=diff(y(x),x) = (2*x+y(x))/(3-x+3*y(x)^2);
DEtools:-odeadvisor(ode)


And advisor says it is rational, which is correct. 

But it does not also say it is exact. By rewriting as follows, it now see it is exact as well as rational:

ode2:=(denom(rhs(ode)))*diff(y(x),x)-(numer(rhs(ode)))=0;
DEtools:-odeadvisor(ode2);

And now it says [_exact, _rational]. It is the same ODE, just written different.

This is not a complaint about the advisor, I know it is not easy to figure the type of the ODE under different trasformations, but may be something to look into to improve it to be able to detect more types.

Maple 2020.1 

1 2 3 4 5 6 7 Last Page 1 of 82