Finding Absolute (Global) Extrema in Python
Author: David Manuel
In this video, it is demonstrated how to use Python find the absolute maximum and minimum on a closed and bounded interval. The presenter uses Python to find the derivative, solve when the derivative equals zero to find the critical values, and then substitutes the critical values and endpoints into the function to find the absolute minimum.
Transcript 18
Transcript 18
Exercises
Python Code:
from sympy import *
T=symbols('T')
D=.0694*T**2-10.505*T+399.05
dD=diff(D,T)
critvals=solve(dD,T)
print(critvals)
candidates=[53,critvals[0],107]
yvals=[D.subs(T,i) for i in candidates]
print(yvals)
print('The minimum distance is', yvals[1],'degrees when T is about 75.68 degrees.')
Open Python Notebook File
from sympy import *
T=symbols('T')
D=.0694*T**2-10.505*T+399.05
dD=diff(D,T)
critvals=solve(dD,T)
print(critvals)
candidates=[53,critvals[0],107]
yvals=[D.subs(T,i) for i in candidates]
print(yvals)
print('The minimum distance is', yvals[1],'degrees when T is about 75.68 degrees.')
Open Python Notebook File
