Page 1 of 1

A nonlinear second-order ODE

Posted: Thu Jul 24, 2014 1:32 am UTC
by Qaanol
I am trying to solve the following for y(x), where b is a constant:

y·ẏ = b·x²·ÿ

(Actually technically I am trying to solve it for ẏ(x)—I don’t really care what y itself is.)

Standard disclaimer, not homework, just stumped.

So…does anyone have a way to proceed?

Context:
Spoiler:
Relabel y→m and x→r and then m(r) represents the mass of an ideal gas in a spherical container, at radius less than r, when in equilibrium under its own gravity and far from other objects. The constant b captures, among other things, the relationship between the gas’s pressure and density.

Re: A nonlinear second-order ODE

Posted: Thu Jul 24, 2014 2:09 am UTC
by z4lis
DId assuming it was a power series and checking the resulting sequence of equations for the coefficients yield anything useful?

Re: A nonlinear second-order ODE

Posted: Thu Jul 24, 2014 2:51 am UTC
by Qaanol
z4lis wrote:DId assuming it was a power series and checking the resulting sequence of equations for the coefficients yield anything useful?

That gives the y=constant solution, which is not applicable to the physical problem.

It is possible I made a mistake deriving the equation though. Here is my approach:

Spoiler:
Put a quantity of ideal gas in a rigid spherical container, thermally insulated and far from any external gravity, and let it come to equilibrium.

A(r) = 4πr² is the area of a sphere of radius r
ρ(r) is the density of gas at radius r
m(r) is the mass of gas within radius r of the center
m′(r) = ρ(r)·A(r) is the mass of gas in a thin shell at radius r
P(r) = c·ρ(r) is the gas pressure at radius r, proportional to density thanks to the ideal gas law
fP(r) = P(r)·A(r) = c·ρ(r)·A(r) = c·m′(r) is the force due to pressure at radius r
fg(r) = -G·m(r)·m′(r)/r² is the force due to gravity at radius r

The gas is in equilibrium, so the difference in force due to pressure inside and outside the shell must be exactly countered by gravity on the shell:
f′P(r) = fg(r)

Hence:
c·m″(r) = -G·m(r)·m′(r)/r²

And thus:
(-c/G)·r²·m″(r) = m(r)·m′(r)

Re: A nonlinear second-order ODE

Posted: Thu Jul 24, 2014 5:04 am UTC
by cyanyoshi
One thing to try is to assume that y(x) is a Taylor series centered at some positive nominal radius, since the equation becomes singular at x=0. The derivation gets somewhat messy, but it isn't too awful. I started with y = ∑n=0[anzn] , where z = x - h. After a bunch of work, I ended up with a (possibly incorrect) recursive formula for an:

Spoiler:
a0 = y(h)
a1 = y'(h)
a2 = a0a1/(2bh2)
a3 = (bh2a12 + a02a1 - 2bha0a1)/(6b2h4)
an≥4 = (∑k=0n-2[(k+1)ak+1an-2-k] - (n-2)(n-3)ban-2 - 2(n-2)(n-1)bhan-1)/(n(n-1)bh2)

...or something like that, at least. You have to be slightly more creative with your assumed solution to see what's going on near x=0.

Re: A nonlinear second-order ODE

Posted: Thu Jul 24, 2014 2:07 pm UTC
by jestingrabbit
If you integrate, you get something like

y' = (y^2 - d*r^2)/(y*r + b*r^2)

where d is some arbitrary constant, but at least its only first order now?

Re: A nonlinear second-order ODE

Posted: Thu Jul 24, 2014 10:10 pm UTC
by Qaanol
jestingrabbit wrote:If you integrate, you get something like

y' = (y^2 - d*r^2)/(y*r + b*r^2)

where d is some arbitrary constant, but at least its only first order now?

Could you point me toward how you got that?

When I integrated by parts I ended up with an ∫y term, so it did not reduce the order.

Re: A nonlinear second-order ODE

Posted: Fri Jul 25, 2014 10:51 am UTC
by jestingrabbit
Well,

y'*y = (1/2)*(y^2)'

by the chain rule, I believe. I think I've messed the rest up though... sorry...

Re: A nonlinear second-order ODE

Posted: Mon Aug 04, 2014 12:30 am UTC
by MostlyHarmless
You seem to have missed something in the right hand side. I can't get rid of the \int y term with that method, and mathematica can solve the first order equation you gave (and it's not a solution to the original). I'm not really sure how to make any headway on the problem, though.

cyanyoshi's suggestion might help, but it will be pretty difficult to describe the behavior near x=0. Then again, it doesn't sound like your model is supposed to be valid for very small x anyways, so this might not be a problem.

Re: A nonlinear second-order ODE

Posted: Sun Aug 10, 2014 8:11 pm UTC
by eta oin shrdlu
Qaanol wrote:It is possible I made a mistake deriving the equation though.


Your derivation does have a mistake, which you can see by the fact that the constant-pressure configuration m(r)=ar3 is not a solution when G=0: your derivation has PA constant instead of just P. The problem is in your force-balance equation; because the volume of a spherical shell increases with radius, there is an extra force resisting compression of a spherical shell to a smaller radius. The easiest way to see this is probably to consider a small volume at radius r, with boundaries aligned along constant spherical coordinates. It's true that the outer face has a larger area than the inner face; but the sides are not parallel, so pressure along the sides will exert an additional outward force which your derivation misses.

So instead the derivation continues

-Gm'm / (r2A) = P' = c(m'/A)'
(G/c) m' m = 2 r m' - r2 m''

which does have solution m=ar3 when G=0.

Re: A nonlinear second-order ODE

Posted: Thu Aug 14, 2014 12:53 am UTC
by cyanyoshi
I tried deriving the differential equation for myself using the hydrostatic equation, and I got the same thing. Maybe this makes finding a solution easier, maybe it doesn't.

Re: A nonlinear second-order ODE

Posted: Sun Aug 17, 2014 9:33 pm UTC
by eta oin shrdlu
This isn't a complete solution, but it's an approach to understanding the asymptotic behavior of physical solutions:
Spoiler:
We're looking for solutions to
h m' m = 2 r m' - r2 m''
where h=(Gμ)/(RT) (G the universal gravitational constant, R the ideal gas constant, T the temperature of the (isothermal) gas, and μ the molecular weight); e.g. for air (μ=29g/mol) at 300K, h~8E-16m/kg. Since we want m to be the mass within radius r, physical solutions should have m>0 and m'>0.

First notice that there is one linear solution,
m = (2/h) r .
This gives a pressure
P = m'/A = 1/(2 pi) r-2 ,
diverging as r→0; so this is nonphysical for an all-gas sphere. (It may be reasonable if the boundary conditions have gas only for some r>r0, e.g. the atmosphere of a planet, though real planet atmospheres are usually not isothermal.)

But let's write
m(r) = (2/h) r (1 + u(r)) ;
this gives us a differential equation for u,
0 = r2 u'' + 2 r (1 + u) u' + 2 (1 + u) u .
For physical solutions m>0 and so 1+u>0.

We can make this an autonomous differential equation by changing variables from r to t=log r: u'=(dt/dr)u't=(1/r)u't and u''=(dt/dr)(du'/dt)=1/r2(u''tt-u't) (decorating t derivatives with a subscript t to distinguish them from r derivatives), so
0 = u''tt + (1 + 2u) u't + 2 (1 + u) u .
Since this is autonomous, it can be immediately converted to a first-order differential equation, though it's not obvious to me that this actually helps much.

More interesting to me is that this looks a lot like a damped harmonic-oscillator equation, but with varying coefficients: undamped (squared) frequency 2(1+u) and damping (1+2u). Since both of these are positive, this equation should be stable with increasing t, i.e. it should only support solutions with u→0 as t→∞. That is, if we pretend the coefficients 2(1+u) and (1+2u) are nearly constant, the solutions to the resulting equation are linear combinations
u ~ A exp(σ1t) + B exp(σ2t)
with coefficients
σ1,2 = -(1/2) ( (1+2u) ± sqrt(-7 - 4u + 4u2) ) .
For small |u| these are complex conjugates, giving an underdamped solution decaying roughly as exp(-t/2)*sin(t*sqrt(7)/2+φ). This means that for sufficiently large t (hence r), solutions should converge toward u→0 and hence toward m ~ (2/h) r.

The solutions I think you're most interested in are those which are gas all the way to r=0. Near r=0 for a gas sphere the pressure should be nearly constant (since the gravitational gradient is small), so m=ρr3 for some near-center density rho.

So then we expect the full solution to look roughly like
m ~ min (ρr3 , (2/h) r)
with some oscillations in the transition region.