How to solve this autonomous DE with RK 4?

97 Views Asked by At

I have this equation :

$$\frac{d\alpha}{dz} = - \frac{dr}{dz} * \frac{\tan(\alpha)}r $$

I searched for some similar examples but non of these equations was like this one. I'm confused about this one. As far as I know, I used RK4 for equations like this : $$y'(t) = F(t,y(t))$$

Thank you for helping me !


Here's the context for the equation. enter image description here

I just deleted the lambda part to make the equation easier. But I still don't figure out how to solve it!

3

There are 3 best solutions below

0
On

One has step by step : $$ \begin{array}{rcl} \displaystyle\frac{\mathrm{d}\alpha}{\mathrm{d}z} = -\frac{\tan\alpha}{r}\frac{\mathrm{d}r}{\mathrm{d}z} &\Leftrightarrow& \displaystyle \frac{\mathrm{d}\alpha}{\mathrm{d}z} = -\tan\alpha\,\frac{\mathrm{d}}{\mathrm{d}z}\ln r \\ &\Leftrightarrow& \displaystyle \frac{\mathrm{d}\alpha}{\tan\alpha} = -\mathrm{d}(\ln r) \\ &\Leftrightarrow& \displaystyle \int_{\alpha_0}^\alpha\frac{\cos\alpha}{\sin\alpha}\mathrm{d}\alpha = -\int_{r_0}^r\mathrm{d}(\ln r) \\ &\Leftrightarrow& \displaystyle \frac{\mathrm{d}\alpha}{\tan\alpha} = -\mathrm{d}(\ln r) \\ &\Leftrightarrow& \displaystyle \ln\left(\frac{\sin\alpha}{\sin\alpha_0}\right) = -\ln\left(\frac{r}{r_0}\right) \\ &\Leftrightarrow& \displaystyle \sin\alpha = \frac{r_0}{r}\sin\alpha_0 \\ &\Leftrightarrow& \displaystyle \alpha = \arcsin\left(\frac{r_0}{r}\sin\alpha_0\right) \end{array} $$ with $r_0 = r(z_0)$ and $\alpha_0 = \alpha(z_0)$.

0
On

Without knowing something more than what you've given us, you can't "solve" this equation for $\alpha$ and $r$ as functions of $z$. What you can do is write it as $$ \dfrac{d\alpha}{dr} = -\frac{\tan \alpha}{r} $$ and solve for $\alpha$ as a function of $r$ (whether in closed form, or using RK4, as you wish).

0
On

Interpreting $(r,z)$ as meridian coordinates among the as yet undefined cylindrical coordinates in three space $(r, z, \theta)$ and $\alpha$ is some angle the arc makes to meridian on the surface..

we have after removing $z$.. an ODE with straight separation of variables:

$$ - {\cot\alpha}\cdot d\alpha =\frac{ dr} {r} $$

Integrating

$$-\log \sin \alpha = \log~ r -\log ~ r_{min} $$

with an arbitrary constant $r_{min}$ brought in

$$ r\cdot \sin \alpha = ~ r_{min} $$

which is the geodesics describing Clairaut's Law for all arcs on a surface of revolution... tangential to a constant minimum circle $ r= r_{min}$. Note that it did not require RK4 for a solution.

In order to further solve for variables $(r, z, \theta)$ it needs a longer answer. We need more independent equations e.g.,

$$ \frac {dr}{dz}= \tan \phi = 1 $$

for a cone of semi-vertical angle $ 45^{\circ}$

and... coupled differential equations w.r.t. an independent variable $ \theta $ or arc $s.$

As an example with independent variable arc $s$ we can solve either analytically in simple cases or numerically using RK4 a set of simultaneous / coupled set of differential equations (primed on $~s):$

$$ \alpha'= f(s), \phi'=g(s), r'= \sin \phi \cos \alpha, z' =\cos \alpha \cos \phi, r\theta' = \sin \alpha. $$