Minimum



On 13/06/2011 1:08 AM, meri sguanci wrote:
> Hi,
> I'm a noob, so I'm sorry for the stupid question. I started using Maxima
> few days ago 'cause I need it for a project @ university. I have a very
> simple problem: I don't know how to find the minimum of an
> expression on a domain.
> This is what I've done:
>
> /* [wxMaxima: input   start ] */
> cmin1:1.1;
> cmin2:1.5;
> cqi1:3;
> cqi2:1;
> xmin1:0.8;
> xmin2:0.85;
> Pnom1:80;
> -Pnom2:120;
> Preq:80;
> /* [wxMaxima: input   end   ] */
> /* [wxMaxima: input   start ] */
> cost1(P1):=P1*(cmin1+cqi1*(P1/Pnom1-xmin1)^2);
> /* [wxMaxima: input   end   ] */
> /* [wxMaxima: input   start ] */
> cost2(P2):=P2*(cmin2+cqi2*(P2/Pnom2-xmin2)^2);
> /* [wxMaxima: input   end   ] */
> /* [wxMaxima: input   start ] */
> COSTOTOT(P1,P2):=cost1(P1)+cost2(P2);
> /* [wxMaxima: input   end   ] */
> /* [wxMaxima: input   start ] */
> plot3d(COSTOTOT(P1,P2),[P1,0,Pnom1],[P2,0,Pnom2]);
> /* [wxMaxima: input   end   ] */
> /* [wxMaxima: input   start ] */
> Costo1v(P1):=cost1(P1)+cost2(Preq-P1);
> /* [wxMaxima: input   end   ] */
>
> I need to know the minimum of Costo1v with P1 in the range [0,Pnom1].
> How can I do?
>
> Thanks a Lot for ur time and help
>
> Yours,
> Maria Sguanci
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
You have written "-Pnom2:120;".  I have taken this to mean 
"Pnom2:-120;". If you meant something else then your answers will be 
different, but the methodology is the same.

The first thing to do is to plot the expression

plot2d(Costo1v(P1),[P1,0,Pnom1]);

This shows that the function is well-behaved with a minimum near P1 ~ 78.

The global extrema are found at the points where 
diff(Costo1v(P1),P1)=0.  Don't forget to check for local extrema at the 
ends of the domain.

diff(Costo1v(P1),P1);
solve(%,P1);
%,numer;
       [P1 = - 29.80284238565096, P1 = 78.49849455956399]

Either by inspection from the graph, or by evaluating 
diff(Costo1v(P1),P1,2), you can determine if the extrema a maxima, 
minima or inflection points.