Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please help I know this deals with computer science but my question wasn't answered there. If you could please help I would really appreciate it.
Please help I know this deals with computer science but my question wasn't answered there. If you could please help I would really appreciate it. Thank you will rate!!!!!!
5.1 - Roller-coaster physics (18 points) A frictionless cart is started from rest on a track which has a complicated shape. As a function of the cart position x , the gravitational potential energy of the cart on the track is equal to: V(x) = -x + x4 200x + 1500x + 2800 Run the cell below to draw a plot of the potential energy (which, in this case, is also a sketch of the track itself.) In [2]: x = np.linspace(-8,8,200) def cart_V(x): return -x**5 + x**4 - 200*x**2 + 1500*x + 2800 y = cart_V(x) plt.plot(x,y) plt.xlabel('x (m)') plt.ylabel('(x)') Out [2]: Text(0, 0.5, 'V(x)') 10000 (x -10000 -20000 -8 -6 -4 -2 2 4 6 8 0 x (m) The track slopes up on the left-hand side, so the initial potential increases sharply if we start the cart at more negative x. On the right, the potential slopes down sharply. The track ends at x = +8 meters, at which point the cart falls off (this is a very exciting ride.) Instead of looking at the detailed motion of the cart on the track, we can use conservation of energy to ask about properties of its overall path. In particular, consider the total energy E = T(x) + V(x). Since we know V(x) in full, we can compute the kinetic energy vs. position T(x) for the cart once we know E. But kinetic energy has an important restriction that V(x) does not: kinetic energy can never be negative! In other words, if T(x) would be negative for any x, then that point is not reachable by a cart with that much energy. (Such a region is said to be "classically forbidden".) Part A (8 points) Implement the function cart_makes_it_to_end() below, which considers the motion of a cart starting from rest (so T(xo) = 0) at position x0, returning True if the cart will make it all the way to some end position xend, and False otherwise. (We'll often be calling the function with xend = 8 to ask if the cart makes it all the way to the end, but you should write it in a way that it gives the right answer for other input values of xend !) Remember, we don't have to worry about the details of the motion: all you need to answer is whether the cart's total energy E is large enough that T(x) will always be positive between Xo and the end of the track at xend. (Hint: check out the functions np.any() or np.all() - these let you test logical conditions on a whole array like T(x).) In [24]: def cart_makes_it_to_end(x0, xend, v, num_points=1000): Given the 1-d potential v(x), determines whether a cart starting from rest at position x=x0 will make it to the right end of the track. Arguments: ---- x0: x-position where cart begins from rest. xend: x-position where the track ends. V: potential energy function V(x) to test num_points: number of x-points to test in the range (x0, xend) [default: 1000.] Returns: -- -- True if the cart can get to xend, 'False otherwise. ## YOUR CODE HERE # we are going to want to find points where y(x0)>y(x0Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started