nm

8552 Reputation

19 Badges

12 years, 354 days

MaplePrimes Activity


These are replies submitted by nm

@ecterrab 

thanks for the explanation. Now I understand better. But this behaviour do not happen all the time with odetest, otherwise I would have noticed it long time ago. I run thousands of ODE solutions via odetest to check if I get the solution correct.

Only few had this issue that is why I thought there was a problem. 

For example

ode:=-1/2*y(t)+diff(y(t),t) +3*A= 2*cos(t);
sol:=dsolve(ode,y(t));
sol:=subs(_C1=C[1],sol);
odetest(sol,ode)

The above gives 0 even though I changed _C1 to C[1] in the solution.

 

But it is no problem for me now. I simply change C[1] to _C1 before calling odetest and now it works with no problem

Thanks



 

@vv 

let me make sure I understand. You are saying given an exact A+B*y'=0 then A/B+y'=0 can no longer be exact? Just by rewriting it, Even if it is the same ODE? 

I'll have to ask the teacher at school about this.

 

@acer 

You are using `frontend` quite differently from both what I suggested earler and what I put in my answer. Why!?

When I updated my answer, I have not yet seen your answer. I saw your answer afterwords.

As I mentioned, I never used frontend before, and that was my first attempt at using this command. 

 

 

@Rouben Rostamian  

Yes. I read that. But notice it says The sign function works for polynomials  and not The sign function works ONLY for polynomials

Also, before that help says The sign function computes the sign of the leading coefficient of expr.

But If the sign function is not the right tool, what else to use?  One thing I thought about  to try is this: convert the expression to a string, and simply look at the first non white character in the string generated to see if it is a "-" or not.  I will try that next.

@Rouben Rostamian  

fyi, There is a bug in the above method.

restart;
ode:=(x+y(x))*diff(y(x),x)=0
 

(x+y(x))*(diff(y(x), x)) = 0

selectremove(has, (lhs-rhs)~(ode), diff(y(x),x));
ode_new := %[1] = - %[2];

diff(y(x), x), x+y(x)

diff(y(x), x) = -x-y(x)

 


 

Download bug_08_21_2019.mw

 

 

@ecterrab

None of the textbooks I looked at mention difference between "essential" or none "essential" singular solution.

They say simply that singular solution is envelope of the general solution. One which can not be obtained by specifying specific value for constant of integration in the general solution.

 

A solution found by specifying a value of the constant of integration is normally called in the textbook a particular solution and not a non-essential singular solution if I understand the Maple term you are using.

So this term non-essential singular solution is something I never heared before.

But in this sense, when I say singular solution, I mean "essential singular solution" using Maple terminology.

Maple does not return "essential singular solution" all the time. For example, for  y(x) = y' x - sqrt(y' a) There is one singular solution, Which Maple does not show. I solved it by hand. (I can post my hand solution if you like also).

Maple returns the general solution only even when using singsol=all

Here is another one from a text book. The book shows the singular solution, which maple does not show. I put a screen shot of the solutioin given from the book for your consideration.  It shows singular solution which Maple does not return even when setting singsol=all.

 

ode:=y(x)=x*diff(y(x),x)+ a*diff(y(x),x)/sqrt(1+ diff(y(x),x)^2 )

y(x) = (diff(y(x), x))*x+a*(diff(y(x), x))/(1+(diff(y(x), x))^2)^(1/2)

DEtools:-odeadvisor(ode);

[_Clairaut]

dsolve(ode,singsol =all); #where is the singular solution

y(x) = _C1*x+a*_C1/(_C1^2+1)^(1/2)

dsolve(ode,singsol =essential)

y(x) = _C1*x+a*_C1/(_C1^2+1)^(1/2)

 

 

I do not see how one can obtain the singular solution shown above from the general solution by giving a specific value for _C1? As the general solution are straight lines, while the envelope (the singular solution) is curved.

Thank you for any hints on how to obtain the above singular solution shown in the book.

Download missing_singular_2.mw

 

 

@tomleslie 

"However if you are partcularly interested in singular solutions, then it is probably a good idea to make this requirement explicit."

The above does not always work. Here is a case I found where even when using singsol=all Maple does not show the signular solution for the ODE when written in different form (breaking it into two sets of Clairaut ODE's instead of one). There is a problem somewhere why Maple sometimes shows singular solutions and sometimes it does not.

 

restart;

Typesetting:-Settings(typesetprime=true):

ode:=x^2*diff(y(x),x)^2-(a+2*x*y(x))*diff(y(x),x)+y(x)^2 = 0;

x^2*(diff(y(x), x))^2-(a+2*x*y(x))*(diff(y(x), x))+y(x)^2 = 0

DEtools:-odeadvisor(ode)

[[_homogeneous, `class G`], _rational, _Clairaut]

Vector([dsolve(ode,y(x))]); #now it shows singular solution (first one below)

Vector(3, {(1) = y(x) = -(1/4)*a/x, (2) = y(x) = _C1*x-sqrt(_C1*a), (3) = y(x) = _C1*x+sqrt(_C1*a)})

PDEtools:-casesplit(ode)

`casesplit/ans`([(diff(y(x), x))^2 = (2*y(x)*(diff(y(x), x))*x+(diff(y(x), x))*a-y(x)^2)/x^2], [2*(diff(y(x), x))*x^2-2*x*y(x)-a <> 0]), `casesplit/ans`([y(x) = -(1/4)*a/x], [])

ode:=convert(ode,D): #solve for y(x) first, this will generate 2 ODE's
sol:=[solve(ode,y(x))]:
odes:=Vector(map(z->y(x)=z,convert(sol,diff)))

Vector(2, {(1) = y(x) = (diff(y(x), x))*x+sqrt((diff(y(x), x))*a), (2) = y(x) = (diff(y(x), x))*x-sqrt((diff(y(x), x))*a)})

DEtools:-odeadvisor(odes[1]);

[[_homogeneous, `class G`], _rational, _Clairaut]

dsolve(odes[1],y(x),singsol=all); #where is singular solution?

y(x) = _C1*x+(_C1*a)^(1/2)

dsolve(odes[2],y(x),singsol=all); #where is singular solution?

y(x) = _C1*x-(_C1*a)^(1/2)

PDEtools:-casesplit(odes[1])

`casesplit/ans`([diff(y(x), x) = (y(x)-((diff(y(x), x))*a)^(1/2))/x], [2*x*((diff(y(x), x))*a)^(1/2)+a <> 0]), `casesplit/ans`([(1/2)*(a^2/x^2)^(1/2) = -(1/2)*a/x, y(x) = -(1/4)*a/x], [])

PDEtools:-casesplit(odes[2])

`casesplit/ans`([diff(y(x), x) = (y(x)+((diff(y(x), x))*a)^(1/2))/x], [2*x*((diff(y(x), x))*a)^(1/2)-a <> 0]), `casesplit/ans`([(a^2/x^2)^(1/2) = a/x, y(x) = -(1/4)*a/x], [])

 


 

Download missing_singular.mw

@Thomas Richard 

Yes, this is what I did also. I simply forgot to mention it after playing with it for a while.

First thing I do always when using exact solvers like pdsolve or dsolve is convert all numbers to be exact. I do this by habit. Then run the code. 

 

@Christian Wolinski 

I see that 

indets(expr, 'ln(anything)')

works. This is little strange, since second argument should be type name. I did not now that ln(anything) is a name of type. I know that anything is, but not ln(anything).

Btw, Is there a reason why you did not just type the above? I do not know what Frontend and the other commands you used are. Little too advanced for me at this stage. But good to know that 'ln(anything)' works as well.

@Carl Love 

so I had a typo all this time. spend more than 30 or 40 minutes because of a typo :)  

I wish Maple complained, but it took the command and said nothing. 

The problem was I typed ?specfun and got the help page open, and because of this I did not notice I needed extra "c". I need better glasses.

No error here.  Maple 2019.1 with Physics 395.

It does not solve it. But no error either.

@ecterrab 

Thanks for the information. You said "The discussion about general versus singular cases is standard in the literature (most textbook on DEs talk about them, Clairaut's equation is one example)."

Actually, the ones I've seen just give the definition and say that singular solutions are ones that can't be obtained from general solution by giving specific values to the constant of integrations. But they do not show how to actually find them in algorithimc way.

I found one old book that shows how to do it for Clairaut, that is how I knew this.

Another book I found that even tries to show how to find singular solutions in general,  is called "differential and integral calculus, vol 2, by N. Piskunov".  around page 40. When he talkes about finding envelope of the family of solutions. The envelope is the singular solution. But it was brief discussions, only 4-5 pages and little hard to follow for me and did not know how to implement it yet.

If you know of a book that talk more about how to actually find singular solutions for ODE's (if they exist), with examples, that would be great. I would buy it.  (may be you could write one :)

I asked once a teacher at school about this subject, but they did not know much about this either.  I'll look at PDEtools:-casesplit, and see if I can trace it to learn how. But even though one can see Maple source code, I find it very hard to follow and understand still as it is way too advanced and there are no comments in it to read and understand what it is doing.

 

 

@Rouben Rostamian  

For the first one I got y(x)=sin(x+C1), y(x)=-sin(x+C1)

And for the second got y(x)=-x^2/2, and y(x)=C1*(2*x+C1)/2 just like Maple, since this is Clairaut and I happened to know how to find special solution for this one.

For the first, I did not find y(x)=-1,y(x)=1 like Maple did.

I do not think the teacher will take too much marks off if one does not find those special solutions for each ODE.

The text book does not even mention how to find these, and I do not know how Maple finds these. Book only talks about finding general solutions and that is what I care about now.

@vv 

Ok, that is good example. So both my solution and Maple's are correct then. Just that one form allows Maple to "see" more special solutions than mine. 

 

@vv 

I am confused. I am trying to find out what if anything I did wrong. If doing this by hand, and one solves for y'(x) first, then solves the resulting ODE, the solution is y(x)=C x^(3/2).  

This is what I do for each ODE, to put it in the form y'=F(x,y) before solving it.  I do not actually understand how Maple got the solutions it did. If I know, I would try to duplicate it.

How could moving one expression from one side of the equation to the other side results in different solution? If some cancelations happens when doing this that should not have happened, then Maple would not have done the cancelation, right? I did not using any  assumptions when doing this either.

So my solution is correct, And so is Maple's. But which one would be considered the "better" one?  or the more "correct" one? and why? If both solutions are equally correct, then I am OK with that, and will just continue to do what I have been doing.
 

restart;

Typesetting:-Settings(typesetprime=true):

ode:= 1/2*(2*x^(5/2)-3*y(x)^(5/3))/x^(5/2)/y(x)^(2/3)+1/3*(-2*x^(5/2)+3*y(x)^(5/3))*diff(y(x),x)/x^(3/2)/y(x)^(5/3) = 0;

(1/2)*(2*x^(5/2)-3*y(x)^(5/3))/(x^(5/2)*y(x)^(2/3))+(1/3)*(-2*x^(5/2)+3*y(x)^(5/3))*(diff(y(x), x))/(x^(3/2)*y(x)^(5/3)) = 0

#do it by hand. Solve for y'(x)
the_rhs:= - (2*x^(5/2) - 3*y(x)^(5/3))/(2*x^(5/2)*y(x)^(2/3))*((3*x^(3/2)*y(x)^(5/3))/(-2*x^(5/2) + 3*y(x)^(5/3)))

-(3/2)*(2*x^(5/2)-3*y(x)^(5/3))*y(x)/(x*(-2*x^(5/2)+3*y(x)^(5/3)))

dsolve(diff(y(x),x)=the_rhs)

y(x) = _C1*x^(3/2)

 

Download strange_ode_answer.mw

 

First 39 40 41 42 43 44 45 Last Page 41 of 71