Differentiating, we have:
\[g'(x)=\simplify{{c}*x^2+{-c*(a+b)}*x+{c*a*b}={c}*(x+{-a})(x-{b})}\]
Note that we have already factorised the derivative.
Stationary points are given by solving $g'(x)=0 \Rightarrow x=\var{a},\;\;\mbox{or }x=\var{b}$
So the least stationary point is $x=\var{a}$ and the greatest is $x=\var{b}$.
Since $\var{a} > \var{l}$ and $\var{b} \lt \var{m}$ we have that both stationary points are in $I$.
The second derivative is given by \[g''(x)=\simplify{{2*c}*x-{c*(a+b)}}\]
Local Maximum
At the stationary point $x=\var{a}$ we have $g''(\var{a})=\var{c*a-c*b} \lt 0$.
Hence at this value of $x$ we have a local maximum.
The value of the function $g$ at this local maximum is $g(\var{a})= \var{valmax}$.
Local Minimum
At the stationary point $x=\var{b}$ we have $g''(\var{b})=\var{c*b-c*a} \gt 0$.
Hence this point is a local minimum.
The value of the function $g$ at this local minimum is $g(\var{b})= \var{valmin}$.
Global Maximum
First we find the values at the endpoints of the interval $I=[\var{l},\var{m}]$ are:
$g(\var{l})=\var{valbegin}$ to 3 decimal places.
$g(\var{m})=\var{valend}$ to 3 decimal places.
To find the global maximum note that we are only concerned with the values of $g$ on the interval $I$.
So we proceed by comparing the values of the function at the endpoints with the local maximum.
a) If the value at the local maximum is greater than either of the values at the endpoints then this is the global maximum on the interval.
b) Otherwise if the greatest value of the function at the endpoints is greater than the local maximum then this is the global maximum.
\[\begin{array}{c|c|c|c} x & \mbox{Local Maximum}=\var{a} & \var{l} \in I & \var{m} \in I \\ \hline\\ g(x)& \var{valmax} & \var{valbegin} & \var{valend} \\ \end{array} \]
So for our example we see that the global maximum occurs at $x=\var{gma}$ and $g(\var{gma})=\var{valgmax}$.
Global Minimum
We proceed as for the global maximum by comparing the values of the function at the endpoints with the local minimum.
a) If the value at the local minimum is less than either of the values at the endpoints then this is the global minimum on the interval.
b) Otherwise if the least value of the function at the endpoints is less than the local minimum then this is the global minimum.
\[\begin{array}{c|c|c|c} x & \mbox{Local Minimum}=\var{b} & \var{l} \in I & \var{m} \in I \\ \hline\\ g(x)& \var{valmin} & \var{valbegin} & \var{valend} \\ \end{array} \]
In our example we see that the global minimum occurs at $x=\var{gmi}$ and $g(\var{gmi})=\var{valgmin}$.