Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write a program in Python! Suppose you are given a vector containing the momenta of an oscillating particle. Write a function revTime(times, momenta) that

Please write a program in Python!image text in transcribed

Suppose you are given a vector containing the momenta of an oscillating particle. Write a function revTime(times, momenta) that calculates the revolution time of this particle. times is a vector containing the times at which the momenta, stored in the vector momenta are given. The output should be a vector containing the revolution times for each revolution. Here, we assume that a new revolution starts when the momentum changes sign (e.g. negative to positive), such that a full revolution is performed when the sign changes again in the same manner. Hint: First, you need to identify the timesteps between which the sign change in the momentum occurs. You can do that by comparing the sign of the momentum. Then, to exactly determine the revolution time, use linear interpolation. Consider the time tn to be the last one with negative momentum pn and tn+1 the first one with positive momentum pn+1. Then, the linear interpolation for the momentum is p(t)=httnpn+1+htn+1tpn, and the equation for the exact time of crossing t(p(t)=0) is t=pn+1pntnpn+1tn+1pn

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

Recommended Textbook for

Database Programming Languages 12th International Symposium Dbpl 2009 Lyon France August 2009 Proceedings Lncs 5708

Authors: Philippa Gardner ,Floris Geerts

2009th Edition

3642037925, 978-3642037924

More Books

Students also viewed these Databases questions