(*******************  filename: nbProcEqS.m (S := R/Rmin)  *******************)

USimplify[x_] := Simplify[x, Assumptions -> {Meter > 0, Centimeter > 0,
                                             Second > 0, Year > 0}]

term1[t_] := USimplify[c^2 A/3 Second^2] S[t]

term2[t_] := (N[USimplify[2 c^2 B Second^2],1000]/N[(3 Rmin^6),1000])/S[t]^5

Anum = USimplify[A Centimeter^2]; Smin = 1

If[N[N[Anum,1000]] >= 0, S0 = Smin,
   S0 = USimplify[
      Input["For S(0) enter either \"Smin\" (without quotes; to start
integration at a bounce) or \"Smax\" (without quotes; to start integration at
maximum expansion):  "]] ]

state = First[NDSolve`ProcessEquations[
              {Sdot'[t] == term1[t] + term2[t],
                  S'[t] == Sdot[t],
                   S[0] == S0, Sdot[0] == 0},
              {S, Sdot}, t,
              AccuracyGoal -> 50, PrecisionGoal -> 50,
              WorkingPrecision -> 100, MaxSteps -> Infinity]]


newtimeused = TimeUsed[] - totaltimeused

totaltimeused = totaltimeused + newtimeused

Print[StringForm["Time used this run  = `` = ``",
                  newtimeused seconds, (newtimeused/60) minutes]]

Print[StringForm["Total time used = `` = ``",
                  totaltimeused seconds, (totaltimeused/60) minutes]]

Print[StringForm["Memory in use = ``",
                  N[MemoryInUse[]/2^20,7] megabytes]]

(*************************  End of file nbProcEqS.m  *************************)
