Answered step by step
Verified Expert Solution
Question
1 Approved Answer
language: Python Problem 5.4. Oscillating spring A rock of mass m is hung from a spring, and pulled down a length A. When released, the
language: Python
Problem 5.4. Oscillating spring A rock of mass m is hung from a spring, and pulled down a length A. When released, the rock will oscillate up and down with a vertical position given by y(t) = Ae=7* cos (V) Here, y is the vertical position of the rock, k is the spring constant, and is a friction coefficient representing air resistance. Set k = 4 kg 8-2 and 7 = 0.15 s-, m = 9 kg, and A = 0.3 m. a) Create arrays t_array and y-array of size 101, both initially filled with zeros. Use a for loop to fill them with time values in the range from 0 to 25 seconds, and the corresponding y(t) values. b) Vectorize your program by using the NumPy's linspace function to gen- erate the t_array, and send it into a function y(t) to generate the y-array. Your program should now be free of for loops. paragraphe) Plot the position of the rock against time in the given time interval. Use the arrays from both exercise a) and b), and confirm that they give the same result. Put the correct units on both axesStep 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