Question: Problem 3-intervals.py: Sequential search on intervals [20 points] Write a function eval_step() that evaluates a step function, via sequential (aka. linear) search. A step function

 Problem 3-intervals.py: Sequential search on intervals [20 points] Write a function

Problem 3-intervals.py: Sequential search on intervals [20 points] Write a function eval_step() that evaluates a step function, via sequential (aka. linear) search. A step function is defined by an ordered sequence of n boundary points, [Xo, X1, X2, . . . , xn-1], and a sequence of n + 1 corresponding values, [yo,y ,. . . , xn-1 , Xn]. Specifically, For example, with n = 5 boundaries (and, therefore, n + 1 = 6 intervals), we would have: F(z) ys ye 02 T4 T5 y1 yo For instance, this general procedure could be used to find the tax rate, given income and tax bracket information You function should take three arguments: a number, x, a list cutoffs of n 2 0 ordered boundary points, and a list values of n1 corresponding values, and it should return the value fx) For instance, the following code fragment should achieve the same result as the if-then-else ladder example we have seen in class: INCOME-CUTOFFS= [ 47450, 114650, 174700, 311950] INCOME-TAX-RATES=[ 0.22, 0.25, 0.28, 0.33, 0.35] rate eval_step (income, INCOME_CUTOFFS, INCOME_TAX_RATES) You should implement this using a loop in order to receive credit

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!