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. The following SageMath code
f(x)=x*sin(x^2)
df(x)=diff(f,x)
print(df)
defines df(x) to be the derivative function of \( f(x) = x\sin(x^2) \) and then prints the result.

We will also need to plot functions. The following SageMath code
f(x)=x*sin(x^2)
plot(f(x),-2,2)
produces a plot of the function we computed the derivative of above between -2 and 2.

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.

Name:

2. The function and interval given in your lab report has three roots. Use the SageMath evaluation cell above to answer the following questions.

(a) Use the diff command to find the derivative of \( f \). Save the derivative as the function df(x) then plot the derivative on the given interval. Attach a printout to the 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. Attach a printout of your code and solutions to this lab report.
(c) What are the critical points of \(f(x)\) on the interval?
(d) Find the absolute maximum and the absolute minimum of \(f(x)\) on the interval.

Skip to toolbar