Excercise sheet 6 -- solutions

1. A baseball in free-fall

Continue the example of the lecture notes on the example for a baseball thrown straight up. We solved the equation
	(d^2) (y/d)(t^2) = a = 
          g,
with the initial conditions
	y(t = 0) = 0.

1.1. We were left with one constant undefined. Fix that constant by using the additional initial condition
	\(TraditionalForm\`d\(y(0)\)\/dt = \(\(y\& . \)(0) = 10  m/s\)\).

1.2. Find the highest point of the ball's path and the moment when the ball returns to the height it was thrown from.

Solutions

Clear[y, t];  
    g = -9.81;

    y[t_] = 
        y[t] /. Part[
            DSolve[{y''[t] == g, 
                y[0] == 0, y'[0] == 10}, y[t], t], 
            1];

    Print["y[t] = ", y[t]]

    Clear[g];

The highest point is where the speed of the ball is zero.

\(\(\( (*2*) \)\(
\)\(\(v[t_] = 
        D[y[t], t];\)

    Print[\*""\!\(y\_max\) = "", 
      y[t] /. Part[Solve[v[t] == 0, t], 
          1], " m"]

    Print[\*""\!\(t\_\(y = 0\)\) = "", 
      t /. Part[Solve[y[t] == 0, t], 2], " s"]\)\)\)

2. A brick falling in water

Continue the example on the brick dropped from a boat. Our differential equation for the position y of the brick was
	\(TraditionalForm\`F = \(m\ g - k\ y\& .  = m\ \(y\& .. \)\)\).

2.1. Set some sensible initial conditions for the brick's position, (i) solve the equation and give the constant some numeric values. (ii) Plot the solution. What do you find? Study the effect of changing the mass of the brick without chaning the coefficent k. (iii) Find the terminal velocity of the falling brick (hint: use the Limit-command, to tell that m and k are positive, give Assumptions->{k>0, m>0} to the command).

2.2. Solve the brick example numerically. Compare the numerical solution to the analytic one by plotting both solutions, or by comparing the values of ygiven by the two solutions.

Solutions

Clear[m, g, k, y, v, 
        t];

    y[t_] = 
        y[t] /. Part[
              DSolve[{m g - k y'[t] == m y''[t], 
                  y[0] == 0, y'[0] == 0}, y[t], t], 1] // 
          Simplify;

    Print["y[t] = ", y[t]]

    Plot[y[t] /. {m -> 10, k -> 0.5, g -> -9.81}, {t, 0, 
        100}]

    v[t_] = D[y[t], t];

    Limit[v[t], t -> Infinity, 
      Assumptions -> {k > 0, m > 0}]

m = 10; k = 0.5; 
    g = -9.81;

    Part[NDSolve[{m g - k z'[t] == m z''[t], 
          z[0] == 0, z'[0] == 0}, z[t], {t, 0, 100}], 1, 
      1]

    Plot[{z[t] /. %, y[t]}, {t, 0, 100}, 
      PlotStyle -> {Hue[0.2], Hue[0.8]}]

3. Flying rocket

3.1. Solve the rocket example, and plot the solution, but this time take into account the force due to air-resistence, \(TraditionalForm\`F\_air = \(\(-k\)\ v\^2 = \(-k\)\ \(\(x\& . \)(t)\)\^2\)\). Use k = 0.3 in your calculations. Is the equation of motion still linear? Compare the path of this rocket to the one studied in the examples.

Solutions

Here DSolve hangs, because the equation is far from linear, so we must seek a numerical solution. Note that if you try to solve this all the way to the end of the fuel, i.e. t -> 100, you get a warning for dividing by zero.

Clear[m, y, t, g, a, F, 
        k];

    m[t] := (Subscript[m, 0]) - a t;

    (Subscript[m, 0]) = 1000; g = -9.81; a = 10; F = 3000; 
    k = 0.01;

    (Subscript[y, 1]) = 
        Part[NDSolve[{F - m[t] g - k y'[t]^2 == m[t] y''[t], 
              y[0] == 0, y'[0] == 0}, y[t], {t, 0, 90}], 1, 
          1];

    (Subscript[y, 0]) = 
        Part[NDSolve[{F - m[t] g == m[t] y''[t], 
              y[0] == 0, y'[0] == 0}, y[t], {t, 0, 90}], 1, 
          1];

    Plot[{y[t] /. (Subscript[y, 1]), y[t] /. (Subscript[y, 0])}, {t, 0, 90}, 
      PlotStyle -> {Hue[0.1], Hue[0.9]}]

4. Frictionless and damped oscillators

4.1 Solve the frictionless
	\(TraditionalForm\`m\ \(x\& .. \) + k\ x = 0\)
and damped 
	\(TraditionalForm\`m\ \(x\& .. \) + γ\ x\& .  + k\ x = 0\)
oscillators with the same initial conditons. Plot both of them in the same coordinates. What do you find? Does the damping affect the frequency of the oscillations?

Solutions

From the picture it can be seen that the damping decreases the frequency of the oscillations.

Clear[m, k, x, t, γ, 
        s];

    (Subscript[x, 1]) = 
      Part[DSolve[{m x''[t] + k x[t] == 0, 
            x[0] == s, x'[0] == 0}, x[t], t], 1, 
        1]

    (Subscript[x, 2]) = 
      Part[DSolve[{m x''[t] + γ x'[t] + k x[t] == 0, 
              x[0] == s, x'[0] == 0}, x[t], t], 1, 1] // 
        FullSimplify

    m = 1; k = 1; γ = 0.3; s = 0.1;

    Plot[{x[t] /. (Subscript[x, 1]), x[t] /. (Subscript[x, 2])}, {t, 0, 30}, 
      ImageSize -> 500]

5. LC- and LCR-circuits

5.1. Continue the example on the LCR-circuits. The general analytic solution was given in the lecture notes. Now fix the constants and study the behaviour of the system by plotting the solutions. Vary the values for the components and see what happens.

Solutions

Clear[q, l, c, r, t];
Eq = 
        l q''[t] + r q'[t] + (1/c) q[t] == 
          0;
l = 0.01; c = 0.001; r = 0.5;
sol = 
        DSolve[{Eq, q[0] == 0.1, q'[0] == 0}, q[t], 
          t];
Plot[q[t] /. sol, {t, 0, 0.1}, PlotRange -> All]