Complete the MAX_LinSpline function below. Please read the doctring carefully to make sure the inputs and outputs match the required number and types. (Hint, you do not need to strictly follow the algorithm (second one) above. Use np.max and np.argmax can help find c and d more easily.)
Complete the MAX_LinSpline function below. Please read the doctring carefully to make sure the inputs and outputs match the required number and types. (Hint, you do not need to strictly follow the algorithm (second one) above. Use np.max and np.argmax can help find c and d more easily.)
Related questions
Question
Complete the MAX_LinSpline function below. Please read the doctring carefully to make sure the inputs and outputs match the required number and types. (Hint, you do not need to strictly follow the algorithm (second one) above. Use np.max and np.argmax can help find c and d more easily.)
![In [2]:
def MAX_LinSpline (f, le, re):
Compute the maximum of f(x)-1(f,le,re;x)| on the interval [le,re],
where 1 is a linear function that passes (le, f(le)) and (re, f(re)).
Here, use ELEVEN points equally spaced between le and re (both inluded)
to find the maximum
input:
f: func, the function to be approximated
le: float, the left end of interval
re: float, the right end of interval
return:
c: float, where the maximum occurs
d: float, the maximum
return c, d](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F15aa6fb5-a267-44cc-a16f-c8e9d2db8946%2F444f1828-fafb-42dd-9179-cf1a7b795812%2Fz327cha_processed.png&w=3840&q=75)
Transcribed Image Text:In [2]:
def MAX_LinSpline (f, le, re):
Compute the maximum of f(x)-1(f,le,re;x)| on the interval [le,re],
where 1 is a linear function that passes (le, f(le)) and (re, f(re)).
Here, use ELEVEN points equally spaced between le and re (both inluded)
to find the maximum
input:
f: func, the function to be approximated
le: float, the left end of interval
re: float, the right end of interval
return:
c: float, where the maximum occurs
d: float, the maximum
return c, d

Transcribed Image Text:1.
procedure MAX (f, a, b, c, d)
2. k ← 10
3. h
(B-a)/k
4. for i = 0, 1,..., k do
A. Zif(a+ih)
5. end
6. for i=1,2,..., k-1 do
A. ZiZi (izk + (k-i)zo) /k|
7. end
8. d 0
9. for i=1,2,...,k - 1 do
A. if zi > d then
a.
d + Zi
b. c+a+ih
B. end if
10. end
11. return
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
