nm

8552 Reputation

19 Badges

12 years, 352 days

MaplePrimes Activity


These are replies submitted by nm

@vv 

thanks. But it does not give same answer as solve for examples 1 and 2 I posted above. Is your proc P meant to work for any f(x,y) or that one specific example you used it on?

#example 1
restart;
f:=(x,y)-> 3*sqrt(x*y);
eq:= subs([x=alpha*x,y=alpha^p*y],f(x,y))- alpha^(p-1)*f(x,y)=0;
PDEtools:-Solve(eq,p) assuming alpha>0;
    # p=3

P := (F,x,y)-> simplify(((-x*diff(F,x,x)-diff(F,x))*F+diff(F,x)^2*x)/(y*(F*diff(F,x,y)-(diff(F,x))*(diff(F,y))))):
P( f(x,y), x,y);
    #  -1  

it gives -1, but p=3 for this example.

#example 2
restart;
f:=(x,y)-> 4*(x*y)^(1/3);
eq:= subs([x=alpha*x,y=alpha^p*y],f(x,y))- alpha^(p-1)*f(x,y)=0;
PDEtools:-Solve(eq,p) assuming alpha>0;

   # p=2

P := (F,x,y)-> simplify(((-x*diff(F,x,x)-diff(F,x))*F+diff(F,x)^2*x)/(y*(F*diff(F,x,y)-(diff(F,x))*(diff(F,y))))):
P( f(x,y), x,y);

  #-1

it gives -1, but p=2 for this example.

But for example 3,4,5 I posted, it does give correct p.

May be I am not using your P function correctly, as I do not understand how you came up with it now. I just copied it as is and used it.

How does it tell if the function is not isobaric?  Since not all functions are ofcourse. 

 

@Kitonum 

thanks. will look at  SolveTools:-SemiAlgebraic. Never used it before.

 

@Carl Love 

Are A and B always polynomials? 

No, not necessarly. For example, 

But for now, we can assume they are polynomials as a starter. That would be OK. I just wanted to see if Maple have some hidden command to do this. 

 

@Kitonum 

thanks. This looks better. I need to test it more. But it works on the few ODE's I tried it on now with with initial conditions that odetest did not verify.

If I find any problem, will add a new note here.

@Kitonum 

Thank you. This looks promissing. I am studying and testing it. But on some ode's where odetest do not give zero it gives an error. 

Here is an example

restart;
ode:=diff(y(x),x)-y(x) = x*y(x)^(1/2):
ic:=y(0)=4;

#this below code from https://www.mapleprimes.com/questions/231328-How-To-Make-Solve-Obtain-All-Values

sol:=dsolve([ode,ic],y(x));
res:=odetest(sol,ode);
F:=indets(res, function);
R:=[solve(`and`(seq(`or`(F[i]>0, F[i]<0, F[i]=0), i=1..nops(F))))]; # The domain of res
solve(res) assuming `or`(seq(x in R[i],i=1..nops(R)));

 

 

@Kitonum 

Yes I know. But you are assuming one is sitting on the screen and looking at the output and seeing the expression. This is all done in code. The function gets an expression in x, and wants to know domain of x which makes it zero. assumption is only that x is real.

I could add code to check for ln, but again, this goes down in spiral very quickly where now it has to check for all sort of differenent functions and cases. Which is what I do now.  Sometimes it works on one expression and sometimes not work on another, since the result of odetest, when it is not zero, could be anything.

I should make a call to Mathematica's Reduce from Maple. I actually wrote a function to do that. It can call Mathematica from Maple and gets back the result, translates it to Maple syntax using Maple's FromMma and use the result.  Only problem is that it is a little slow since it has to call system(), starts a Mathematica process, each time for each one call. The expression from Maple to Mathematica is send as Latex. Since Mathematica can convert Latex to Mathematica expression and use it. It works, but not very reliable method of communication. One day I should wrote a note about this showing how it works.

 

 

@Kitonum 

But I do not know before hand for what possible values of x the result is zero.  That is the whole point of my question. 

I need Maple to tell me that. The assumption x>0 worked in this example. But might not work for other cases. Below is an example where it does not work

Currently actually I try this also myself, but it is a hit and miss.  I trt x>0 and x<0 and so on, until I get solution.

I need Maple to tell me the domain of x which an expression is zero. The only assumption is that x is real.

Example where x>0 assumption do not work

restart;
ode :=diff(y(x),x)=2*(x*sqrt(y(x))-1)*y(x):
ic  :=y(0)=1:
sol :=dsolve([ode,ic]):
res :=odetest(sol,ode);
solve(simplify(res)) assuming x>0

No solution.

But solve(simplify(res)) assuming real works here.

That is what I mean by hit and miss. 

@Kitonum 

"The output of the second example seems to me incorrect:"

I do not see anything wrong with the answer given by Maple. The ode is y(x)+y'(x)=0 and solving for y(x) gives y(x)=-y'(x). Why is this wrong? 

I do not understand at all what is the point of applying the  solve  command to a differential equation

Ok, this is a separate issue really. But I will happy to try to explain why the program does this.

Some ode's have the form of y(x)=f(x,y'(x)).  For example, the Clairaut or d’Alembert (Lagrange) ODE's can be recognized when in this form. An example of  the Clairaut ODE is x*y'(x)-y(x)*y'(x)=1 but to detect if it is Clairaut, the program solves for y(x) and checks if the solution is of the form x*y'(x)+f(y'(x)).  If it is, then it calls the Clairaut ode solver.

https://en.wikipedia.org/wiki/D%27Alembert%27s_equation

An example of d’Alembert ode is (y'(x))^2-1-x-y(x)=0 . To detect it is d’Alembert the program solves for y(x) and checks if the solution of the form x*g(y'(x))+f(y'(x)) where f,g are functions of y'(x). If it is, it calls the d’Alembert ode solver.

This is the reason why the program needs to solve for y(x), as part of determining the type of ODE. 

So it first converts the ODE to D, using the convert() command, before calling solve(), since solve does not work on equation that has both diff(y(x),x) and y(x) in it, but it works after conversion to D.

 

 

@Kitonum 

Thank for the suggestion of possible explanation. But this can not be the correct reason for the error.

I am well aware that one can not have diff(y(x),x) in the equation, and also solve for y(x). This is why I changed the ODE to D(y)(x) before calling solve.

I have been using this same code for over a year now and run my program over many thousands of ODE's, hundreds of times by now, and never saw such an error. This is the first time I see this error.

You could try it yourself. 

restart;
interface(warnlevel=4):
kernelopts('assertlevel'=2):
eq:=exp(x)*sin(y(x))-3*x^2+(exp(x)*cos(y(x))+(1/3)/y(x))*(D(y))(x) = 0;
timelimit(30,solve(eq,y(x)));

No errror. If you like me to post 4,000 more examples I have that does the same thing and give no error, I will be happy to, but one can pick any random ODE and do the same thing, i.e. solve for y(x) after converting the diff to D, and it works.

restart;
interface(warnlevel=4):
kernelopts('assertlevel'=2):
ode:=diff(y(x),x)+y(x)-x=0;
eq:=convert(ode,D);
timelimit(30,solve(eq,y(x)));

If your theory is correct, then could you please explain why it works in the almost 4,000 other ODE's I have in my collection, and been running it for over a year with no error, but it failed on this specific equation I just added last night?

 

This is what I get on 2020.2

Are you sure it is (sin(t)^2)^exp(t) and not (sin(t)^2)*exp(t) ?

Need to use numerical integration. But Maple have hard time with numerical integration when x starts at some points vs. others. 

I tried it in Mathematica, and it can do it for all points (numerically).

May be there are other options to make Maple integrate this numerically. I only tried the basic int command with numeric option. Here is Mathematica result (do not know if it accurate or not)

 

It doesn't seem that Maple has a built-in procedure to construct the syntactic graph of a mathematical expression.
But maybe I'm wrong?

I think you are correct. This is build-in Mathematica. It is called TreeForm

Here is the result applied to your example

It will be useful to have this in Maple as well. Maple's  dismantle is not the same, and it is more like Mathematica's other command called FullForm

@acer 

 Are they the same?

No. The result from Rubi was not automatically simplified optimally. FullSimplify was needed to simplify it more.

@Parham2016 

"there was not the function of InverseJacobiAM, but your second solution did include it."

This is how Maple translated the Mathematica output. 

But if you say you have Mathematica itself allready, why not run Rubi there and see the solution I posted for yourself? You can install Rubi from the here

 

Any way, please find Rubi integrate output below. I just asked Maple to translate it.

Get["Rubi`"]; 
integrand = ((k/2)*x^2 + x + c)/Sqrt[lambda^2*(1 + k*x)^4 - ((k/2)*x^2 + x + c)^2]; 
sol = FullSimplify[Int[integrand, x]]

it gives

-((Sqrt[-4*c^2 + 4*lambda^2*(1 + k*x)^4 - 4*c*x*(2 + k*x) - x^2*(2 + k*x)^2]*(2*Sqrt[-1 + 2*c*k]*(1 - 4*k^2*lambda^2)^(1/4)*(1 + k*x)*
      Sqrt[(k^2*(4*c^2 - 4*lambda^2*(1 + k*x)^4 + 4*c*x*(2 + k*x) + x^2*(2 + k*x)^2))/(-1 + 2*c*k + Sqrt[1 - 4*k^2*lambda^2] + 
          k*Sqrt[1 - 4*k^2*lambda^2]*x*(2 + k*x))^2] + (2 - 4*c*k)*EllipticE[2*ArcTan[((1 - 4*k^2*lambda^2)^(1/4)*(1 + k*x))/Sqrt[-1 + 2*c*k]], 
       (1/2)*(1 - 1/Sqrt[1 - 4*k^2*lambda^2])] + (-1 + 2*c*k)*(1 + Sqrt[1 - 4*k^2*lambda^2])*
      EllipticF[2*ArcTan[((1 - 4*k^2*lambda^2)^(1/4)*(1 + k*x))/Sqrt[-1 + 2*c*k]], (1/2)*(1 - 1/Sqrt[1 - 4*k^2*lambda^2])]))/
   (2*Sqrt[-1 + 2*c*k]*(1 - 4*k^2*lambda^2)^(3/4)*(-1 + 2*c*k + Sqrt[1 - 4*k^2*lambda^2] + k*Sqrt[1 - 4*k^2*lambda^2]*x*(2 + k*x))*
    Sqrt[(k^2*(4*c^2 - 4*lambda^2*(1 + k*x)^4 + 4*c*x*(2 + k*x) + x^2*(2 + k*x)^2))/
      (-1 + 2*c*k + Sqrt[1 - 4*k^2*lambda^2] + k*Sqrt[1 - 4*k^2*lambda^2]*x*(2 + k*x))^2]))

To translate the above to Maple, copy it to your Maplework sheet, and put ` and ` on each side of the expression and then call MmaTranslator on it as shown in the screen shot above. Maple will translate the above Mathematica expression to Maple syntax.

 

@lcz 

Yes, in Mathematica one can do this

ls[[1 ;; -1 ;; 2]]

But same thing is not possible in Maple. At least I could not figure how to do it. One can only take a slice, with increment of one, as in

ls[1..nops(ls)]

But not using different increments, say by 2

ls[1..nops(ls),2]

That is why seq is needed.

 

First 22 23 24 25 26 27 28 Last Page 24 of 71