"Action" from Data Points

In physics, the "action" is the time-integral of the difference between the kinetic energy E E and the potential energy U U .

S = t 1 t 2 ( E U ) d t \large{S = \int_{t_1}^{t_2} (E - U) \, dt}

Suppose we have a 1 kg 1 \, \text{kg} particle traveling in the x y xy plane. Gravity is 10 m/s 2 10 \, \text{m/s}^2 in the y -y direction, and the quantity U U represents the gravitational potential energy (measured relative to y = 0 y = 0 ).

The particle's ( t , x , y ) (t,x,y) coordinates are given in the linked text file (pastebin). What is the action for this trajectory?

Details and Assumptions:
1) Give your answer as a signed number in Joule-seconds
2) Neglect whatever force / potential (other than gravity) is responsible for the particle's trajectory


The answer is -35.754.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Duarte Esteves
Jul 19, 2018

Since we need to calculate a definite integral using a finite number of points, we should start by discretising: t 1 t 2 ( E U ) d t i ( E i U i ) Δ t = i E i Δ t i U i Δ t \int\limits_{t_1}^{t_2} (E-U) \textrm{ d}t \approx \sum_{i} (E_i - U_i) \Delta t =\sum_{i} E_i \Delta t -\sum_{i} U_i\Delta t

We can take Δ t = 0.001 s \Delta t = 0.001\textrm{ s} , since it was the time step used throughout the data file.

Now we need to calculate the kinetic energy, which is defined by E i = 1 2 m v 2 E_i = \frac{1}{2}m|\vec{v}|^2 , where v \vec{v} is the velocity. Since we are dealing with a 2-dimensional problem, we can decompose this vector in its x x - and y y -components, so that: v 2 = v x 2 + v y 2 , |\vec{v}|^2=v_x^2+v_y^2, where v x = d x d t v_x = \dfrac{\textrm{d}x}{\textrm{d}t} and v y = d y d t v_y = \dfrac{\textrm{d}y}{\textrm{d}t}

We can now approximate these derivatives using finite differences: d x d t ( t i ) x ( t i + Δ t ) x ( t i ) Δ t \dfrac{\textrm{d}x}{\textrm{d}t}(t_i)\approx \dfrac{x(t_i+\Delta t) - x(t_i)}{\Delta t}

Proceeding analogously for v y v_y , the kinetic energy yields: E i 1 2 m [ ( x ( t i + Δ t ) x ( t i ) Δ t ) 2 + ( y ( t i + Δ t ) y ( t i ) Δ t ) 2 ] E_i \approx \dfrac{1}{2}m\left[\left(\dfrac{x(t_i+\Delta t) - x(t_i)}{\Delta t}\right)^2+\left(\dfrac{y(t_i+\Delta t) - y(t_i)}{\Delta t}\right)^2\right]

And its time-integral is: i E i Δ t = i 1 2 m [ ( x ( t i + Δ t ) x ( t i ) Δ t ) 2 + ( y ( t i + Δ t ) y ( t i ) Δ t ) 2 ] Δ t = m 2 Δ t i [ ( x ( t i + Δ t ) x ( t i ) ) 2 + ( y ( t i + Δ t ) y ( t i ) ) 2 ] \sum_{i} E_i \Delta t = \sum_{i} \dfrac{1}{2}m\left[\left(\dfrac{x(t_i+\Delta t) - x(t_i)}{\Delta t}\right)^2+\left(\dfrac{y(t_i+\Delta t) - y(t_i)}{\Delta t}\right)^2\right] \Delta t = \dfrac{m}{2\Delta t}\sum_{i}\left[\left(x(t_i+\Delta t) - x(t_i)\right)^2+\left(y(t_i+\Delta t) - y(t_i)\right)^2\right]

The potential energy is simply: U i = m g y ( t i ) U_i = mgy(t_i)

Hence, its time-integral is: i U i Δ t = m g Δ t i y ( t i ) \sum_{i} U_i \Delta t = mg\Delta t\sum_{i} y(t_i)

We are now able to write and run a small Python script to perform the calculations for us:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#Some variables and initialisations
m = 1 #mass (kg)
g = 10 #gravity (m/s^2)
dt = 0.001 #time step (s)
length = 0 #line counter
data = [] #empty list to contain the data read from the file

#Opens the input file
with open('action_calc_data.txt') as input:  
    #Ignores the first line, since it is only a header containing the column labels
    next(input)
    #Runs a cycle to go through each line of the file
    for line in input:
        #Counts the number of lines, adding 1 to the 'length' counter; we need this number in order to bound our loops below
        length+=1
        #Splits each line of the file, using white spaces as separators, and appends it to the 'data' list
        data.append(line.split())

#Calculates the potential energy integral, performing a summation along the y column (whose index is 2)
integral_U = m*g*dt*sum(float(data[i][2]) for i in range(length))

#Calculates the kinetic energy integral, performing a summation along both the x and y columns (whose indexes are 1 and 2, respectively)
#Notice that the range argument must be length-1 instead of length; otherwise, when j=length-1, we would be accessing:
#data[length+1]=data[length+1-1]=data[length], which is out of range!
integral_E = .5*m/dt*sum((float(data[j+1][1])-float(data[j][1]))**2.0 + (float(data[j+1][2])-float(data[j][2]))**2.0 for j in range(length-1)) 

#Simply prints out our answer, which is the difference between the two integrals
print('The action is:\nS = ' + str(integral_E-integral_U) + ' J s') 

The action is:
S = -35.76439363705195 J s

So the answer to 3 significant figures is: S 35.8 J s S \approx -35.8 \textrm{ J s}

Nicely done. Thanks for posting this solution

Steven Chase - 2 years, 10 months ago

Log in to reply

Thank you, it was a really fun problem to solve! I would just like to point out that I believe there is a typo on the correct answer, as it states –35.754 instead of –35.764, or maybe I made a mistake somewhere. Also, on detail 1), I think it should say J s instead of J, since that is the correct unit for action.

Duarte Esteves - 2 years, 10 months ago

Log in to reply

Good catch. I changed it to "Joule-seconds". As for the numerical value, Brilliant has a 3% tolerance for decimal answers. Your answer and mine are only off by 0.03% (two orders of magnitude smaller than the tolerance), so it should be fine.

Steven Chase - 2 years, 10 months ago

improve more

improve more - 2 years, 9 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...