Real ODE yields real solution through complex numbers

In summary: I got the same real and imaginary parts as before!In summary, the problem is real, the expected solution is in ##\mathbb{R}## as well, and the solution obtained by solving the original integral equation*** step-by-step using very small discrete intervals is also correct.
  • #1
FranzS
66
22
TL;DR Summary
ODE in the real domain requires calculations in the complex doman in order to yield a (real) solution
Hello,

I'm posting here since what follows is not about homework, but constitutes a personal research which underlies some more general questions.

As with the infamous "casus irreducibilis" (i.e. finding the real roots of a cubic function sometimes requires intermediate calculations with complex numbers), I found myself solving an ordinary differential equation which seems to require the same approach.

Before explaining the problem in detail, I'd like to anticipate what I wish to understand (with the help of you knowledgeable people) for the general case: when a problem is formulated in ##\mathbb{R}## with expected solutions also in ##\mathbb{R}## but solving it requires an "intermediate journey" in ##\mathbb{C} \, ##, is there a general approach to find a way (if any exists) to bypass that "intermediate journey" in ##\mathbb{C} \,##?

Now, my personal research addresses a specific problem which is indeed very real. It's about finding the pressure ##P## of a gas inside a container as a function of time ##t## when said gas is slowly flowing out from said container through an orifice. Well, the problem itself is slightly more detailed but you shouldn't bother about anything except for the math to come (the aim of this introduction is to show that it is a real-world problem whose domain is ##\mathbb{R}## and whose expected solution is in ##\mathbb{R}## as well). By the way, I apologise in advance for my possibly loose math language.
Also, I'd like to say that what follows lead "in a certain way" (more details hereafter) to the correct solution of the problem, but I cannot get my head around it about that "in a certain way" (again, more details hereafter).

My calculations lead to an ordinary differential equation which is separable and yields the following integral:

$$ \int \frac{ dP(t) }{ \sqrt{a+b \, P(t)+c \, P^2(t) } } \, dx =-\alpha \, t + C $$

where ##a##, ##b##, ##c## and ##\alpha## are known parameters (and real numbers).
I'm not skilled enough to solve the integral myself, so I relied on a couple online solvers, which both gave the solution:

$$ \frac{1}{\sqrt{c}} \log \left( 2 \sqrt{c} \sqrt{ a+b \, P(t)+c \, P^2(t) } + b + 2c \, P(t) \right) = -\alpha \, t + C $$

where ##log## is the natural logarithm.
Here arises the first problem: the parameter ##c## (which is under a square root) is negative.
If I don't bother and go on with the calculations, after a couple of rearrangements, I get the following equation for ##P(t) \, ##:

$$ P(t) = \frac{k}{4 \, c} e^{ - \sqrt{c} \alpha \, t } + \frac{b^2-4 \, a \, c}{4 \, c \, k} e^{ + \sqrt{c} \alpha \, t } - \frac{b}{2 \, c} $$

where ##k## is the constant to be determined using the problem's initial conditions (it derives from the previous constant of integration ##C \, ##).
The initial condition (remember the physical problem?) is that the pressure ##P## is equal to a certain real value ##P_0## at the time ##t=0 \, ##.
Please note that the exponents of the two exponential terms (if we exclude the variable ##t \, ##) are purely imaginary (because of ## \sqrt{c} ## with ##c<0## ) and they only differ by a minus sign: that means that they are also complex conjugate.
Well, applying the constraint of the initial conditions yields a value of ##k## which makes the coefficient of the two exponential terms (the ones expressed in terms of ##a##, ##b##, ##c## and ##k## itself) complex conjugate as well.

Thus, with the final expression for ##P(t)## (which is the one above but with ##k## made explicit), I can throw in real values of the time ##t## and indeed get real values of the pressure ##P(t) \, ##.
And the values of ##P(t)## are correct. They match the values I got by solving the original integral equation*** step-by-step (using very small discrete intervals).
*** I mean the original integral equation I was solving, which leads to the differential equations that in turn leads to the first equation in this post.

So far so good but, as said at the beginning, I do not know if there is a way to bypass this "intermediate journey" in ##\mathbb{C} \, ##.

Now, the odd part. If I want to find the time ##t## for which ##P(t)=P_1## (where ##P_1<P_0## is a specific pressure of interest) and I solve the equation for ##P(t)## accordingly, I get a complex value as a result (comprised of both non-zero real and imaginary parts).
To double check, I used this "complex time" into the expression for ##P(t)## and it worked (it gave the real value ##P_1 \, ##).
What's strange to me is that the real part of this "complex time" seems to be the actual real-world solution (again, I compared it with the step-by-step numerical solution described above), in other words the real time for which ##P(t)=P_1 \, ##.
What is happening here?Sorry for the lenghty post. I'd appreciate if anyone could chime in and enlighten me. Thank you!
 
Physics news on Phys.org
  • #2
FranzS said:
Summary: ODE in the real domain requires calculations in the complex doman in order to yield a (real) solution

Hello,

I'm posting here since what follows is not about homework, but constitutes a personal research which underlies some more general questions.

As with the infamous "casus irreducibilis" (i.e. finding the real roots of a cubic function sometimes requires intermediate calculations with complex numbers), I found myself solving an ordinary differential equation which seems to require the same approach.

Before explaining the problem in detail, I'd like to anticipate what I wish to understand (with the help of you knowledgeable people) for the general case: when a problem is formulated in ##\mathbb{R}## with expected solutions also in ##\mathbb{R}## but solving it requires an "intermediate journey" in ##\mathbb{C} \, ##, is there a general approach to find a way (if any exists) to bypass that "intermediate journey" in ##\mathbb{C} \,##?

Now, my personal research addresses a specific problem which is indeed very real. It's about finding the pressure ##P## of a gas inside a container as a function of time ##t## when said gas is slowly flowing out from said container through an orifice. Well, the problem itself is slightly more detailed but you shouldn't bother about anything except for the math to come (the aim of this introduction is to show that it is a real-world problem whose domain is ##\mathbb{R}## and whose expected solution is in ##\mathbb{R}## as well). By the way, I apologise in advance for my possibly loose math language.
Also, I'd like to say that what follows lead "in a certain way" (more details hereafter) to the correct solution of the problem, but I cannot get my head around it about that "in a certain way" (again, more details hereafter).

My calculations lead to an ordinary differential equation which is separable and yields the following integral:

$$ \int \frac{ dP(t) }{ \sqrt{a+b \, P(t)+c \, P^2(t) } } \, dx =-\alpha \, t + C $$

Is this [tex]
\int \frac{1}{\sqrt{cP^2 + bP + a}}\,dP = -\alpha t + C
[/tex] with [itex]c < 0[/itex]? The quadratic [itex]cP^2 + bP + a[/itex] then tends to [itex]-\infty[/itex] as [itex]|P| \to \infty[/itex] so it will be positive only between its real roots; the condition that these exist and are distinct is [itex]b^2 - 4ac > 0[/itex].

We can complete the square in the quadratic to obtain [tex]
cP^2 + bP + a = c\left(P + \frac{b}{2c}\right)^2 + \frac{4ac - b^2}{4c}.[/tex] If [itex]c < 0[/itex] and the quadratic has distinct real roots then the constant term [itex]\dfrac{4ac - b^2}{4c} = \dfrac{b^2 - 4ac}{4|c|}> 0[/itex] and we may set [tex]
P = -\frac{b}{2c} + \sqrt{\frac{b^2 - 4ac}{4|c|^2}}\sin \theta[/tex] with a much simpler integral, [tex]
\begin{split}
\int \frac{1}{\sqrt{cP^2+bP+a}}\,dP &=
\frac{1}{\sqrt{|c|}}\int \frac{\cos\theta}{\sqrt{1 - \sin^2\theta}}\,d\theta \\
&= \frac{1}{\sqrt{|c|}}\theta \\
&= \frac{1}{\sqrt{|c|}} \arcsin\left(\sqrt{\frac{4|c|^2}{b^2 - 4ac}}\left(P + \frac{b}{2c}\right) \right).
\end{split}[/tex] To compare this with the solution you obtained, recall that [tex]
\begin{split}
\sin x &= \frac{e^{ix} - e^{-ix}}{2i}, \\
\arcsin x &= -i \log\left( \sqrt{1-x^2} + ix\right).\end{split}[/tex]
 
  • Like
Likes topsquark
  • #3
The prototypical example of this is the simple [tex]
\ddot x = Cx[/tex] with solution [tex]
x(t) = A\cosh(\sqrt{C}t) + B\sinh(\sqrt{C}t).[/tex] Now if [itex]C < 0[/itex] we set [itex]\sqrt{C} = i\sqrt{|C|}[/itex] and get [tex]
\begin{split}
x(t) &= A\cosh(i\sqrt{|C|}t) + B \sinh(i\sqrt{|C|}t) \\
&= A \cos(\sqrt{|C|}t) + iB\sin(\sqrt{|C|}t) \end{split}[/tex] which will be real for real [itex]t[/itex] provided [itex]A[/itex] is real and [itex]B = -iD[/itex] for real [itex]D[/itex].
 
  • Like
Likes topsquark
  • #4
pasmith said:
Is this [tex]
\int \frac{1}{\sqrt{cP^2 + bP + a}}\,dP = -\alpha t + C
[/tex] with [itex]c < 0[/itex]? The quadratic [itex]cP^2 + bP + a[/itex] then tends to [itex]-\infty[/itex] as [itex]|P| \to \infty[/itex] so it will be positive only between its real roots; the condition that these exist and are distinct is [itex]b^2 - 4ac > 0[/itex].

We can complete the square in the quadratic to obtain [tex]
cP^2 + bP + a = c\left(P + \frac{b}{2c}\right)^2 + \frac{4ac - b^2}{4c}.[/tex] If [itex]c < 0[/itex] and the quadratic has distinct real roots then the constant term [itex]\dfrac{4ac - b^2}{4c} = \dfrac{b^2 - 4ac}{4|c|}> 0[/itex] and we may set [tex]
P = -\frac{b}{2c} + \sqrt{\frac{b^2 - 4ac}{4|c|^2}}\sin \theta[/tex] with a much simpler integral, [tex]
\begin{split}
\int \frac{1}{\sqrt{cP^2+bP+a}}\,dP &=
\frac{1}{\sqrt{|c|}}\int \frac{\cos\theta}{\sqrt{1 - \sin^2\theta}}\,d\theta \\
&= \frac{1}{\sqrt{|c|}}\theta \\
&= \frac{1}{\sqrt{|c|}} \arcsin\left(\sqrt{\frac{4|c|^2}{b^2 - 4ac}}\left(P + \frac{b}{2c}\right) \right).
\end{split}[/tex] To compare this with the solution you obtained, recall that [tex]
\begin{split}
\sin x &= \frac{e^{ix} - e^{-ix}}{2i}, \\
\arcsin x &= -i \log\left( \sqrt{1-x^2} + ix\right).\end{split}[/tex]
Thanks a lot, that worked perfectly. So, it was all about my inability to solve non-trivial integrals!
 

FAQ: Real ODE yields real solution through complex numbers

What is a real ODE?

A real ODE (ordinary differential equation) is a mathematical equation that involves an unknown function and its derivatives with respect to one or more independent variables. The function and variables are all real numbers.

What is a complex number?

A complex number is a number that can be expressed in the form a + bi, where a and b are real numbers and i is the imaginary unit (defined as the square root of -1).

How does a real ODE yield a complex solution?

When solving a real ODE, the solution may involve complex numbers if the coefficients or initial conditions of the equation are complex. This means that the solution will have both a real and imaginary part.

Why is it important to consider complex solutions in real ODEs?

Complex solutions in real ODEs can provide more accurate and complete solutions to certain problems, especially in physics and engineering. They can also help to simplify the overall solution and make it easier to understand.

Are complex solutions always necessary in real ODEs?

No, not all real ODEs will have complex solutions. It depends on the specific equation and its coefficients and initial conditions. Some equations may only have real solutions, while others may have a mix of real and complex solutions.

Back
Top