2
$\begingroup$

t[r_] = (d*Sqrt[2*g*r - (2*g*r^2)/d])/(2*g*r) - (g*r^2*Log[-(g*r^2)])/
  (2*Sqrt[2]*(-((g*r^2)/d))^(3/2)) + 
 (g*r^2*Log[g*r^2 - (2*g*r^3)/d + Sqrt[2]*r*Sqrt[-((g*r^2)/d)]*
      Sqrt[2*g*r - (2*g*r^2)/d]])/(2*Sqrt[2]*(-((g*r^2)/d))^(3/2))

conds = {g>0, r>0, d>r}

Under the conds above, t[r] is always real. It contains terms like Log[-(g*r^2)] which aren't real under conds, but it turns out the complex numbers all cancel out.

However, I want to "publish" this formula, so I'd like a simplification that doesn't have complex numbers even as intermediate terms. Some failed attempts:


$Version

9.0 for Linux x86 (32-bit) (November 20, 2012)

(* the most obvious still contains Log[-(g*r^2)] *)

Simplify[t[r], conds] // InputForm

((-I/2)*(2*Sqrt[r*(-d + r)] + d*Log[-(g*r^2)] - 
   d*Log[(g*r^2*(d - 2*r + 2*Sqrt[r*(-d + r)]))/d]))/(Sqrt[2]*Sqrt[g/d]*r)

(* the second most obvious explicitly contains I *)

FullSimplify[t[r], conds] // InputForm

(d*(2*Sqrt[(d - r)*r] + d*(Pi - I*Log[d] + 
     I*Log[d - 2*r + (2*I)*Sqrt[(d - r)*r]])))/(2*Sqrt[2]*Sqrt[d*g]*r)

(* redundantly adding Element[{r,g,d}, Reals] as a condition; note
that the answer contains Sign[r] even though r>0 guarantees Sign[r] ==
1 *)

FullSimplify[t[r], {conds, Element[{r,g,d}, Reals]}] // InputForm

    g*r*(Log[-g] - Log[g - (2*g*r)/d + (2*Sqrt[-(g/d)]*Sqrt[(g*(d - r)*r)/d])/
         Sign[r]]))*Sign[r])/(2*Sqrt[2]*(-(g/d))^(3/2)*r^2)

(* playing Mathematica's game, lets make Sign[r] = 1 *)

FullSimplify[t[r], {conds, Element[{r,g,d}, Reals]}] /.
 Sign[r] -> 1 // InputForm

-(2*Sqrt[-(g/d)]*Sqrt[(g*(d - r)*r^3)/d] + 
   g*r*(Log[-g] - Log[g - (2*g*r)/d + 2*Sqrt[-(g/d)]*Sqrt[(g*(d - r)*r)/d]]))/
 (2*Sqrt[2]*(-(g/d))^(3/2)*r^2)

(* above contains a negative square root AND a negative log, so lets
try this (note that the Sign[r] simplification only works if it's done
after the other two): *)

FullSimplify[t[r], {conds, Element[{r,g,d}, Reals]}] /. 
 {Sqrt[x_]*Sqrt[y_] -> Sqrt[x*y], Log[x_]-Log[y_] -> Log[x/y]} /.
 {Sign[r] -> 1} // InputForm

-(2*Sqrt[-((g^2*(d - r)*r^3)/d^2)] + 
   g*r*Log[-(g/(g - (2*g*r)/d + 2*Sqrt[-(g/d)]*Sqrt[(g*(d - r)*r)/d]))])/
 (2*Sqrt[2]*(-(g/d))^(3/2)*r^2)

That's about as far as I got before giving up. The (-(g/d))^(3/2) is particularly difficult to get rid of, even with {x_^(3/2) -> x*Sqrt[x]}.

Although it's probably not relevant, I derived the function to compute the landing time of an object at distance d on a planet with radius r and surface gravity g:


sol = DSolve[{x''[t] == -g/(x[t]/r)^2}, x[t], t] 

t1[x_] = -sol[[1,1,1]]-C[2] /. x[t] -> x 

(* solving for constants *) 

c1sol = Solve[Simplify[1/t1'[d]] == 0, C[1]][[1]] 

(* above gives C[1] -> -2*g*r^2/d *) 

t2[x_] = t1[x] /. c1sol 

c2sol = Solve[t2[d] == 0, C[2]][[1]] 

t[x_] = t2[x] /. c2sol 

t[r] 

The function t[x] gives the time when the object is at distance x from the planet's center, so t[r] represents the time when the object hits the planets surface.

Even more details: https://github.com/barrycarter/bcapps/blob/master/QUORA/bc-1ly.m and https://www.quora.com/unanswered/How-long-would-an-object-fall-to-Earth-from-1-light-year-distance-if-other-bodies-didnt-perturb-the-trajectory

$\endgroup$
4
$\begingroup$
$Version

(*  "10.4.1 for Mac OS X x86 (64-bit) (April 11, 2016)"  *)

t[r_] = (d*Sqrt[2*g*r - (2*g*r^2)/d])/(2*g*r) - (g*r^2*
      Log[-(g*r^2)])/(2*Sqrt[2]*(-((g*r^2)/d))^(3/2)) + (g*r^2*
      Log[g*r^2 - (2*g*r^3)/d + 
        Sqrt[2]*r*Sqrt[-((g*r^2)/d)]*Sqrt[2*g*r - (2*g*r^2)/d]])/(2*
      Sqrt[2]*(-((g*r^2)/d))^(3/2));

conds = {g > 0, r > 0, d > r};

Assuming[conds, 
 t[r] // Simplify //
   ComplexExpand[#, TargetFunctions -> {Re, Im}] & //
  Simplify]

(*  (Sqrt[d/g]*(d*Pi + 
         2*Sqrt[(d - r)*r] - 
         d*ArcTan[d - 2*r, 
             2*Sqrt[(d - r)*r]]))/
   (2*Sqrt[2]*r)  *)
|improve this answer|||||
$\endgroup$
  • $\begingroup$ Worked on my version too. Thanks! $\endgroup$ – barrycarter Aug 21 '16 at 23:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.