3

I want to solve following differential equations using mathematica (I know the solution as it is easy to compute): $$\dot{r}^2+r^2\dot{u}^2=2\kappa^2\frac{1}{r}+h,$$ $$r^2\dot{u}=c.$$ To computer the solution we substitute second equation in the first and then eliminate the time variable from these equations using, $$\dot{r}=\frac{dr}{du}\frac{du}{dt}=\frac{dr}{du}cr^{-2}.$$ Substituting this we get $$\left(\frac{dr}{du}\right)^2\frac{c^2}{r^4}+r^2\frac{c^2}{r^4}=2\kappa^2\frac{1}{r}+h.$$ Can someone please show me how to do this using mathematica?

I have tried following things, but that didn't work:

expr = r'[t]^2 + r[t]^2 u'[t]^2 - 2 κ^2/r[t] - h

expr1 = expr /. r -> (r[u[#]] &)

expr2 = Eliminate[{expr1 == 0, u'[t] == c r[u[t]]^-2}, u'[t]]

expr3 = expr2 /. {r'[u[t]] -> c r[u[t]]^-2 r'[u[t], u[t]], u'[t] -> c r[u[t]]^-2}
Michael E2
  • 235,386
  • 17
  • 334
  • 747
siddhesh
  • 45
  • 5

1 Answers1

2

What do you want us to show you is not quite clear. I understand your question is the following way: "How to make within Mma the same steps you have done on the paper?" Is that right? If yes, the answer is as follows.

This is the left-hand part of your first equation:

expr1 = r'[t]^2 + r[t]^2 u'[t]^2 - 2 \[Kappa]^2/r[t] - h

Let us substitute your second expression into it. You might use Eliminate, but in this simple case substitution is easier:

    expr2 = expr1 /. u'[t] -> c/r[t]^2
(*  -h + c^2/r[t]^2 - (2 \[Kappa]^2)/r[t] + Derivative[1][r][t]^2  *)

Now, you replace the derivative by your third equation, and r[t] replace by r[u]. Let us do it:

 expr3 = expr2 /. {r[t] -> r[u], r'[t] -> r'[u]*c/r[u]^2}

(*  -h + c^2/r[u]^2 - (2 \[Kappa]^2)/r[u] + (c^2 Derivative[1][r][u]^2)/
 r[u]^4  *)

That's all. Here is your equation:

enter image description here

Then you can solve it using DSolve. You could have done this from the very beginning without transformations though. The solution is not very comfortable, but one can use it in several ways.

Have fun!

Alexei Boulbitch
  • 39,397
  • 2
  • 47
  • 96