Section 3.7 Examples
Calculus I
Andy Long

#15, p. 257

Clear[h,r, height,root,roots,side,P1,P2]
V[s_,h_]:=s*s*h;
A[s_,h_]:=s^2+4*s*h;
root=Solve[A[s,h]==1200,h]
height=h/.root[[1]]
Volume[s_]:=V[s,height]
Volume[s]
D[Volume[s],s]
roots=Solve[D[Volume[s],s]==0]
side=s/.roots[[2]]
P1=Plot[Volume[s],{s,side/2,3*side/2}];
height=(1200-side^2)/(4*side)
Volume[side]
P2=ListPlot[{{side,V[side,height]}},PlotMarkers->{"*"}];
Show[P1,P2]

#27, p. 257

(* using angle *)
f[x_]:=2*r^2(1+Cos[2x])Cos[x]Sin[x]
(* Since r is just a scale factor, and doesn't change the shape of the triangle, we can set it to 1 to find the optimal triangle: *)
r=1
Plot[f[x],{x,0,Pi/2}]
roots=Solve[f'[x]==0,x]
(* We're looking for solutions on the interval [0,Pi/2]: *)
f[x/.roots]

(* same problem -- using altitude *)
Clear[r]
y[x_]:=Sqrt[r^2-x^2]
(* This is a different approach: use x as the independent variable *)
A[x_]:=1/2*x*(r+y[x])
Together[A'[x]]
roots=Solve[A'[x]==0,x]
y[x/.roots]

r=1
f[x_]:=Sqrt[r^2-x^2](r+x)
Plot[f[x],{x,0,1}]
roots=Solve[f'[x]==0,x]
f[x/.roots]

#9, p. 257

y[n_]:=k n/(1+n^2)
Solve[y'[n]==0,n]
k=1
Plot[y[n],{n,0,3}]