report ma124

Upload: kyle-byrne

Post on 18-Jan-2016

215 views

Category:

Documents


0 download

DESCRIPTION

It is what it is

TRANSCRIPT

  • MA124: Maths by Computer - Week 5

    Thomas Dove and Kyle Byrne

    February 8, 2015

    1 6A

    1.1 (a)

    The temperature T (t) at time t of a dead body lying outside satisfies the equa-tion

    dT

    dt= k(T (t) A(t)) (1)

    where k is an unknown rate of cooling. A(t) ,the fluctuation of outside temper-ature, is given by

    A(t) = 3 5 cos((t 2))

    where = 12 and t is the time of day measured in hours, with t = 0 corre-sponding to midnight. We can rearrange (1) into the form of a inhomogeneousfirst order differential equation as follows:

    dT

    dt+ kT = 3k 5k cos((t 2)) (2)

    Solving (2), we find the general solution for T (t) to be:

    T = 3 + Cekt 5kk2 + 2

    ( sin((t 2)) + k cos((t 2))) (3)

    where C is a constant to be solved.As at 7 a.m (t = 7) when the body is found, the temperature is measured to beat 20 degrees (T (7) = 20). Using this information we can then solve the initialvalue problem, and find a value for C.

    C = e7k(17 +5k

    k2 + 2( sin(5) + k cos(5)) (4)

    And so our particular solution for the temperature of the body at a given time(t) past midnight is:

    T (t) = 3 + (e7k(17 +5k

    k2 + 2( sin(5) + k cos(5)))ekt

    5kk2 + 2

    ( sin((t 2)) + k cos((t 2))) (5)

    1

  • 1.2 (b)

    We now get given that at 8 a.m (t = 8) that the temperature of the body hasdropped to 15 degrees, that is T (8) = 15. By substituting these conditions into(5), we can rearrange to find a formula for k.

    15 = 3 + (e7k(17 +5k

    k2 + 2( sin(5) + k cos(5)))e8k

    5kk2 + 2

    ( sin(6) + k cos(6)))

    12 +5k

    k2 + 2( sin(6) + k cos(6)) = ek(17 +

    5k

    k2 + 2( sin(5) + k cos(5))

    ek =17 + 5kk2+2 ( sin(5) + k cos(5)

    12 + 5kk2+2 ( sin(6) + k cos(6))

    And so:

    k = log17 + 5kk2+2 ( sin(5) + k cos(5)

    12 + 5kk2+2 ( sin(6) + k cos(6))(6)

    1.3 (c)

    Using Matlab, we are able to use the fixed-point iteration method to approxi-mate a value of k with an error of less than 104 of the actual rate of coolingof the body.By taking our initial guess for k to be 1, we approximate the value of k to be0.3339, with an error less than 104.

    Figure 1: Iterations for finding the cooling constant

    See attached m.file: coolconst.m

    2

  • 1.4 (d)

    With an estimate for the rate of cooling, we can now use (5), to gather an ap-proximate time of death. It is known that at the time of death, the temperatureof body would of been around 37 degrees. Hence by using the plotted functionof T (t), we can find a corresponding time for which the bodies temperature wasat 37 degrees, and so from this we can find the time of death.Using the function (5), by solving for time, we found for a temperature T = 37,the time corresponding to that temperature was t = 5.1083.This value for t, shows us the time of death was approximately 5:06 a.m.

    Figure 2: Temperature plot, showing the time of death

    See attached m.files: tplot.m , rateofcooling.m

    2 6B

    2.1 (a)

    J(t) =

    k=0

    (1)k(t/2)2k

    (k!)2(7)

    J is called the Bessel function.We can show that the Bessel function converges, as it is in the form

    k=0((1)k(ak)),

    where ak =(t/2)2k

    (k!)2 . As (ak) is decreasing and null, by the ratio test, we can

    determine that J(t) is convergent by the alternating series test.

    3

  • The Bessel Function can also be shown to satisfy the differential equation:

    tJ (t) + J (t) + tJ(t) = 0; for t R (8)

    By calculating the first and second derivative of J(t), we can then substitutethis into the differential equation to show it holds true.

    J (t) =

    k=1

    (1)kk(t/2)2k1

    (k!)2=

    k=1

    (1)k(t/2)2k1

    k!(k 1)!(9)

    J (t) =1

    2

    k=1

    (1)k(2k 1)(t/2)2k2

    k!(k 1)!

    =

    k=1

    (1)k(t/2)2k2

    ((k 1)!)2 1

    2

    k=1

    (1)k(t/2)2k2

    k!(k 1)!

    = k=0

    (1)k(t/2)2k

    ((k)!)2 1

    2

    k=1

    (1)k(t/2)2k2

    k!(k 1)!(10)

    by using the shift rule of sequences.And then by substituting into the differential equation we can show the Besselfunction satisfies it for all real values of t.

    tJ (t) + J (t) + tJ(t)

    = tk=0

    (1)k(t/2)2k

    ((k)!)2 1

    2t

    k=1

    (1)k(t/2)2k2

    k!(k 1)!+

    k=1

    (1)k(t/2)2k1

    k!(k 1)!+ t

    k=0

    (1)k(t/2)2k

    (k!)2

    = 12t

    k=1

    (1)k(t/2)2k2

    k!(k 1)!+

    k=1

    (1)k(t/2)2k1

    k!(k 1)!

    = k=1

    (1)k(t/2)2k1

    k!(k 1)!+

    k=1

    (1)k(t/2)2k1

    k!(k 1)!

    = 0

    The difficulty of plotting the power series over the solution to the differentialequation is that plotting a series from zero to infinity over many values of t (foraccurate plot, the number of values of time to be plotted would be in excess of500 values), and there to plot the function accurately would require a immenseamount of computation.

    2.2 (b)

    As (8) is a second order differential equation, we need to be able to recast itinto a system of first order differential equations so we are able to solve themusing Matlabs ode45 function.We can then recast the differential equation (8) by defining:

    y1(t) = J (11)

    y2(t) = J (12)

    4

  • and by using these, we can recast (8) into two first order differential equations.By differentiating (11) with respect to time:

    y1(t) = J

    which by substituting for (12), we get:

    y1(t) = y2(t) (13)

    The second recast differential equation can be obtained by first differentiating(12) and then rearranging (8). So by differentiating (11) with respect to time:

    y2(t) = J

    This can then be substituted into (8) and rearranged to obtain another firstorder ODE.

    tJ (t) + J (t) + tJ(t) = 0

    J (t) = J(t) 1tJ (t)

    y2(t) = y1(t) 1

    ty2(t) (14)

    So we now have a system of first order differential equations, (13) and (14) ,which can be plotted using the ode45 function in Matlab.The initial conditions for J(t) and J (t) (equivalent to y1(t) and y2(t) respec-tively) can be found using the Bessel Function (7) and using it to calculate thevalues for J(t) and J (t) at a time t = 0, giving us both initial conditions fory1(t) and y2(t).

    y1(0) = J(0) =

    k=0

    (1)k(0)2k

    (k!)2= 1

    y2(0) = J(0) =

    k=1

    (1)k(0)2k1

    k!(k 1)!= 0

    However the issue with starting from t = 0 when solving the differential equationusing Matlab, is that in (14) the coefficient for y2(t) is

    1t , and hence at t = 0

    this would make the differential equation (14) undefined. So the system ofdifferential equations would be only be solvable using Matlabs ode45 functionif the time t = 0 was not included.

    2.3 (c)

    By using Matlab, we can calculate the values of J(t) and J (t) at a time t = 1,to an error less than 104, by using the Bessel function and its first derivative.The values attained are as follows:

    J(1) = 0.765198

    J (1) = 0.440050both having an error less than 104 away from the true values for J(1) andJ (1).

    5

  • See attached m.files: j iterate.m , bessel.m , bessel diff.m

    2.4 (d)

    Using the values for J(1) and J (1) in (c), we can use them as initial conditions,and plot the function J(t) over the interval t [1, 50].

    Figure 3: The Bessel function, over the interval t [1, 50].

    Due to the shape of the graph being very similar to that of a cosine functionwith a exponentially decreasing amplitude, we can model it with a function ofthe form Ct cos (t+ ), for some constants C, and .

    6

  • Figure 4: Plot of t0.5 cos (t) (C = 1, = 0.5, = 0) (Red) against J(t) (Blue),over the interval t [1, 50].

    Figure 5: Plot of 0.6t0.7 cos (t 1) (C = 0.6, = 0.7, = 1) (Red) againstJ(t) (Blue), over the interval t [1, 50].

    7

  • Figure 6: Plot of 0.8t0.5 cos (t 1) (C = 0.8, = 0.5, = 1) (Red) againstJ(t) (Blue), over the interval t [1, 50].

    The function 0.8t0.5 cos (t 1), gave us the best approximation over a largerange of t.

    See attached m.files: resplot.m , resonance.m

    8