cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

How to solve these types of non-linear differential equations?

Cornel
19-Tanzanite

How to solve these types of non-linear differential equations?

Hi,

How to solve this types of non-linear differential equations like sol3 and sol4? There is a method for solving also these types of diff eq? Or is not possible?

Cornel_6-1717399837735.png

 

Cornel_5-1717399807176.png

20 REPLIES 20

For sol3 set y'(0) = 1 to avoid a complex square root.

 

For sol4 rewrite as y''(x) = (y'(x) + 1)^2  and set the xlimit to be 0.99 rather than 5 as y'(x) tends to infinity as x tends to 1.

 

Alan

Werner_E
25-Diamond I
(To:Cornel)

Ad sol3:

Wen you demand y'(0)=0 you also demand y''(0)=i, the imaginary unit! Really?
Chose y'(0)=1 or larger and the solve block works OK

 

Ad sol4:

Look at the help  -> ODE Function

It clearly states:
odesolve(vf, b, [intvls])—Defines a function that represents the solution to a system of Ordinary Differential Equations (ODE), subject to initial value or boundary value constraints. The ODEs must be linear in their highest derivative term, and the number of initial and boundary conditions must equal the order of the ODEs.

The square root of y''(t) sure is not linear.

 

 

Cornel
19-Tanzanite
(To:Werner_E)

Yes, Werner, you got the things. This in fact was and is the main point of this topic that I had posted, that when dealing with odesolve the odes must be linear in their highest derivative term. And this I am wondering: what to do in such cases? Is this a limitation of odesolve block? Or there are other solutions with which Mathcad Prime comes that can solve odes that are non-linear in the highest derivative term?

I saw that AlanStevens was able to make some suggestions as you did in such a way that the odesolve was able to show the solution of these kinds of odes posted (for sol4). But there are other Mathcad Prime commands that can be used to solve these types of odes that are non-linear in the highest derivative term? (because as we can see the command odesolve have this request that the odes needs must be linear in the highest derivative term)

Cornel
19-Tanzanite
(To:Cornel)

Another example:

Cornel_1-1717409925018.png

Werner_E
25-Diamond I
(To:Cornel)

Well, I suspect that we can all very easily make up some data for differential equations that Prime cannot solve.

We probably have more than enough to do thinking of solutions and workarounds for those equations that actually arise in our practice, because there are always a few very stubborn examples.

 

BTW, as long as you can solve your ODE for y''(x) there is hope...

Werner_E_0-1717414196762.png

 

Cornel
19-Tanzanite
(To:Werner_E)

Hm, I would have liked to find a diff eq of this type that could not be solved that way:)). I would like to have Prime a solution that can solve these types of diff eq that are non-linear in the  highest derivative term that not need to make any artifice/workaround like that.

But do you think that for these types of non-linear differential eq in the highest derivative term Prime is not enough capable to deal with them? Or maybe other math software are not capable or have trouble to solve these types of diff eq?

I open this topic more out of my curiosity, but do you think that these type of diff eq with non-linear term in the highest derivative term arise often in practice?

Werner_E
25-Diamond I
(To:Cornel)


I open this topic more out of my curiosity, but do you think that these type of diff eq with non-linear term in the highest derivative term arise often in practice?

If it doesn't in your practice, you don't have to worry. If it does one day, then its time to think (specifically for this one very problem) about a workaround, using a different tool, applying an approximation, a bold graphic solution, setting up the task in a different way, ....or whatever else you can think of to finally beat the task you have been set.

Cornel
19-Tanzanite
(To:Werner_E)

Let's try as much as possible to not push people to resort on warkarounds if possible because for example these guys from development of Mathcad then will not care anymore to come with solutions embedded within their tool on people problems or moreover to improve their tool, as they will say that people will find anyway wararounds and if they will not find then people must go and use different tool etc as you said, (reason: as we dont care about peoples problems or to improve the tool). If other tools are capable to solve these types of diff eq, then why PTC to want to that their toll to be capable to solve as well these types of diff eq?

Werner_E
25-Diamond I
(To:Cornel)


@Cornel wrote:

Let's try as much as possible to not push people to resort on warkarounds if possible because for example these guys from development of Mathcad then will not care anymore to come with solutions embedded within their tool on people problems or moreover to improve their tool, as they will say that people will find anyway wararounds and if they will not find then people to go and use different tool (as we dont care about peoples problems), etc as you said.


Ah! So at the time being you have the impression that PTC is listening to its customers and providing the solutions and improvements they need? And if your goal with your questions is to make PTC improve their software, then posting in this forum possibly is not the way to go.

You had some questions, found some bugs in the past where I suggested that you contact PTC support. Did you do that and if yes, was it a positive, helpful experience?

Werner_E
25-Diamond I
(To:Cornel)

There may be other software which possibly are capable enough to give you the results

Werner_E_1-1717414846775.png or 
Werner_E_0-1717412344145.png

and

Werner_E_1-1717412356920.png

for the last two ODEs with the initial condition you originally stated. Prime obviously is not capable to do so - probably because of the non-real coefficients involved.

But as Alfred already remarked, the ODEs are simple enough to be solved by hand using pencel and paper 😉

The equations sol1 to sol4 can be solved as a differential equation with separate variables. To do this, you have to solve explicitly for y´´(x). And with the substitution z´(x) = y´´(x), the solution y(x) becomes obvious after integrating z(x) and converting the initial values.

LucMeekes
23-Emerald III
(To:Cornel)

Sol3 can be solved symbolically.

Don't know if Prime can do it, but Maple knows.

 

Success!

Luc

Werner_E
25-Diamond I
(To:LucMeekes)


@LucMeekes wrote:

Sol3 can be solved symbolically.

Don't know if Prime can do it, but Maple knows.

 

Success!

Luc


Yes, sol4 can be solved symbolically as well.

Its quite easy to to it with pencil and paper, as Alfred noted and I already posted the solutions.

I guess Maple should be able to solve sol4 as well

Wolframalpha can do so :

Werner_E_0-1717419623666.png

 

Primes 10 symbolic is not able to return a solution

Werner_E_1-1717420058224.png

The error message in both cases is "No solution was found".

 

Without the initial conditions sol3 still fails with the same message, but sol4 returns a useless 'solution':

Werner_E_2-1717420178269.png

Prime can only solve sol1 symbolically

Werner_E_3-1717420688931.png

It can't solve sol2,

Werner_E_4-1717420766255.png

which is understandable as this one is quite nasty and the solution could only be written using the Lambert W function.

See {y''(x) - sqrt(y'(x))-1=0, y(0)=0, y'(0)=0} - Wolfram|Alpha

Cornel
19-Tanzanite
(To:Werner_E)

I assume that also their Wolfram numerical ode solver will be able to solve these types of diff eq. So, this means that Prime is not able to do either symbolically, nor numerically...sad

Cornel
19-Tanzanite
(To:Cornel)

@DJNewman  so, what can you answer about this? Seems that Prime not have so great capabilities...I was expected that numerically somehow to be able to solve these types of eq also Prime, but unfortunetly Prime cannot. @Jaime_Lee @achirila Come with the Prime development team to say an answer 

DJNewman
17-Peridot
(To:Cornel)

I don't have a constructive comment in terms of how the math works, other than to raise a Support case as Werner suggested and provide your feedback with the specific worksheet directly through there.

 

I'll also say that in my conversations with the engine team, they have a personal interest in expanding the capabilities of the numeric and especially the symbolic engines to do stuff it couldn't do before. They're really into that and they get enjoyment from that, even if it's expanding it to perform theoretical stuff.

But their priorities from the top are to add functionality that allows customers to have expanded real-life use cases, so submitting issues to Support and being convincing enough in your support ticket that it's a real-life problem/blocker for you to get your work done would get you on a higher development priority than the theoretical stuff.

I manage the Creo and PTC Mathcad YouTube channels for PTC, as well as all PTC Mathcad marketing in general.
Jaime_Lee
Community Manager
(To:DJNewman)

Thank you for the reply @Werner_E  and @DJNewman 

Werner_E
25-Diamond I
(To:Cornel)


@Cornel wrote:

But there are more, l


So you may have to turn in more support tickets to official PTC support 😉

Werner_E
25-Diamond I
(To:Cornel)


@Cornel wrote:

I assume that also their Wolfram numerical ode solver will be able to solve these types of diff eq. So, this means that Prime is not able to do either symbolically, nor numerically...sad


Yes, WolframAlpha can solve all four of your examples symbolically.

 

And Prime actually CAN solve them numerically.

In case of sol3, the only REAL valued point would be 0/0, though.

Neither 
Werner_E_0-1717421671027.png

nor 

Werner_E_1-1717421697816.png

have any other points with real valued coordinates a plot could show!

 

In case of sol4

Werner_E_2-1717421882781.png

the numeric odesolve CAN provide a solution if you chose your range with care. You can't expect a numerical algorithm to jump over the pole at x=1 and furthermore all function values for x>1 are non-real and so can't be plotted.

 

So you should not blame the numerics for you providing a "mission impossible" with sol3 or an invalid range as in sol4. As you have seen, when you stick to the docs and keep the highest order derivative linear and provide a reasonable range (like from 0 to 0.99 as suggested by Alan) you get a decent solution 😉
You sure may blame the symbolics for not being able to do what Maple, Mathematica and others can do, But then you have to consider that Mathcad is (or rather was) a tool for engineers, mainly dealing with numeric results, needing to work with units and adoring the white space interface of Mathcad enabling them to write formulas anywhere and the way they would also do it with pencil and paper. Symbolics is a nice add-on but sure not the main focus of this software. You sure know that there were times when Mathcad was able to use the Maple engine for its symbolic calculations, but these times are gone. 😞
The built-in symbolics sure can't compete with the market leaders but at least it is being further developed and there are improvements noticeable (which often can't be said from the rest of the software which still is so much behind old Mathcad when it comes to functionality, speed, usability, ease of handling, etc.)

 

Announcements

Top Tags