Using Ms Excel For Data Analysis and Simulation
Using Ms Excel For Data Analysis and Simulation
Introduction
The numerical calculations performed by scientists and engineers range from the very simple to the complex. MS EXCEL is a tool that facilitates numerical calculations and increases a scientist or engineers productivity. MS EXCEL can be used for numerical calculations, data analysis, graphics and programming in a single easy to use package. Getting high school students to use spreadsheets is a good starting point for them to emulate how scientists and engineers do some of their numerical processing and data analysis. In this workshop, you will use computer logging to gather experimental data. This data will be analysed using MS EXCEL using the trendline and the linest commands. You will learn how to format worksheets and charts to present information in scientific manner. MS EXCEL is a powerful program that can be used for creating your own simulations or for your students to create their own. The How Do The Planets Move? simulation will be discussed as an example of what can be done. MS EXCEL for Data Analysis In this workshop you will use a Universal Lab Interface (Vernier) to measure the period of an oscillating spring as a function of the mass attached to the end of the spring. The period will be measured from the displacement time graph. The data will be entered into MS EXCEL for analysis and for the determination of the spring constant. The following templates show how information and graphs can be formatted and analysed. MS EXCEL for Simulation MS EXCEL is an easy-to-use and powerful package for both teachers and students to use for creating their own simulations. In the class room, teachers can present a template of varying degrees of completeness for student use. To illustrate what can be done with MS EXCEL we will consider a simulation of How Do The Planets Move? How Do The Planets Move?, which incorporates Keplers Laws, was chosen because it is mentioned in a number of different modules The Cosmic Engine, Space, Geophysics and Astrophysics. The simulation can be downloaded from the Website http://www.physics.usyd.edu.au/teach_res/jp/jphysics.htm then click on the link MS EXCEL simulations & tutorials.
A 2
Oscillating Block - Spring system 3 Experiment: Determine the spring constant k m 4 Special characters T = 2 5 k alt 241 alt 171
6 7 8 9 10 11 alt 248 alt 253 Greek letters select characters - change font to symbol time interval t =5T (s) 0.0 1.6 2.3 2.8 3.2 3.6 3.9 4.2 4.5 4.7 5.1 subscript or supercript format / cells / font / subscript or superscript
mass m (g) 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
period T (s)
mass m (kg)
period2 T 2 (s2) 0.0 0.10 0.21 0.31 0.41 0.52 0.61 0.71 0.81 0.88 1.04
(T 2)
0 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1
0 0.32 0.46 0.56 0.64 0.72 0.78 0.84 0.90 0.94 1.02
0 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02
0.000 0.050 0.100 0.150 0.200 0.250 0.300 0.350 0.400 0.450 0.500
0.0 0.01 0.02 0.02 0.03 0.03 0.03 0.03 0.04 0.04 0.04
copy & paste special values to plot XY data graph 1 X Y error bars mass m period T t (kg) (s) 0.000 0.0 0 0.050 0.3 0.1 0.100 0.5 0.1 0.150 0.6 0.1 0.200 0.6 0.1 0.250 0.7 0.1 0.300 0.8 0.1 0.350 0.8 0.1 0.400 0.9 0.1 0.450 0.9 0.1 0.500 1.0 0.1 graph 2 X Y error bars mass m period2 (T 2) (kg) T 2 (s2) 0 0 0 0.050 0.10 0.01 0.100 0.21 0.02 0.150 0.31 0.02 0.200 0.41 0.03 0.250 0.52 0.03 0.300 0.61 0.03 0.350 0.71 0.03 0.400 0.81 0.04 0.450 0.88 0.04 0.500 1.04 0.04
32 33 34 Borders 35 Format / Cells / 36 Border 37 38 39 40 41 42 43 44 45 Analysis =linest(G32:G42,F32:F42,true,true) 46 slope 2.02 0.00 intercept slope 47 0.03 0.01 intercept SHIFT+CTRL ENTER 2 R 48 0.998 0.01 49 50 slope 2.03 0 intercept =linest(G32:G42,F32:F42,false,true) 51 slope 0.01 #N/A intercept 2 R 52 0.998 0.0136072 SHIFT+CTRL ENTER 53 2 54 slope = 4 / k slope / slope = k / k 55 2 k = k (slope / slope) 56 k = 4 / slope Printing 57 * Select data to be printed - print only -1 -1 k = 0.259961 N.m k = 19.55292 N.m 58 selection 59 * Page Setup - print to a page, headings, -1 gridlines etc k = (19.6 0.3) N.m 60 61 62 63 64 65 Significant figures * uncertainty 1 digit (usually) * value & uncertainty same no. decimal places
period of oscillation T
Error bars * Format series Format axes * Font sizes * Significant figues * Scales * Crossing of axes
0.10
0.20
0.30
0.40 (kg)
0.50
0.60
mass of block m
Block - Spring System 1 1 period2 T 2 (s2) 1 1 0 0 0 0.00 Trendline * Chart / Add Trendline * Options equation intecept 2 R value * Format numbers
0.10
0.20
0.40
0.50
0.60
Keplers First Law A planet describes an ellipse with the Sun at one focus. But what kind of an ellipse do planets describe? It turns out they are very close to circles. The path of the planet nearest the Sun,Mercury, differs most from a circle, but even in this case, the longest diameter is only 2% greater than the
Ian Cooper School of Physics, The University of Sydney
shortest one. Bodies other than the planets, for example comets, move around the Sun in greatly flattened ellipses. Since the Sun is located at one of the foci and not the centre, the distance from the planet to the Sun changes noticeably. The point nearest the Sun is called the perihelion and the farthest point from the Sun is the aphelion. Half the distance from the perihelion to the aphelion is known as the semimajor radius, a. The other radius of the ellipse is the semiminor radius, b. The Path of A Planet Around the Sun is an Ellipse x2 / a2 + y2 / b2 = 1. Keplers Second Law Each planet moves so that an imaginary line drawn from the Sun to the planet sweeps out equal areas in equal periods of time. This law results from the Law of Conservation of Angular Momentum Angular momentum = L = m v r = constant, where m is the mass of the planet, r is the distance from the Sun and v is the tangential velocity of the planet. Angular momentum is conserved because the force acting on the orbital body is always directed towards the centre of the coordinate system (0,0), i.e., the Sun. Thus, this force cannot exert a torque (twist) on the orbiting body. Since there is no torque acting, the orbital angular momentum must remain constant. Since a planet moves in an elliptical orbit, the distance r is continually changing. As it approaches the Sun the planet must speed up and as it gets further away from the Sun it must slow down such that the product v r = constant. The area of each triangle (for a small time interval dt) can be expressed as Al = 1/2 (vl dt) rl A2 = 1/2 (v2 dt) r2 A1 / A2 = vl rl / v2 r2
Since angular momentum must be conserved, L = m v1 rl = m v2 r2, so A1 / A2 = 1. Therefore, in equal time intervals, equal areas are swept out. Keplers Third Law For an orbiting planet, the centripetal force results from the gravitational attraction between the planet and the Sun Centripetal force = Gravitational force m v2 / a = G MS m / a2
v2 = G M S / a v = a , =2f=2/T
v2 = (4 2 / T2 ) a2 = G MS / a T 2 = (4 2 / G MS ) a3
Activity 1
What is the relationship between a planets period and its mean distance from the Sun? (A planets mean distance from the Sun is equal to its semimajor radius). Kepler had been searching for a relationship between a planets period and its mean distance from the Sun since his youth. Without such a relationship, the universe would make no sense to him. If the Sun had the power to govern a planets motions, then that motion must somehow depend on the distance between the planet and Sun, BUT HOW? By analysing the planetary data for the period and mean distance from the Sun, can you find the relationship? Planet Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune Pluto Mean Distance from Sun a (m) 5.79l010 1.081011 1.501011 2.281011 7.781011 1.431012 2.861012 4.521012 5.901012 Period T (s) 7.60106 1.94107 3.16107 5.94107 3.74108 9.35 l08 2.64109 5.22109 7.82109
From laboratory experiments it is possible to find a value for the Universal Gravitational Constant. Its value is G = 6.6710-11 N.m2.kg2. Using this value and the data on the orbital motion of the planets, determine the mass of the Sun, M S.
Activity 2
Computer Simulation
HOW DO THE PLANETS MOVE ?
Load the Worksheet centralforce.xls. The equation of motion for a planet can be solved using the numerical method described in Appendix 2. To simplify the calculations, the product GMS is taken as l, that is, the equation of motion is expressed as F = m / r2 a = 1 / r2 .
The initial conditions for the motion are: initial x position, xo = 1 initial y position, yo = 0 initial x velocity, vox = 0 maximum time for orbit, tmax ~ 40 (needs to be adjusted to show one orbit). Vary the value of the initial velocity in the y direction suggested values: voy = 1.0 1.2 1.3 1.4 0.9 0.8 0.6 0.4 Values can be changed on the Worksheet called Display. From the results of the spreadsheet calculations, answer the following questions. 1. For each set of initial conditions describe the trajectory of the planet. 2. Is Keplers First Law obeyed for each of the above initial conditions (voy)? Explain your answer. 3. What is the significance of the spacing of the dots showing the trajectory of the planet? Comment on the velocity of a planet for a circular orbit. Comment on the velocity of a planet for an elliptical orbit. 4. What is the direction of the force on the planet at each point in its trajectory? The following questions are for the elliptical orbit with voy = 1.3. 5. From the graph, test that the orbit is actually an ellipse. Test any three points on the graph. An ellipse satisfies the condition that the sum of the distances from any point on it to the two foci is a constant. 6. From the numerical results, what are the maximum and minium velocities? Where is the planet moving most rapidly? What is this point called? Where is the planet moving most slowly? What is this point called? Mark these positions on the graph. 7. From the numerical data, test Keplers Second Law. 8. From the numerical data, what is the length of the semimajor radius and semiminor radius?
9. From the numerical data, what is the period of revolution of the planet? 10. Using Keplers Third Law, what is the period of revolution of the planet? 11. How well do the two estimates of the period agree? Trajectory of planet for voy = 1.3
4 3 2 1 Y 0 -1 -2 -3 -4 -6 -5 -4 -3 -2 X -1 0 1 2
Keplers Third law may be written in the form T = k an where the constants k and n can be determined by analysing the data. The data of the mean distance from the Sun and the corresponding period for each planet is plotted as a linear graph and the trendline (power) is fitted to the data. The equation of the fitted curve is T = 5.110-10 a1.50 (correlation coefficient = 1) n = 1.5 = 3/2 k = 5.5110-10 s From the k value the mass of the Sun is MS = 1.951030 kg
Kepler's Third Law
9.0E+09 8.0E+09 7.0E+09
y = 5.509E-10x1.500E+00 R2 = 1.000E+00
period T (s)
1.0E+12
2.0E+12
3.0E+12
4.0E+12
5.0E+12
6.0E+12
7.0E+12
A straight line graph can be obtained by plotting log(T) against log(a). A trendline (straight line) can be fitted to the graph and the linest command can be used to determine the slope and intercept of the fitted line plus the uncertainties in the slope and intercept. The values are n = (1.4996 0.0004) k = (5.51 0.06) 10-10 s MS = (1.95 0.04) 1030 kg The accepted value for the mass of the Sun is 1.9871010 kg.
10
8.5 8.0 7.5 7.0 6.5 6.0 10.0 10.5 11.0 11.5
log( a )
12.0
12.5
13.0
Testing Keplers Third Law T = k an Mean distance from Sun a (m) 5.79E+10 1.08E+11 1.50E+11 2.28E+11 7.78E+11 1.43E+12 2.86E+12 4.52E+12 5.90E+12
Planet Mercury Venus Earth Mars Jupiter Saturn Uranus Nepture Pluto
Period T (s) 7.60E+06 1.94E+07 3.16E+07 5.94E+07 3.74E+08 9.35E+08 2.64E+09 5.22E+09 7.82E+09
log(a) 10.76 11.03 11.17 11.36 11.89 12.16 12.46 12.66 12.77
log(T) 6.88 7.29 7.50 7.77 8.57 8.97 9.42 9.72 9.89
Linest - curve fitting n= 1.4996 -9.25894 = log(k) n = 0.0004 0.004627 = log(k) 1 0.000829 n / n % = 0.03 k= 5.51E-10kmax = kmin = MS = MS = min MS = max MS = 4 2(/k2 G) 1.95E+30kg 1.99E+30kg 1.91E+30kg 5.57E-10s 5.45E-10s
6.67E-11N.m2.kg-2 1.95E+30kg
4 2(/k2 G)
11
Answers to Activity 2
Computer Simulation
1. For each set of initial conditions describe the trajectory of the planet. 1 2 3 4 voy = 1.0 voy = 1.2 voy = 1.3 voy = 1.4 Circular orbit Elliptical orbit perihelion at x = 1 aphelion at x = 2.6 Elliptical orbit perihelion at x = 1 aphelion at x = 5.5 Escapes - The initial speed of the planet is so large, the gravitational force cannot bend the trajectory into a bound orbit. The planet escapes on a path approaching a straight line and with a speed that approaches a constant value as it gets further from the Sun. This happens because the force acting between the two bodies decreases rapidly as their separation increases, so that before long the moving body has effectively escaped the influence of that force. Elliptical orbit aphelion at x = 1 perihelion at x = 0.7 Elliptical orbit aphelion at x = 1 perihelion at x = 0.5 CRASH planet is moving too slowly and the planet crashes into the Sun
5 6 7
2. Is Keplers First Law obeyed for each of the above initial conditions? Explain your answer. Keplers First Law is not obeyed for all initial conditions. If the planet is moving just at the right speed, the orbit is circular. If the planet initially is moving slightly more rapidly, then the orbit will be elliptical with the trajectory outside that of the circular orbit. If the planet initially is moving slightly more slowly, then the orbit will be elliptical with the trajectory inside that of the circular orbit. If the planet is initially moving too rapidly, the planet escapes from the Sun or if moving too slowly it will crash into the Sun and Keplers First Law does not hold in the last two cases. 3. What is the significance of the spacing of the dots showing the trajectory of the planet? Comment on the velocity of a planet for a circular orbit. Comment on the velocity of a planet for an elliptical orbit. The spacing of the dot is a measure of the average speed of the planet at that location. The dots are equally spaced for the circular orbit. Hence, the orbital speed of the planet is constant. The spacing of the dots is not regular. As the planet approaches the perihelion, the dots are widely spaced. This indicates a large speed compared to when the planet approaches the aphelion where the dots are closely spaced and the speed is smaller. 4. What is the direction of the force on the planet at each point in its trajectory? The direction of the force on the planet is always directed to the centre of the coordinate system (0,0) i.e., to the Sun that is located at one of the foci of the ellipse. The following questions are for the elliptical orbit for voy = 1.3. 5. From the graph, test that the orbit is actually an ellipse. Test any three points on the graph. An ellipse satisfies the condition that the sum of the distances from any point on it to the two foci is a constant. 12
An ellipse satisfies the condition that the sum of the distances, d from any point on it to the two foci is a constant. P1: d = (36 + 50) mm = 86 mm P2: d = (58 + 27) mm = 85 mm P3: d = (18 + 70) mm = 88 mm 6. From the numerical results, what are the maximum and minium velocities? Where is the planet moving most rapidly? What is this point called? Where is the planet moving most slowly? What is this point called? Mark these positions on the graph. Maximum velocity = 1.30 Minimum velocity = 0.24
The planet is moving most rapidly at the perihelion. The planet is moving most slowly at the aphelion. 7. From the numerical data, test Keplers Second Law.
From the numerical data, the product v.r is essentially constant, indicating conservation of angular momentum and hence equal areas swept out in equal time intervals. 8. From the numerical data, what are the lengths of the semimajor and semiminor radius? a = (1.00 + 5.46)/2 = 3.2 9. b = (2.41 + 2.26) = 2.3
From the numerical data, what is the period of revolution of the planet? T = (2)(19.0) = 38
10.
Using Keplers Third Law, what is the period of revolution of the planet? T = {(42 / GMS) a3)}1/2 GMS = l, a = (3.2 0.1) T = (36 2)
11.
How well do the two estimates of the period agree? T = 38 from the numerical data T = (36 2) from Keplers Second Law agreement
13
Appendix 2
can be solved numerically to find the position of the particle as a function of time. In this numerical method, approximations to the first and second derivatives are made. Consider a single-valued continued function (t) that is evaluated at N equally spaced points x1, x2, , xN. The first and second derivatives of the function (t) at the time tc where c is an index integer, c = 1, 2, 3, , N are given by Eqs. (A2) and (A3) respectively. The time interval is t = tc+1 tc.
d (t ) (t c +1 ) (t c1 ) = 2t dt t= t c c = 2,3,...,N -1
d 2 (t ) (t c +1) 2 (t ) + (t c1) = 2 t 2 dt t= t c
(A2)
c = 2,3,...,N -1.
(A3)
To start the calculation one needs to input the initial conditions for the first two time steps. The force acting on the planet is given by the Law of Universal Gravitation and therefore, the equation of motion of the planet is m a = G MS m / r2 Thus, the acceleration in vector form is a = (G MS / r3) r Squaring both sides a2 = (GMS / r3)2 r2 = (GMS / r3)2 (x2 + y2). Therefore, the x and y components of the acceleration are ax = (GMS / r3) x ay = (GMS / r3) y.
Using eq (A3) we can approximation the position of the planet by x(t + t) = 2t GMS x(t) / {x(t)2 + y(t)2}3/2 + 2x(t) x(t t), y(t + t) = 2t GMS y(t) / {x(t)2 + y(t)2}3/2 + 2y(t) y(t t). Once, the position is known then the velocity can be calculated from eq (A2) vx(t) = {x(t + t) x(t t)} / 2t The acceleration is calculated from ax(t) = (GMS / r(t)3) x(t) ay(t) = (GMS / r(t)3) y(t) r(t)2 = x(t)2 + y(t)2. vy(t) = {y(t + t) y(t t)} / 2t .
14
15