from a skydiver to radioactive decay

advertisement

Y2 Computational

Physics Laboratory

Exercise 2

Numerical methods: from a skydiver to radioactive decay

Aims and objectives:

To introduce students to further basic numerical methods for problem solving,

To acquire further understanding of some of the pitfalls of numerical techniques

To acquire further experience of writing programs in C++, which solve real, physical problems

1 mark given for overall presentation

Duration: 3 weeks

Hand-in date: At the start of session in week beginning 15 th .

November

Introduction

The aim of this exercise is to further build on your programming skills by introducing some numerical methods , here for solving first-order differential equations.

Numerical methods can have a key part to play in academic and industrial research programs, and therefore have wide application in computational problem solving. One example is finding the equilibrium solutions for the structure of a star from the differential equations that describe its fundamental characteristics.

The equations in this exercise describe two very different physical systems: first, an object falling in a gravitational field, which experiences drag; and second, decay of radioactive particles. You will write programs to solve for the velocity (first problem) and number of particles (second problem) over time, using a numerical technique called Euler’s method.

Systems have been chosen for which the equations have analytic solutions. This will allow you to compare your numerical results with the actual values. Discrepancies can often result, and these give insight into some of the pitfalls lurking when techniques are used inappropriately.

Supporting information: Euler’s Method

Suppose we have some function, f ( x ), whose first derivative we wish to determine, at x (Figure 1). One way to do this would be to evaluate the function at x , and x + h , where h is some small increment, and then take the so-called Newton quotient:

 f ( x

 h )

 f ( x )

/ h .

As h tends to zero, so the quotient approaches the first derivative, df / dx . The Newton quotient may therefore be used to determine the derivative numerically (Euler’s method). Dependent on the function in question, some care must be taken over choosing an appropriate value for h .

f ( x + h )

f ( x ) h

x x + h

Figure 1: Evaluation of the Newton quotient for some function f (x)

Problem 1: Free fall motion with air resistance

The first problem we consider is the description of the motion of a skydiver, jumping from an aeroplane. We will ignore horizontal motion, and concentrate upon the vertical motion of the skydiver, taking into account two forces: gravity, and air resistance. On the assumption that the resistive force is proportional to the square of the velocity of the diver (a more accurate description raises the velocity to the power

9/5), we have: m dv dt

 mg

  v

2

. [1]

In the above: m is the mass of the diver, g the acceleration due to gravity, and

is some constant of proportionality. Equation [1] can be tidied slightly to give: dv

 g

 kv

2

, [2] dt where k =

/ m . Equation [2] can be solved by numerical means, via the application of Euler’s method. This is done by replacing the derivative on the left-hand side of the equation by its Newton quotient, i.e

.,

[ v ( t

 h )

 v ( t )] / h

 g

 kv

2

. [3]

Re-arrangement gives: v ( t

 h )

 v ( t )

 h [ g

 kv

2

] . [4]

If we know the velocity at the start of the motion, v ( t = 0), we can therefore use

Equation [4] to estimate the velocity at the later time, v ( t + h ); and then use this estimate as the starting offset (on the right-hand side) to estimate v ( t + 2 h ); and so on.

Equation [2] has an analytical solution. This means we can compare the actual values from this solution with those generated by the numerical technique, and in so doing assess the accuracy of the latter.

The problem

 what is required?

1.

Write a C++ program to compute the vertical component of velocity, v , of the skydiver as a function of time. The program should use Euler’s method on

Equation [2] to solve for v . You may assume the diver weighs ~100 kg, and that the coefficient

= 0.4. Furthermore, you may assume the aeroplane was moving horizontally when the diver jumped.

2.

Your program should compute v at several intervals of time over the first 30 sec of the motion. The precise values of t at which this is done will depend on your choice of h . You should try several different values of h . In order to assess the impact of this choice on the accuracy of your estimates, you should compare with the actual values of the velocity from the analytical solution of Equation [2]: v ( t )

 

1

 exp (

2 k

 t )

 

1

 exp (

2 k

 t )

. [5]

In the above, the constant:

  g / k .

The analytical prediction for each time, t , should also be output by the code.

Your write-up

 what is needed?

1.

You should include a printout of your code, and a brief description of it. Detail should be sufficient to allow the marker to easily follow, and understand, the logic and function of the code. The code itself should be well commented. [2 marks]

2.

You should include output of the estimated velocity, and the actual velocity (from

Equation [5]) as a function of time, for at least one value of h . There should also be a brief discussion of the impact of the choice of h on the accuracy of Euler’s method. [2 marks]

3.

You should solve Equation [2] analytically, and include a clearly laid out proof in your book. [1 mark] You will need to make use of the integral identity:

 2 dv

 v

2

1

2

 ln

 v

 v

.

What is the physical significance of

[0.5 marks] ?

Problem 2: Opening the parachute

Let us assume our intrepid diver opens their parachute after 30 seconds of ‘free fall’.

This at once increases the coefficient,

, to about 30!

The problem

 what is required?

1.

Modify your C++ program to provide new ‘starting’ values of t = 30 sec, and v ( t

= 30 sec), the latter computed from Equation [5]. Compute the velocity for several increments of time after this, using a ‘typical’ value of h from your previous investigation, and

= 30.

2.

Dependent on your choice of h , you will probably find that the program generates non-sensible, non-physical estimates of v

 why is this? Think about the ‘shape’ of the function, and the effect the size of h has on the calculations. Can you find values of h that will give robust estimates for v when the parachute is open?

Your write-up

 what is needed?

1.

You should include a brief discussion of the effect of h on the results. (Hint: think about the derivative of the function.) Also describe what you found with your initial choice of h ; and give the values that in the end gave sensible results, saying why they did so. [1.5 marks]

Problem 3: Radioactive Decay

Radioactive decay is modelled by the simple differential equation: dN

  

N . dt

In the above, N is number of nuclei, dN the number that decay in time dt , and

is the so-called decay constant.

The problem

 what is required?

1.

Write a C++ program to solve for N as a function of time, by application of

Euler’s method. (This requires a few modifications to your previous code.)

2.

How do the estimated values compare with the analytical predictions? Compute

30 or so values, and take an initial value of N =1000, and

= 0.5. Fractionally speaking, is the accuracy better, or worse, than for the diver problem? Why is there a difference? (Hint: think about the derivative of the function.)

Your write-up

 what is needed?

1.

You should include a printout of your code, and a brief description of it. Detail should be sufficient to allow the marker to easily follow, and understand, the logic and function of the code. The code itself should be well commented. [1 mark]

2.

You should include output data (Euler and analytical prediction) from your code, and explain why there is a difference in accuracy compared to the diver problem.

[1 mark]

Download