MHB What issues can arise when solving ODEs numerically?

  • Thread starter Thread starter Theia
  • Start date Start date
  • Tags Tags
    Ode
AI Thread Summary
Numerical analysis of the ODE $$y' = \frac{x^2}{1 + y\sin(y^2)}$$ reveals potential issues due to the presence of roots in the denominator, which can lead to multiple solutions for certain values of x, specifically at x = 2.5. The implicit solution indicates that at this point, three distinct values for y exist, raising questions about the continuity of y(x) and the validity of numerical methods. The discussion highlights that the original ODE may not be defined everywhere along the curve, complicating numerical solutions. It is emphasized that critical points where the derivative $$y'$$ is undefined can cause numerical methods to yield nonsensical results. Understanding these nuances is crucial for effectively applying numerical analysis to such problems.
Theia
Messages
121
Reaction score
1
Hi
I am trying to understand numerical analysis on my freetime and today I studyed how to solve $$y' = \frac{x^2}{1 + y\sin (y^2)}$$, with initial value $$y(0) = 0$$. I asked myself two simple questions: What is $$y(1.5)$$ and what is $$y(2.5)$$?

As for to check the answers, I solved the ODE. In implicit form one can write $$2x^3 - 3 = 6y - 3\cos (y^2)$$. Now, when $$x = 1.5$$, one can solve the $$y \approx 0.941265$$ with no problems. However, when $$x = 2.5$$, there are three solutions for $$y$$, namely $$4.553574\ ;\ 4.892841\ ;\ 5.084485$$. :confused:

One knows that denominator of the ODE has two roots (in the range I'm now interested): $$1.92073\ ;\ 2.420171$$ that will ruin something. But my question for you is, what these roots will ruin? Is the solution $$y(x)$$ a continuous function even though the derivative of it exists? Because... If the $$y(x)$$ is not continuous, then I could compute for example sheeps and cows with what ever method to obtain silly answers. If the function is continuous then one just needs to find a suitable method to obtain numbers. Any thoughts? Thank you!
 
Mathematics news on Phys.org
Theia said:
Hi
I am trying to understand numerical analysis on my freetime and today I studyed how to solve $$y' = \frac{x^2}{1 + y\sin (y^2)}$$, with initial value $$y(0) = 0$$. I asked myself two simple questions: What is $$y(1.5)$$ and what is $$y(2.5)$$?

As for to check the answers, I solved the ODE. In implicit form one can write $$2x^3 - 3 = 6y - 3\cos (y^2)$$. Now, when $$x = 1.5$$, one can solve the $$y \approx 0.941265$$ with no problems. However, when $$x = 2.5$$, there are three solutions for $$y$$, namely $$4.553574\ ;\ 4.892841\ ;\ 5.084485$$. :confused:

One knows that denominator of the ODE has two roots (in the range I'm now interested): $$1.92073\ ;\ 2.420171$$ that will ruin something. But my question for you is, what these roots will ruin? Is the solution $$y(x)$$ a continuous function even though the derivative of it exists? Because... If the $$y(x)$$ is not continuous, then I could compute for example sheeps and cows with what ever method to obtain silly answers. If the function is continuous then one just needs to find a suitable method to obtain numbers. Any thoughts? Thank you!

Why solve it numerically when it can be solved exactly through separation of variables?

$\displaystyle \begin{align*} \frac{\mathrm{d}y}{\mathrm{d}x} &= \frac{x^2}{1 + y\sin{ \left( y^2 \right) } } \\ \left[ 1 + y\sin{ \left( y^2 \right) } \right]\,\frac{\mathrm{d}y}{\mathrm{d}x} &= x^2 \\ \int{ \left[ 1 + y\sin{ \left( y^2 \right) } \right] \,\frac{\mathrm{d}y}{\mathrm{d}x} \,\mathrm{d}x} &= \int{ x^2\,\mathrm{d}x} \\ \int{ \left[ 1 + y\sin{ \left( y^2 \right) } \right] \, \mathrm{d}y } &= \frac{1}{3}\,x^3 + C_1 \\ y + \frac{1}{2} \int{ 2\,y\sin{ \left( y^2 \right) } \,\mathrm{d}y } &= \frac{1}{3}\,x^3 + C_1 \\ y + \frac{1}{2} \int{ \sin{ \left( u \right) } \,\mathrm{d}u } &= \frac{1}{3}\,x^3 + C_1 \textrm{ after substituting } u = y^2 \implies \mathrm{d}u = 2\,y\,\mathrm{d}y \\ y + \frac{1}{2}\,\left[ -\cos{\left( u \right) } \right] + C_2 &= \frac{1}{3}\,x^3 + C_1 \\ y - \frac{1}{2}\cos{ \left( y^2 \right) } + C_2 &= \frac{1}{3}\,x^3 + C_1 \\ 6\,y - 3\cos{ \left( y^2 \right) } &= 2\,x^3 + C \textrm{ where } C = 6\,\left( C_1 - C_2 \right) \end{align*}$

Now with the initial condition $\displaystyle \begin{align*} y\,\left( 0 \right) = 0 \end{align*}$ we have

$\displaystyle \begin{align*} 6\,\left( 0 \right) - 3 \cos{ \left( 0^2 \right) } &= 2\,\left( 0 \right) ^3 + C \\ -3 &= C \end{align*}$

Thus the solution is $\displaystyle \begin{align*} 6\, y - 3\cos{ \left( y^2 \right) } = 2\,x^3 - 3 \end{align*}$.
 
Prove It said:
Why solve it numerically when it can be solved exactly through separation of variables?

The answer to this question is in the beginning of my first post: "I am trying to understand numerical analysis".

In addition, the solution you derived, was also mentioned in my post; thank you for verifying it. So yes, I know the implicit solution exists and I use it determine how well I can compute the numerical value.

But again, my main question was, is the solution $$y(x)$$ continuous function in the sense that a numerical method can be used? As you can see from the implicit solution, there are three different values $$y(x)$$ can get at that point. With one initial value I can compute just one value for $$y(x)$$, not three, and this is the reason I'm posting this thread. I want to understand what is happening when I compute the numerical solution in this case.

(Clearly, I should have chosen the ODE such that no one can solve it analytically to avoid exact functions completely, but this would have make it unnecessarily difficult to compare different solutions. I'm sorry, I didn't notice the rules of the forum saying anything about 'use only exact functions in the forum content, don't be interested in numerics' or 'make sure to explain why you wish to understand a certain area in mathematics better'. I must admit, I'm a bit disappointed...)
 
Hi Theia! Welcome to MHB! (Smile)

The solution is not a function of x. That's why we have multiple values for the same x.
More specifically, even the exact solution that we found is not an actual solution.
That is because the original ODE (y') is not defined everywhere on the curve.

To investigate the behavior, we should look at the values where y' is not defined, or alternatively where we have critical points.
 
Thank you, I like Serena.

Hmm... So because there are points where the derivative $$y'$$ is not defined, implies that numerical solution won't work because it tries to use values that don't necessarily exist. Cool!
 
Suppose ,instead of the usual x,y coordinate system with an I basis vector along the x -axis and a corresponding j basis vector along the y-axis we instead have a different pair of basis vectors ,call them e and f along their respective axes. I have seen that this is an important subject in maths My question is what physical applications does such a model apply to? I am asking here because I have devoted quite a lot of time in the past to understanding convectors and the dual...
Insights auto threads is broken atm, so I'm manually creating these for new Insight articles. In Dirac’s Principles of Quantum Mechanics published in 1930 he introduced a “convenient notation” he referred to as a “delta function” which he treated as a continuum analog to the discrete Kronecker delta. The Kronecker delta is simply the indexed components of the identity operator in matrix algebra Source: https://www.physicsforums.com/insights/what-exactly-is-diracs-delta-function/ by...

Similar threads

Replies
9
Views
3K
Replies
3
Views
2K
Replies
1
Views
2K
Replies
9
Views
4K
Replies
6
Views
1K
Replies
6
Views
2K
Replies
11
Views
3K
Back
Top