Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can you explain me the approach idea.. Write a program that models the movement of an object with mass m (in this exercise it is

image text in transcribed

can you explain me the approach idea..

Write a program that models the movement of an object with mass m (in this exercise it is set to 1kg) that is attached to an oscillating spring. When a spring is displaced from its equilibrium position by an amount x (meters), Hooke's law states that the restoring force is F=-kx Where k is a constant that depends on the spring (in this exercise it is set to 10 N/m), The approach Start with an initial displacement x (say 0.5 m) and an initial velocity v (say O m/s) and compute the cceleration a using Newton's law F = m. a ) and Hooke's law (F--kx). Then iterate for a certain amount of time t flet say 10s) using an interval dt (let say 0.01s), updating the velocity v that changes by an amount a.dt, and the displacement x that changes by an amount v.dt. After every 10 iterations, save the obtained displacement x in a list called displacements. Finaly, display on the Spyder console, the contents of the list displacements and plot in a separate window its contents against time, where each pixel in the graph should represent 1 cm. (see Figure.1) Note: The display of the list should be done by a function called displaytist() that takes as input parameter the list to be displayed and displays each 10 elements in 1 line. The plotting of displacements list against time should be done by a function called displayChart) that accepts the list displacements as input and creates a new list (say vertices) of coordinates (x, where x is the index in displacements (1, 2,) and y is the related displacement increased by dy 50 -to avoid having negative values. The function draws uses the method drawPolyD provided in the ezgraphics library to draw the result. (See section 2.6 in the textbook). Write a program that models the movement of an object with mass m (in this exercise it is set to 1kg) that is attached to an oscillating spring. When a spring is displaced from its equilibrium position by an amount x (meters), Hooke's law states that the restoring force is F=-kx Where k is a constant that depends on the spring (in this exercise it is set to 10 N/m), The approach Start with an initial displacement x (say 0.5 m) and an initial velocity v (say O m/s) and compute the cceleration a using Newton's law F = m. a ) and Hooke's law (F--kx). Then iterate for a certain amount of time t flet say 10s) using an interval dt (let say 0.01s), updating the velocity v that changes by an amount a.dt, and the displacement x that changes by an amount v.dt. After every 10 iterations, save the obtained displacement x in a list called displacements. Finaly, display on the Spyder console, the contents of the list displacements and plot in a separate window its contents against time, where each pixel in the graph should represent 1 cm. (see Figure.1) Note: The display of the list should be done by a function called displaytist() that takes as input parameter the list to be displayed and displays each 10 elements in 1 line. The plotting of displacements list against time should be done by a function called displayChart) that accepts the list displacements as input and creates a new list (say vertices) of coordinates (x, where x is the index in displacements (1, 2,) and y is the related displacement increased by dy 50 -to avoid having negative values. The function draws uses the method drawPolyD provided in the ezgraphics library to draw the result. (See section 2.6 in the textbook)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

6. Identify seven types of hidden histories.

Answered: 1 week ago

Question

What is the relationship between humans and nature?

Answered: 1 week ago