0
$\begingroup$
{{x[t] -> 600 (t + I π t - 50 Log[50] + t Log[50] + 50 Log[50 - t] - t Log[-50 + t])}}

After solving a differential equation, I get an answer in a form where I want to get rid of irrational values. How can it be implemented? Function N doesn't help.

x0 = 15000; y0 = 10; m0 = 150; v0 = 210; G = 3; u = 600; g = 9.8;
v1[h_] := Sqrt[v0^2 - 2 g h];
t1[h_] := (v0 - v1[h])/g;
M[t_] := m0 - G t;
DSolve[{M[t] x ''[t] == G u, x[0] == 0, x'[0] == 0}, x[t], t] // FullSimplify
DSolve[{M[t] y ''[t] == -M[t] g, y[0] == h, y'[0] == v1[h]}, y[t], t] // FullSimplify

This is the full code fragment. I need to obtain a plot.

$\endgroup$
2
  • $\begingroup$ What was the equation? What irrational values do you mean? As posted your question is too vague to answer. $\endgroup$
    – m_goldberg
    Jun 1, 2015 at 14:08
  • $\begingroup$ In my equation was iPit, moderator edited my post addition of the tag code. I need to get rid of i (root of minus one). $\endgroup$
    – Mike
    Jun 1, 2015 at 16:55

2 Answers 2

3
$\begingroup$

EDIT: added detail for provided equations.

$Version

"10.1.0 for Mac OS X x86 (64-bit) (March 24, 2015)"

x0 = 15000; y0 = 10; m0 = 150; v0 = 210; G = 3; u = 600; g = 98/10;
v1[h_] = Sqrt[v0^2 - 2 g h];
t1[h_] = (v0 - v1[h])/g;
M[t_] = m0 - G t;

Clear[x, y]

x[t_] = x[t] /. DSolve[
     {M[t] x''[t] == G u, x[0] == 0, x'[0] == 0},
     x[t], t][[1]] // Simplify

enter image description here

This satisfies the equations in the DSolve:

{M[t] x''[t] == G u, x[0] == 0, x'[0] == 0} // Simplify

{True, True, True}

To identify the conditions for x[t] to be real,

Reduce[{Element[x[t], Reals], Element[t, Reals]}, t] // Quiet

t < 50

x[t_] = x[t] // FullSimplify[#, t < 50] &

enter image description here

Confirming the condition for x[t] real: for the Log to produce a real value, its argument must be positive, i.e.,

Reduce[-50/(t - 50) > 0, t]

t < 50

y[t_, h_] = y[t] /. DSolve[
     {M[t] y''[t] == -M[t] g, y[0] == h, y'[0] == v1[h]},
     y[t], t][[1]] // Simplify

enter image description here

In the equations in the DSolve the dependence on h is implicit. To substitute y[t, h] into the equations, define

y[t_] = y[t, h];

This satisfies the equations in the DSolve:

{M[t] y''[t] == -M[t] g, y[0] == h, y'[0] == v1[h]} // Simplify

{True, True, True}

To keep y[t, h] real, the argument of the Sqrt must be nonnegative.

Reduce[900 - 2 h/5 >= 0, h]

h <= 2250

Manipulate[
 Column[{Plot[{x[t], y[t, h]}, {t, 0, 300/7},
    AxesLabel -> {"t", "x(t),\ny(t, h)"},
    PlotRange -> {{0, 300/7}, {0, 5000}},
    PlotLegends -> {"x(t)", "y(t, h)"},
    ImageSize -> 324],
   NSolve[{y[t, h] == 0, 0 < t <= 300/7}, t][[1]]}],
 {{h, 0}, 0, 2250, 25, Appearance -> "Labeled"}]

enter image description here

Manipulate[
 ParametricPlot[{x[t], y[t, h]}, {t, 0, 300/7},
  PlotRange -> {{0, 17500}, {0, 2275}},
  AspectRatio -> 1/GoldenRatio,
  AxesLabel -> {"x(t)", "y(t, h)"}],
 {{h, 0}, 0, 2250, 25, Appearance -> "Labeled"}]

enter image description here

$\endgroup$
7
  • $\begingroup$ What does mean [[1]] in first DSolve x[t] ? $\endgroup$
    – Mike
    Jun 2, 2015 at 16:18
  • $\begingroup$ Evaluate the DSolve with and without the [[1]] and compare the results. Alternatively, select either the two left brackets or the two right brackets and press F1 for help. As for the Reduce, I used Mathematica version 10.1 on a Mac, perhaps you used a different version or a different operating system. $\endgroup$
    – Bob Hanlon
    Jun 2, 2015 at 16:47
  • $\begingroup$ I don't understand( Can u say me, on understandable language, what is it? Plz $\endgroup$
    – Mike
    Jun 2, 2015 at 17:08
  • $\begingroup$ Read the documentation for Part $\endgroup$
    – Bob Hanlon
    Jun 2, 2015 at 17:12
  • $\begingroup$ And this part M[t] x''[t] == G u? $\endgroup$
    – Mike
    Jun 2, 2015 at 17:17
0
$\begingroup$
DSolve[{M[t] x ''[t] == G u, x[0] == 0, x'[0] == 0}, x[t], t] // 
 FullSimplify[#, t < 50] &
(* {{x[t] -> 600 (t + (-50 + t) Log[-(50/(-50 + t))])}} *)

cancels the explicit imaginary term for t < 50. The imaginary term cannot be eliminated for larger t except by applying the boundary conditions in the first ODE at some t value greater than 50 rather than at t == 0.

$\endgroup$
2
  • $\begingroup$ You don't so much need to change the boundary conditions as the parameters. The original equations have a singular point when $t = m_0/G$ ($t = 50$ for the provided code.) I suppose there might be a solution that goes to a finite value in the neighborhood of $t = m_0/G$, in which case finely tuned boundary conditions at $t = 0$ would do the trick. $\endgroup$ Jun 2, 2015 at 14:06
  • $\begingroup$ @MichaelSeifert Perhaps, I should make clear that, so long as a singularity exists at t==50, the boundary conditions must be applied for t > 50 in order to eliminate the imaginary term there. $\endgroup$
    – bbgodfrey
    Jun 2, 2015 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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