Question

Write a function to find the indices of a time series in which the absolute value...

Write a function to find the indices of a time series in which the absolute value of the derivative is above a particular threshold. This is somewhat based on work we’ve done in this chapter. The function:
(a) should be named where_deriv_large.
(b) should take two arguments: times, data (in that order).
(c) (509 only) should have a third argument in which the value of the threshold can be passed.

(d) should return a tuple. The first element is the indices of the derivative that exceed a particular threshold. The second element is the count of the number of values of the derivative exceed the threshold The third element is the (signed) derivative values for the entire time series.

Let’s set the threshold to nominally be 5000. So, your function will find where (wink) the absolute value of the derivative of a time series is larger than 5000.
Test your function using the data we’ve used in this chapter: where p_vars

Write your function in a module named time_series.py.

idx, cnt, deriv = where_deriv_large(p_vars['times'], p_vars['data'])

Homework Answers

Answer #1

#import the required libraries

def where_deriv_large(t,d): #declare and define the function with times and data as arguments

def f(x):

return abs(x) # return absolute value

dx = f(x).diff(x) # derivative dx

dx

(re(x)*Derivative(re(x), x) + im(x)*Derivative(im(x), x))/Abs(x) # perform derivative calculation

thr=0 # assign the threshold value

tuple=() # declare function for tuple

if thr>5000: # test condition if threshold is greater than 5000

tuple[0]= # consider the indices of element which satistfies the test condition

tuple[1]= # consider the count values that satisfy above condition

tuple[2]= # consider derivative values of entire time series (dx)

return tuple() # return tuple with the above three values

Note: The above pseudocode is written in Python Programming language.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
1. Write a function to find the indices of a time series in which the absolute...
1. Write a function to find the indices of a time series in which the absolute value of the derivative is above a particular threshold. This is somewhat based on work we’ve done in this chapter. The function: (a) should be named where_deriv_large. (b) should take two arguments: times, data (in that order). (d) should return a tuple. The first element is the indices of the derivative that exceed a particular threshold. The second element is the count of the...
Develop a python program to find the different solutions, i.e. zero crossings, of a polynomial function...
Develop a python program to find the different solutions, i.e. zero crossings, of a polynomial function using Newton-Raphson’s method over a given range. To do this we will develop three functions: the first should be a function to evaluate the polynomial at a given value of the independent variable; the second function would evaluate the derivative of the polynomial at a given value of the independent variable; finally, the third function would implement Newton-Raphson’s (NR) method to determine a zero...
Please read the article and answear about questions. Determining the Value of the Business After you...
Please read the article and answear about questions. Determining the Value of the Business After you have completed a thorough and exacting investigation, you need to analyze all the infor- mation you have gathered. This is the time to consult with your business, financial, and legal advis- ers to arrive at an estimate of the value of the business. Outside advisers are impartial and are more likely to see the bad things about the business than are you. You should...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT