Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Elementary Mechanics Using Python- 2015.pdf
Скачиваний:
2
Добавлен:
07.04.2024
Размер:
7.83 Mб
Скачать

4.1 Description of Motion

57

We implement these formulas directly in the program, and plot both data and model:

g = 9.8 # m/sˆ2 y0 = 1.6 # m

vt = -g*t

yt = y0 - 0.5*g*t**2 subplot(2,1,1) plot(t[0:imax],y[0:imax],’-r’); hold(’on’) plot(t[0:imax],yt[0:imax],’--b’); hold(’off’)

xlabel(’t [s]’) ylabel(’y [m]’) subplot(2,1,2)

plot(t([0:imax],v[0:imax],’-r’); hold on plot(t[0:imax],vt[0:imax],’--b’); hold(’off’)

xlabel(’t [s]’) ylabel(’v [m/s]’)

We use hold on to get both plots in the same figure (see Fig. 4.6e, f. Here we notice that the differences in y(t ) and v(t ) are more difficult to spot. Using the acceleration for comparisons was therefore a better approach to spot the differences. And an approach with a sound, physical basis, since we will later learn that differences in physics appear in differences in the accelerations.

Further work: We leave it to you to look more carefully at what happens during the bounce. Can you zoom in on the relevant area?

Comment: Notice that the data in this example were based on numerical results and not experimental data in order to get clear results. Experimental data will typically contain significant noise, which we did not want to include here. The program used to generate the data-set is makefallingtennisball.m.4

4.2 Calculation of Motion

Mechanics is about the motion of objects. Usually, we do not know the position as a function of time. Instead, we want to determine the motion based on measurements of the acceleration (or velocity); based on a mathematical expression for the acceleration; or based on a differential equation for the position. We therefore need tools to do the opposite of what we did above: We need tools to find the motion, x (t ), from the acceleration, a(t ), of an object (Table 4.3).

Discrete Integration

As lead developer of “The Rocket”, a new roller-coaster ride at a major themepark, you have fitted an accelerometer into a test-cart. The accelerometer records the

4http://folk.uio.no/malthe/mechbookmakefallingtennisball.m.

58

 

 

 

 

4 Motion in One Dimension

Table 4.3 Data from the motion of “The Rocket”

 

 

 

 

 

 

 

 

 

 

 

 

i

0

1

2

3

 

4

5

 

 

 

 

 

 

 

 

ti (s)

0.0

0.1

0.2

0.3

 

0.4

0.5

ai (m/s2)

0.00

1.43

2.80

4.13

 

5.62

7.21

acceleration of the cart at regular time intervals of 0.1 s. How can you use this data to determine the velocity and position of the test cart?

The problem is how to find the sequence of positions, x (ti ), from the sequence of accelerations, a(ti )? This is the reverse of what we have been doing so far, where we have estimated first the velocities and then the accelerations from the positions using numerical derivatives. Can we simply use the methods we have developed for numerical derivatives “in reverse”? The average acceleration from t1 = 0.0 s to t2 = 0.1 s is

a(t

)

=

v(ti + t ) − v(ti )

.

(4.27)

¯ i

 

t

 

(So far this is an exact result—we have not done any approximations yet). We can

“reverse” (4.27) to find an equation for the velocity at the time t = ti +

t :

v(ti + t ) − v(ti ) = a¯ (ti ) t

 

v(ti + t ) = v(ti ) + a¯ (ti ) t

(4.28)

This method would allow us to step one step forward in time from the time t = ti to the time t = ti + t , if only we knew the average acceleration of the time interval. Unfortunately, the accelerometer does not give the average, but rather the instantaneous acceleration of the cart, a(ti ). Let us ignore this distinction and approximate the average acceleration over the time interval by the instantaneous acceleration at the beginning of the time interval:

a¯ (ti ) a(ti ) ,

(4.29)

We are now in a position to use (4.28) to step forward in small steps of

t , calculating

the changes in the velocities of the cart as we go. However, finding the velocities only takes us part of the way—we also need to determine the positions, x (ti ), of the cart, from the velocities, v(ti ), calculated using (4.28). This time, we “reverse” the numerical derivative of the position:

x (ti + t ) − x (ti ) = v¯(ti ) t

 

x (ti + t ) = x (ti ) + v¯(ti ) t .

(4.30)

Where we again assume that the average velocity is approximately the same as the velocity we calculated in (4.28): v¯(ti ) v(ti ). We are now ready to use (4.28) and

3. At t = t1 +

4.2 Calculation of Motion

 

 

59

20

 

 

 

10

 

 

 

0

 

 

 

-10

 

 

 

0

5

10

15

15

 

 

 

 

 

10

 

 

 

 

 

5

 

 

 

 

 

0

 

 

 

 

 

0

0.2

0.4

0.6

0.8

1

Fig. 4.7 Illustration of the motion of “The Rocket”. The accelerations are illustrated for the whole time interval (top figure) and the time-resolution is shown by the squares representing the measurement points (bottom figure)

(4.30) to move forwards in steps of t . However, since these methods only give the increments in the velocity and the position, we need to know the first velocity of the cart, v(t0) = v0 and where the cart starts from, x (t0) = x0. This is called the initial conditions of the problem.5

We are now ready to find the velocities and positions, starting at the time t = t0 = 0.0s:

1.At t = t0 = 0.0 s, the velocity and position of the cart is given v(t0) = v(0.0 s) = 0.0 m/s, x (t0) = x (0.0 s) = 0.0 m.

2.At t = t0 + t = 0.1 s, the velocity of the cart is:

v(0.1 s) v(0.0 s) + a(0.0 s) t = 0.5 m/s ,

(4.31)

where the acceleration a(0.0 s) = 5.0 m/s2 is listed in the table Fig. 4.7. The position of the cart is:

x (0.1 s) x (0.0 s) + v(0.0 s) t = 0.0 m (4.32) t = 0.2 s, the velocity of the cart is:

v(0.2 s) v(0.1 s) + a(0.1 s) t = 0.9 m/s; ,

(4.33)

where the acceleration a(0.1 s) = 7.0 m/s is listed in the table in Fig. 4.7. The position of the cart is:

x (0.2 s) x (0.1 s) + v(0.1 s) t = 0.05 m ,

(4.34)

5Notice that we need two initial conditions, v(t0) = v0 and x (t0) = x0 to determine the position from the acceleration: This is because we need to first calculate the velocities, and this requires an initial condition of the velocities, and then calculate the position, and this also requires an initial condition, this time on the position.

60

4 Motion in One Dimension

where the velocity v(0.1 s) = 0.5 m/s was found in the previous step of the calculation.

This method is called Euler’s method for numerical integration, and it is sufficiently flexible and robust to solve most problems presented in this book!

In Euler’s method we find the position, x (ti ), and velocity, v(ti ), of an object as a function of time by a stepwise summation of the acceleration, a(ti ), and the velocity, v(ti ):

v(t0)

= v0

 

x (t0) = x0

 

 

. . .

 

 

v(ti +

t ) = v(ti ) + a(ti ) t

 

x (ti +

t ) = x (ti ) + v(ti ) t

(4.35)

We apply this method to find the position and velocities for the motion of “The Rocket”. The accelerations for the cart are stored in the file therocket.dat,6 where each line contains a time (in seconds) and an acceleration (in m/s2):

0.0000000e+000 2.7316440e-001

1.0000000e-001 1.4411079e+000

2.0000000e-001 2.6693138e+000

3.0000000e-001 4.2383806e+000

We read the data into Python find the time-step t from t2 t1, and apply Euler’s algorithm from (4.35) for each i starting from the initial condition x (t0) = 0 m and v(t0) = 0 m/s using a for-loop.

t,a = loadtxt(’rocket.dat’,usecols=[0,1],unpack=True); dt = t[1] - t[0];

n = length(t);

x = zeros(n,float); v = zeros(n,float);

x[0] = 0.0; # Initial value v[0] = 0.0; # Initial value for i in range(1,n):

v[i] = v[i-1] + a[i-1]*dt; x[i] = x[i-1] + v[i-1]*dt;

The resulting position and velocity plots are shown in Fig. 4.8.

The procedure presented here covers the most important topic in kinematics: How to determine the motion of an object given the acceleration of the object. This is important because you will later learn that the physics of a problem—the interactions between the object and other objects—gives the acceleration of the object. Given the acceleration it will be up to you to determine the motion—and you can do this using the methods provided here: Either by using Euler’s method (or more advanced

6http://folk.uio.no/malthe/mechbook/therocket.dat.

4.2 Calculation of Motion

Fig. 4.8 Illustration of the motion of “The Rocket”, showing the measured acceleration, and the calculated velocity and position

 

 

 

 

61

[M]

400

 

 

 

200

 

 

 

x

 

 

 

 

 

 

 

 

0

 

t [S]

 

]

60

 

 

/S

40

 

 

 

[M

 

 

 

 

 

 

 

v

20

 

 

 

 

 

 

 

]

20

 

t [S]

 

 

 

 

2

 

 

 

 

S

10

 

 

 

[M/

 

 

 

0

 

 

 

a

 

 

 

 

 

 

 

 

-10

 

 

 

 

0

5

10

15

 

 

 

t [S]

 

techniques) to solve the problem numerically, or by finding a solution to the problem based on the specialized techniques you have learned in calculus.

Formal Integration

A more formal formulation of the problem is to assume that we know the acceleration a(t ) of an object as a function of time. How do we find the position and velocity of the object in this case?

Again, we realize that we have already solved the “reverse” problem—we know that the acceleration is the time derivative of the velocity and that the velocity is the time derivative of the position. We find the velocity by integrating the definition of acceleration:

a(t ) = dt

 

t0

a(t ) dt =

t0

 

dt

dt = v(t ) − v(t0) ,

(4.36)

 

dv

 

t

 

t

dv

 

 

 

 

v(t ) = v(t0) +

t0t

 

 

 

(4.37)

 

 

a(t ) dt .

When we know the velocity as a function of time, we can find the position by integrating the velocity, starting from the definition of velocity:

v(t ) = dt

 

t0

v(t ) dt =

t0

 

dt

dt = x (t ) − x (t0)

(4.38)

d x

 

t

 

t

 

d x

 

 

 

 

x (t ) = x (t0) +

t0t

 

 

 

(4.39)

 

 

v(t ) dt .

62

 

4 Motion in One Dimension

If we insert v(t ) from (4.37), we get:

 

 

 

x (t ) = x (t0) + t0t [v(t0) + t0t

a(t ) dt ] dt

 

= x (t0) + v(t0)(t t0) +

t0t [ t0t

a(t ) dt ] dt .

(4.40)

These equations constitute the integration method to find the position x (t ) and velocity v(t ) given the acceleration a(t ) of an object:

 

v(t ) = v(t0) + t0t

a(t ) dt ,

(4.41)

x (t ) = x (t0) + t0t

v(t ) dt = x (t0) + v(t0)(t t0) + t0t [ t0t

a(t ) dt ] dt .

 

 

 

(4.42)

There is no need to memorize these equations. They follow from your knowledge of calculus. You only need to remember the definitions of the velocity as the time derivative of the position, and the acceleration as the time derivative of the velocity.

We can apply this method to find the motion for constant acceleration, a(t ) = a0, with initial conditions x (t0) = x0 and v(t0) = v0:

v(t ) = v(t0) + t0t

a0 dt = v0 + a0 (t t0) .

(4.43)

and

t0

v(t ) dt = x0 + v0 (t t0) +

2 a0 (t t0)2 .

 

x (t ) = x (t0) +

(4.44)

 

t

 

 

1

 

 

Differential Equations

Usually, we do not have a set of measurements or a mathematical expression for the acceleration. Instead, we find an expression for the acceleration based on a physical model of the forces acting on the object, and from the forces we find the acceleration. Given this expression for the acceleration, we determine the velocity and position of the object. But this sounds exactly like what we did above? We integrate the acceleration to find the velocity, and then integrate again to find the position. Unfortunately, direct integration only works if the acceleration is only a function of time. In most

4.2 Calculation of Motion

63

cases, we do not have an expression of the acceleration as a function of time, but instead we know how the acceleration varies with velocity and position. For example, a tiny grain of sand sinking in water has an acceleration on the form:

d2 x

 

dt 2 = a = −a0 c · v ,

(4.45)

where the acceleration depends on the velocity of the grain! And a ball suspended in a vertical spring has an acceleration:

d2 x

 

dt 2 = a = −C · x ,

(4.46)

that depends on the position of the ball. Such problems cannot be solved by direct integration, because the function x (t ) and its derivatives occur on both sides of the equation. Such equations are called differential equations. Finding analytical solutions of differential equations require some skill and experience, but, fortunately, we can solve them numerically in exactly the same way we did above.

Numerical Solution

In most mechanics problems, we want to find the position, x (t ), which satisfies an equation on the form:

 

dt 2

= a t , x ,

dt

, v(t0) = v0 , x (t0) = x0 ,

(4.47)

 

d2 x

 

d x

 

 

We find the solution by moving forwards in time in small increments

t . We start

from the initial values x (t0) = x0 and v(t0) = v0. We find the velocity and position

after a small time-step t

using Euler’s method (4.28):

 

v(t0 +

t ) v(t0) + a(t0, x (t0), v(t0)) t ,

(4.48)

x (t0 + t ) x (t0) + v(t0) t ,

(4.49)

where a(t0, x (t0), v(t0)) is the acceleration we get when we put the values at t = t0 into the expression we have for the acceleration in (4.47). We can now continue to step forward in time, finding subsequent values x (ti ) and v(ti ) in steps of t . This method is called Euler’s method. It is definitely not the best numerical method of integration—actually we strongly advice against using Euler’s method. It’s strength is rather in the simple, intuitive implementation. Surprisingly, changing the step in (4.49) to the following:

x (t0 + t ) x (t0) + v(t0 + t ) t ,

(4.50)