9. Consider the function hA[x]=x^2 + A cos x on [-10,10] where A is a constant. For what values of A will hA have relative extreme values? How many relative extreme values can we expect? Justify your answer.
We may investigate this analytically by plotting hA[x] and hA'[x] for different values of A. We may do this by plotting individual examples or by using the following Do[] statement which will allow students to produce an animation which demonstrates the behavior of hA[x] as "A" grows from 1 to 20 . Please note that the PlotRange must be fixed in order for the animation to proceed smoothly. Below are a few cases to give the idea.
Input :=
hA[x_] = f[x] + A g[x];
Input :=
Do[Plot[hA[x], {x, -10, 10},
PlotRange -> {-20, 80},
PlotLabel -> {A}],
{A, 1, 20, 6}]
The following code will generate side-by-side graphics of the function y = x^2 + A cos x and its derivative as A goes from one to twenty. You can then animate these graphics to see the effect of changing the parameter A.
Input :=
p1[A_] := Plot[hA[x], {x, -10, 10},
PlotRange -> {-20,80},
PlotLabel -> {A},
DisplayFunction -> Identity];
Input :=
p2[A_] := Plot[hA'[x], {x, -10, 10},
PlotRange -> {-30,30},
PlotLabel -> {A},
DisplayFunction -> Identity];
Input :=
array = Table[{p1[A], p2[A]}, {A, 1, 20}];
Input :=
Do[Show[GraphicsArray[array[[n]]]], {n, 1, 20}]
From the animations, we can see that as early as A = 4 there are local minima. We can determine the A-value at which we first obtain local minima by looking at the graph of the curve
hA'[x]==0
in the Ax-plane.
Input :=
ImplicitPlot[hA'[x]==0,
{x, -10, 10}, {A, 1, 20},
AxesLabel -> {"x", "A"},
PlotPoints -> 50,
PlotStyle -> AbsoluteThickness[2]]
Output =
-ContourGraphics-
From the graph, we see that x= 0 is always an extremum. A is about 2 when the a branch of local minima arise. We also see new branches of extrema arising when A is about 15.6 which concurs with what we saw in the animations.