# Assignment # 6 - SOLUTIONS # -- One Variable Optimization -- # # Question 1: > f:=2*x^3+3*x^2-36*x+1; > df:=diff(f,x); > solve(df=0,x); # The possible max/min are at x = -3 and x = 2. > plot([f,df],x=-5..5,color=[red,blue]); # We can see (from the graph and from "solve") that the local max of # f(x) is at x = -3 and the local min of f(x) is at x = 2. We can also # determine that f(x) is increasing when > `<`(x, `+`(`-`(3)));# and > `<`(x, 2);# , and f(x) is decreasing when -3 < x < 2. # # Question 2: > f:=3*x^5-10*x^4+7*x; > df:=diff(f,x); > df2:=diff(f,x,x); > solve(df2=0,x); # The possible inflection points are at x = 0 and x = 2. > plot([f,df2],x=-1..3,color=[red,blue]); # We can see from the above graph that f(x) is concave up when x > 2 and # concave down when x < 2. Note: x = 0 is NOT an inflection point. # # Question 3: # a) Let us determine the derivatives of y: > y:=x^3-3*x^2-9*x+10; > yprime:=diff(y,x); > y2prime:=diff(y,x,x); > solve(yprime=0,x); # so, the possible max/min are at x = -1 and x = 3. > plot([y,yprime],x=-2..4, color=[red,blue]); # b) We can tell from the above graph that y is increasing when x < -1 # and x > 3 and y is decreasing when -1 < x < 3. # c) We can also tell, from the above graph that y has a relative # maximum at x = -1 and a relative minimum at x = 3. # d) To find where y is concave up and concave down, let us plot y and # y'': > solve(y2prime=0,x); > plot([y,y2prime],x=-2..4,color=[red,blue]); # We can determine, from the above graph that y is concave up when x > 1 # and concave down when x < 1. # e) There is one inflection point (as we can see from the graph) at x = # 1. # f) See the above graphs of y. # # Question 4: > f:=(x^2-3*x+2)^2; > fprime:=diff(f,x); > solve(fprime=0,x); > plot([f,fprime],x=0.5..2.5,color=[red,blue]); # As we can see from the above plots, the local minima are at x = 1 and # x = 2 and the local maxima is at x = 1.5. We can also determine that # f is increasing when 1 < x < 1.5 and x > 2. Also, f is decreasing # when - 1 < x and 1.5 < x < 2. # # Question 5: > y:=x^3+4*x^2-3*x+4; > yprime:=diff(y,x); > y2prime:=diff(y,x,x); > solve(yprime=0,x); > subs(x=1/3,y2prime); # Since y''(x) is positive at x = 1/3, then there is a local minimum # there. > subs(x=-3,y2prime); # Since y''(x) is negative at x = - 3, then there is a local maximum # there. > plot(y,x=-4..2); # # # Question 6: > C:=2*x^3-15*x^2-84*x+3100; > Cprime:=diff(C,x); > C2prime:=diff(C,x,x); > solve(Cprime=0,x); > subs(x=-2, C2prime); # Since C''(-2) < 0, then x = -2 is a local maximum. BUT! x = -2 is NOT # possible, since you cannot have a negative quantity. > subs(x=7, C2prime); # Since C''(7) > 0, then x = 7 is a local minimum. # # # Question 7: > C:=2*x^3-39*x^2+180*x+21200; > Cprime:=diff(C,x); > C2prime:=diff(C,x,x); > solve(Cprime=0,x); > subs(x=3, C2prime); # Since C''(3) < 0, then x = 3 is a local maximum. > subs(x=10, C2prime); # Since C''(10) > 0, then x = 10 is a local minimum. # # # Question 8: > p:=200-0.98*q; > c:=0.02*q^2+2*q+8000; > P:=p*q-c; > P:=simplify(P); > Pprime:=diff(P,q); > P2prime:=diff(P,q,q); > solve(Pprime=0,q); # So, the profit is maximized when q (quantity) = 99 units. # # Question 9: > p:=100-3*q; > c:=(4+100/q)*q; > c:=simplify(c); > P:=p*q-c; > P:=simplify(P); > Pprime:=diff(P,q); > P2prime:=diff(P,q,q); > solve(Pprime=0,q); # So, the profit is maximized when quantity (q) = 16 units. # # Question 10: > p:=500/sqrt(q); > c:=5*q+2000; > P:=p*q-c; > P:=simplify(P); > Pprime:=diff(P,q); > P2prime:=diff(P,q,q); > solve(Pprime=0,q); # So, the profit is maximized when q = 2500 units. #