Names: Alexander Morrison, Maximilian Cytron, Rudy Navarro, Joss Masilang, Michael Camilo
For the final project for physics our professor tasked us with working with a group to write, solve and to code a project with its solutions. For our project specifically we were tasked with solving questions involving a pulley system. The pulley we are working with has a mass m and a bucket of water on the other end. At the time of 0 (t=0)the mass of the water is denoted by M0.The water coming out of the bucket is represented by , the mass of the water in the bucket is represented is represented by the expression of M(t)=M0-t and according to the prompt the mass of the bucket +Mo>m.
With this information we can work around for a solution but first we are to understand the moving components to this problem. The bucket of water is constantly moving or falling down because of gravity. As the water in the bucket increases the bucket becomes heavier. Don’t forget the other mass on the other end because that mass doesn’t change, so if the mass of the bucket increases the mass attached to the pulley will rise up.
We are tasked with solving for various quantities which include the acceleration of the system at any given moment of time, an expression of velocity at any moment of time, the maximum velocity of the object system and then finally graphing those systems.
We are given some numerical values which were, m=10 kg, M0=20 kg, =1 gram/s and the mass of the bucket is 20 grams.
Free body diagrams are an illustration of the relationship between all forces being applied to an object or mass. They are constantly used to understand the relationship between all areas of the motion of an object. In this case the aspects illustrated in the diagram are tension, a constant mass, gravity, as well as another constantly changing mass. The aspects of the free body diagram can be quantified into equations as seen in figure 1.
The acceleration of the system is derived from the equations illustrated in the free body diagram. In this case it involves the changing mass, which has to be accounted for. The method to solve for acceleration of this system is direct substitution, in which the forces collected from the free body diagram are summed, and solved for acceleration itself (see equation below).
∑F = ma
a = [(Mb + Mo -λt-m)g] ➗ [(Mb + Mo -λt+m)g
The velocity of a system is a direct component of the acceleration, as deriving the velocity over time equates to the acceleration of the system. In order to solve for the velocity of this ever changing system, the equation for acceleration must be integrated. The integration of an ever changing mass system must implore many different methods of solving. These include u substitution and switching out variables. Once the equation for velocity is acquired the max velocity must be solved for. For this case, the velocity equation must be set to zero and solved for time. At this point t, is when the max velocity is reached. The final step would be to plug back in t to the original velocity equation, giving the max velocity.
Transcendental Functions (Equation 1 Example) are functions that cannot be expressed through the simple use of algebraic expressions such as addition, subtraction, multiplication, ect. As a result code is needed in order to solve for the function itself. One of the first steps is understanding the bisection rule. The first step to the bisection rule is to determine the range of the function in which 0 is contained (the closer the numbers are the better). This first step includes finding the two numbers(X1 and X2) that when plugged into the function equate to a negative and positive value. Then, in order to get closer and closer to 0, the numbers get constantly closer and closer to one another, using a while loop, eventually (depending on the sig figs expressed in the code) closest values of X1 and X2 to zero. These values as close as it gets are plugged into the equation, giving the resultant.
(Equation 1)
log(ax) - bx = 0
A = 10 a = 1 b = 1
This problem was an in depth examination of how forces react with a constantly changing mass. As forces are applied the time will change, this change in time has a direct effect on the mass of object M(t). An increase in time, lowers the total mass of the object itself. While the other object (m) remains constant the entire motion. The components needed to solve for are acceleration, velocity and max velocity.
The first step in solving this problem is to determine the equation of acceleration. To begin with, setting up the free body diagrams correctly is vastly important. Once the free body diagrams are set up, the next step is to determine the direction of the motion. In this case it is used to get rid of the variables not needed (aka tension). Then, the equations for the motion are summed, then solved for acceleration. See figure 1 for the equations separately. See figure 2 for the entire equation.
*Figure 2
a=[(mb+mo+λt-m)g] ÷ (mb+mo+λt+m)
Following the equation for acceleration, the velocity equation must be determined as well. In order to obtain this new equation, the equation for acceleration must be integrated. In order for this integration to occur some steps must be taken to make it more easily understood. These include taking as many constants as possible and turning them into new variables. In this case the variables changed are a= (mb+mo-m) and b = (mb+mo+m). After making this slight change it gets plugged into the equation *See figure 3. The next main adjustment that needs to be made is to use u substitution where u = (b-λt). After the u substitution its all a matter of plugging changed variables to their original substitutes.
Solving for max velocity is the next step to answering the entire problem. In order to begin this the first thing that must be done is solving for time. The acceleration is set to 0, then solved for time. After time is solved for, the newly found equation for t can be plugged into the velocity equation. After plugging the new equation for time in all areas of velocity, the max velocity can be simply calculated using all the knowns from the material given. *See figure 4.
import math
import numpy as np
def func(x, A=10, a=1, b=1, c=1, d=1):
return A * np.log(c + a*x) - (d + b*x)
def bisect(A,a,b,c,d,tol=1e-6,x1=1,x2=2):
y = tol
it = 0
while abs(y) >= tol:
y1 = func(x1,A=A, a=a, b=b, c=c, d=d)
y2 = func(x2,A=A, a=a, b=b, c=c, d=d)
x = (x1 + x2) / 2
y = func(x,A=A, a=a, b=b, c=c, d=d)
if np.sign(y) == np.sign(y1):
x1 = x
elif np.sign(y) == np.sign(y2):
x2 = x
it+=1
print("Solution at iteration {} = {}".format(it, x))
return x
print(bisect(196,-.001,-.001,30.02,30.02,tol=1e-6,x1=0,x2=30000))
Solution at iteration 1 = 15000.0 Solution at iteration 2 = 22500.0 Solution at iteration 3 = 26250.0 Solution at iteration 4 = 28125.0 Solution at iteration 5 = 29062.5 Solution at iteration 6 = 28593.75 Solution at iteration 7 = 28828.125 Solution at iteration 8 = 28945.3125 Solution at iteration 9 = 29003.90625 Solution at iteration 10 = 29033.203125 Solution at iteration 11 = 29018.5546875 Solution at iteration 12 = 29011.23046875 Solution at iteration 13 = 29014.892578125 Solution at iteration 14 = 29013.0615234375 Solution at iteration 15 = 29013.97705078125 Solution at iteration 16 = 29014.434814453125 Solution at iteration 17 = 29014.663696289062 Solution at iteration 18 = 29014.77813720703 Solution at iteration 19 = 29014.835357666016 Solution at iteration 20 = 29014.863967895508 Solution at iteration 21 = 29014.84966278076 Solution at iteration 22 = 29014.856815338135 Solution at iteration 23 = 29014.86039161682 Solution at iteration 24 = 29014.858603477478 Solution at iteration 25 = 29014.857709407806 Solution at iteration 26 = 29014.858156442642 Solution at iteration 27 = 29014.85837996006 Solution at iteration 28 = 29014.85849171877 Solution at iteration 29 = 29014.858547598124 Solution at iteration 30 = 29014.8585755378 Solution at iteration 31 = 29014.858561567962 Solution at iteration 32 = 29014.858554583043 29014.858554583043
In order to compute the time in which the system reverses its motion, many different methods were used and implemented. The first implementation in the code is to set the tolerance. The first major addition to the code is to use the bisection rule, with respect to the equation for velocity. This part of the code is going to determine the time stated above (In which the motion of the system is switched). It will not work simply by using the bisection rule in the code, a while loop must be initiated as well. As the code runs longer, the closer and more accurate the answer will be. The program uses the bisection rule in order to obtain the closest approximation to the time at which acceleration = 0. At this point the computer generated answer was close to 29014.85855 secs.
import numpy as np
import pylab as pl
Mb = 20 # Mb equals the mass of the empty bucket in grams.
M0 = 20 * 1000 # M0 equals the mass of the bucket at time zero in kilograms.
m = 10 * 1000 # Mass of the weight in kilograms
g = 9.8 # Acceleration of gravity
At = 0 # At is the starting point for Acceleration at time t.
tbeg = 0 # Change this value to the beginning time frame for the Leakage.
tend = 30000 # Change this value to the ending time frame for the Leakage.
t = tbeg # Setting the beginning time
L = 1 # Lambda equals rate of Leakage at 1 gram/s
Lt = 0 # Lambda equals total Leakage at time t
# t1 = np.linspace(0.0, 5.0)
pl.rcParams.update({'font.size': 18}) # Sets fontsize to 18
pl.figure(figsize=(12,10)) # Sets figure size to be 12 x 10
pl.xlabel('time (s)') # Label the x-axis as time
pl.ylabel('Acceleration (m/s^2)') # Label the y-axis as Acceleration
pl.title('Acceleration vs time graph')
while t >= tbeg and t <= tend:
At = ((Mb + M0 - Lt - m)*g) / (Mb + M0 - Lt + m)
pl.xlim(tbeg-1, tend+1) # Expands the graph window size of the x- axis to show the data values clearly.
# Plots t along x axis, and At along y-axis. Uses blue (b) circular (o) markers joined by line
pl.plot(t, At, 'bo-')
t += 1
Lt += 1
This code computes the calculations for the acceleration of the system at any given moment of time and the graph containing data of the acceleration and time. We used import numpy as np because it is a fundamental package that provides tools for working with arrays and contains features used for Python. We also used import pylab as pl because this helps us plot points on the graph. The values that were given are MBequals 20 is the mass of the empty bucket in grams, M0 ,which is the mass of the bucket time zero in kilograms equals the 20 1000 where a kilogram is 1,000 times larger than a gram. The mass m,which is the mass of the weight of the bucket in kilograms, equals 10 1000 where a kilogram is 1,000 times bigger than a gram. The acceleration of gravity g equals 9.8 mls2. Here we wrote At equals 0 which is the starting point for Acceleration time t since t=0. The variable tbeg is used to enter a value to change the time that leakage from the bucket started, while t = tbeg is where you set the beginning time, and tend is used to enter a value to change the time that leakage from the bucket ends. L equals 1 is Lambda where the rate of leakage is at 1 gram/s.Lt equals 0 is Lambda equals total leakage at time t. We commented out t1 equals np.linspace (0.0, 5.0) as we were trying to have evenly spaced out points for the graph but we found another way to do that so this part of the program is ignored. Next we set up the parameters of the graph where we set up the font size to 18, the figure of the graph 12 x 10, label the x-axis as time in seconds and the y-axis as Acceleration in meters per second squared, and label the title of the graph Acceleration vs Time. We put the while loop there so that the statement t >= tbeg and t <= tend is executed if the condition is true and it can perform the calculation below. The calculation that one of our group members did was a(t)=(MB + M0 -λt-m)g / (MB + M0 -λt+m) and so for the code we have At =((MB+M0-Lt-m)*g) / (MB+M0-Lt+m).We wrote pl.xlim(tbeg-1, tend+1) this is to help widen the window size of the graph particularly the x-axis because when first doing this the graph window size was narrow and you could not see all of the points so but implementing this we were able to to get the graph to show the data values clearly. In the next line we plot time t along the x-axis and At along the y-axis, and we use “bo” which means blue circular markers so the point would show up on the graph in blue. Finally we implemented the print statement so the program can show the acceleration of time at time t and the last two below: t+=1 and Lt+=1 means that t = t+1 so when every second passed add 1 and every gram passes per second add 1. Once the program executes the commands it will show the values of acceleration of time at time t along with each time the water leaks from the bucket and the graph shows that the values from At = 3.271019320453031 at time t = 0 to At = -9790.2 at time t = 30000 are decreasing as time goes on.
import numpy as np
import pylab as pl
Mb = 20 # Mb equals the mass of the empty bucket in grams.
M0 = 20 * 1000 # M0 equals the mass of the bucket at time zero in kilograms.
m = 10 * 1000 # Mass of the weight in kilograms
Vt = 0 # Vt is the starting point for Velocity at time t.
tbeg = 0 # Change this value to the beginning time frame for the Leakage.
tend = 30000 # Change this value to the ending time frame for the Leakage.
t = tbeg # Setting the beginning time
L = 1 # Lambda equals rate of Leakage at 1 gram/s
Lt = 0 # Lambda equals total Leakage at time t
# t1 = np.linspace(0.0, 5.0)
g = 9.8 # Acceleration of gravity
gL = g * L
pl.rcParams.update({'font.size': 18}) # Sets fontsize to 18
pl.figure(figsize=(12,10)) # Sets figure size to be 12 x 10
pl.xlabel('time (s)') # Label the x-axis as time
pl.ylabel('Velocity (m/s)') # Label the y-axis as Velocity
pl.title('Velocity vs time graph')
while t >= tbeg and t <= tend:
Vt = 2 * gL * m * (math.log(Mb + M0 + m - Lt)) - (gL * (Mb + M0 + m - Lt))
pl.xlim(tbeg-1, tend+1) # Expands the graph window size of the x- axis to show the data values clearly.
# Plots t along x axis, and At along y-axis. Uses blue (b) circular (o) markers joined by line
pl.plot(t, Vt, 'bo-')
t += 1
Lt += 1
This code computes the calculations for the velocity at any given moment of time and the graph containing data of the velocity and time. We used import numpy as np because it is a fundamental package that provides tools for working with arrays and contains features used for Python. We also used import pylab as pl because this helps us plot points on the graph. This time around we import the math module so the program can perform math functions. The values that were given are MBequals 20 is the mass of the empty bucket in grams, M0 ,which is the mass of the bucket time zero in kilograms equals the 20 1000 where a kilogram is 1,000 times larger than a gram. The mass m,which is the mass of the weight of the bucket in kilograms, equals 10 1000 where a kilogram is 1,000 times bigger than a gram. The acceleration of gravity g equals 9.8 mls2. Here we wrote Vt equals 0 which is the starting point for Velocity at time t since t=0. The variable tbeg is used to enter a value to change the time that leakage from the bucket started, while t = tbeg is where you set the beginning time, and tend is used to enter a value to change the time that leakage from the bucket ends. L equals 1 is Lambda where the rate of leakage is at 1 gram/s.Lt equals 0 is Lambda equals total leakage at time t. We commented out t1 equals np.linspace (0.0, 5.0) as we were trying to have evenly spaced out points for the graph but we found another way to do that so this part of the program is ignored. This time around we put gL which is gravity times lambda so when the program executes the calculations it will take this into account. Next we set up the parameters of the graph where we set up the font size to 18, the figure of the graph 12 x 10, label the x-axis as time in seconds and the y-axis as Velocity in meters per second squared, and label the title of the graph Velocity vs Time. We put the while loop there so that the statement t >= tbeg and t <= tend is executed if the condition is true and it can perform the calculation below. The calculation for Velocity is a follows in math and code form:
V(t)=2gmln(MB+M0+m-t) - g(MB+M0+m-t)and
Vt=2gLm(math.log(Mb+M0+m-Lt)) -(gL(Mb+M0+m-Lt)).
Just like with the Acceleration-Time graph, we wrote pl.xlim(tbeg-1, tend+1) this is to help widen the window size of the graph particularly the x-axis because when first doing this the graph window size was narrow and you could not see all of the points so but implementing this we were able to to get the graph to show the data values clearly. In the next line we plot time t along the x-axis and Vt along the y-axis, and we use “bo” which means blue circular markers so the point would show up on the graph in blue. Finally we implemented the print statement so the program can show the acceleration of time at time t and the last two below: t+=1 and Lt+=1 means that t = t+1 so when every second passed add 1 and every gram passes per second add 1. Once the program executes the commands it will show the values of velocity of time at time t along with each time the water leaks from the bucket and the graph shows that the values from Vt = 1726489.3446167407 at time t = 0 to Vt = 586967.5256165823 at time t = 30000 are decreasing as time goes on.
I am extremely satisfied with how the project went. I was glad to see that everyone of its members attended the meetings we had, and used their skillset to help complete the project. Alex handled a majority of the coding, completing question 6 and giving some insight into what should be done for the coding aspects. Max, Rudy, and Joss did the entire report which is a godsend as my writing abilities aren’t all that great. Knowing this, I tried my best to tackle the mathematical problems in the project, finding the integral for an odd acceleration expression and solving it, without prior knowledge of how to work with transcendental equations. Everybody pulled their weight, and I hope to see them in more courses, as reliable project partners are hard to come by.
My favorite part of the project has got to be question 5, finding the time in which the system reverses direction. After tinkering for a couple of hours, I was able to put together a program that functioned. It used lists of inputs and outputs, and found the time correctly. My algorithm was very flawed in that it took about 45 seconds for it to run. This was with an accuracy of two decimal places. To have more accuracy, the program took an increasingly longer amount of time to run. I was glad to learn of the bisector method afterwards, as its efficiency was far greater than my original algorithm.
In this project, I applied my knowledge of integration techniques, like u - substitution, learned how to solve transcendental equations, and applied my knowledge of Python to solve a function.