Lab 6: Extreme Values



Sometimes it isn’t clear from looking at the graph of a function where exactly the largest or smallest values are. In these situations we need to compute the critical points first in order to find the maximum or minimum value of the function.

To do this we are going to need a few tools from SageMath. The first is the diff(f,x) command for differentiation, which we encountered in Lab 4. Recall that the following SageMath code
f(x)=x+2*cos(2*x)
df(x)=diff(f,x)
defines df(x) to be the derivative function of \( f(x) = x+2\cos(2x) \).

In addition, we will use SageMath‘s find_root(f(x),a,b) command, which tells us the value of a root of the function \(f\) in the interval \([a,b]\). Try this in the box below by copying the two lines below into the SageMath cell.
f(x)=sin(x)
find_root(f(x),3,4)

Note: This command will only return one root in the interval, even if there are multiple roots. Try changing the 3 to a -1 above. The function \(f(x)=\sin(x)\) has two roots on the interval \([-1,4]\), but the find_root command only reports one of them.


2. Consider the function \( f(x) \) and the interval given by your instructor. Use the SageMath evaluation cell below to answer the following questions.

(a) Using the diff() command, define df(x) to be the derivative of \( f(x) \). Plot the derivative on the given interval. Attach a printout of this plot to your lab report.
(b) Observe that \( f'(x) \) has three roots on the given interval. Use the find_root() command to identify each of these roots. (Hint: For each root, you will need to find a small interval around that root, which does not contain any other root.)
(c) What are the critical points of \( f(x) \) on the given interval?
(d) Find the absolute maximum and the absolute minimum of \( f(x) \) on the given interval. (Hint: You will need to evaluate \( f(x) \) at the endpoints of the interval and at each critical point.)

Name:

Skip to toolbar