What issues can arise when solving ODEs numerically?

  • MHB
  • Thread starter Theia
  • Start date
  • Tags
    Ode
In summary, the conversation discusses the process of solving a differential equation numerically and the potential issues that arise when there are multiple solutions. The possibility of using an exact solution through separation of variables is also mentioned, but the main focus is on understanding the behavior of the numerical solution. Specifically, the question is raised whether the numerical solution is a continuous function and how this impacts the accuracy of the solution.
  • #1
Theia
122
1
Hi
I am trying to understand numerical analysis on my freetime and today I studyed how to solve \(\displaystyle y' = \frac{x^2}{1 + y\sin (y^2)}\), with initial value \(\displaystyle y(0) = 0\). I asked myself two simple questions: What is \(\displaystyle y(1.5)\) and what is \(\displaystyle y(2.5)\)?

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

One knows that denominator of the ODE has two roots (in the range I'm now interested): \(\displaystyle 1.92073\ ;\ 2.420171\) that will ruin something. But my question for you is, what these roots will ruin? Is the solution \(\displaystyle y(x)\) a continuous function even though the derivative of it exists? Because... If the \(\displaystyle 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
  • #2
Theia said:
Hi
I am trying to understand numerical analysis on my freetime and today I studyed how to solve \(\displaystyle y' = \frac{x^2}{1 + y\sin (y^2)}\), with initial value \(\displaystyle y(0) = 0\). I asked myself two simple questions: What is \(\displaystyle y(1.5)\) and what is \(\displaystyle y(2.5)\)?

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

One knows that denominator of the ODE has two roots (in the range I'm now interested): \(\displaystyle 1.92073\ ;\ 2.420171\) that will ruin something. But my question for you is, what these roots will ruin? Is the solution \(\displaystyle y(x)\) a continuous function even though the derivative of it exists? Because... If the \(\displaystyle 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*}$.
 
  • #3
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 \(\displaystyle 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 \(\displaystyle y(x)\) can get at that point. With one initial value I can compute just one value for \(\displaystyle 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...)
 
  • #4
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.
 
  • #5
Thank you, I like Serena.

Hmm... So because there are points where the derivative \(\displaystyle y'\) is not defined, implies that numerical solution won't work because it tries to use values that don't necessarily exist. Cool!
 

1. What is ODE and why is it important?

ODE stands for Ordinary Differential Equation, which is a mathematical equation that describes the relationship between a function and its derivatives. It is important because it is used to model and understand a wide range of natural phenomena, such as motion, population growth, and chemical reactions.

2. How are ODEs solved numerically?

ODEs are solved numerically using various numerical methods, such as Euler's method, Runge-Kutta methods, and multistep methods. These methods involve breaking down the ODE into smaller steps and approximating the solution at each step using mathematical calculations.

3. What are the advantages of solving ODEs numerically?

One advantage of solving ODEs numerically is that it allows for the analysis of complex systems that cannot be solved analytically. Numerical solutions also provide a more accurate and detailed understanding of the behavior of a system, as they can take into account small changes in the system over time.

4. What are some challenges in solving ODEs numerically?

One of the main challenges in solving ODEs numerically is selecting an appropriate numerical method for a specific problem. Different methods have different levels of accuracy and stability, and some may be more suitable for certain types of ODEs. Additionally, numerical errors can accumulate over time and affect the accuracy of the solution.

5. How do scientists validate the numerical solutions of ODEs?

Scientists validate the numerical solutions of ODEs by comparing them to known analytical solutions, if available. They also perform sensitivity analyses to determine the impact of small changes in the initial conditions or parameters on the solution. Additionally, numerical solutions can be compared to experimental data to assess their accuracy.

Similar threads

Replies
3
Views
797
  • Programming and Computer Science
Replies
1
Views
1K
  • Differential Equations
Replies
9
Views
2K
  • General Math
Replies
11
Views
1K
Replies
24
Views
3K
  • General Math
Replies
1
Views
1K
  • Programming and Computer Science
Replies
6
Views
1K
  • Calculus and Beyond Homework Help
Replies
4
Views
1K
Replies
12
Views
2K
  • Classical Physics
Replies
3
Views
778
Back
Top