       # Re: optimize

```Holger wrote:
>
> I'm a newbie and need help to solve this:
>
> max Z= x + 3 y + 5 z  given x^2 + 2y^2 + 4z^2 <= 17
>
> A would  deeply appreciate answers because I can't seem to solve
> (through mathematica 3.0) it by myself.

You could use a Lagrange multiplier. As a matter of programming it can
be tricky to get all the equations into the correct format. I show one
way to do this below.

surf = x^2 + 2*y^2 + 4*z^2 - 17;
vars = {x,y,z};
grad1 = lambda*Map[D[surf,#]&,vars]; cost = x + 3*y + 5*z;

Now it is simple to eliminate lambda and solve for {x,y,z}.

In:= InputForm[soln = Solve[eqns, vars, lambda]] Out//InputForm=
{{x -> -2*Sqrt[17/47], y -> -3*Sqrt[17/47], z -> (-5*Sqrt[17/47])/2},
{x -> 2*Sqrt[17/47], y -> 3*Sqrt[17/47], z -> (5*Sqrt[17/47])/2}}

I trust the gist of your difficulty was in the programming rather than
the math (were this textbook computer science instead of math maybe I'd
reverse that assumption).

Daniel Lichtblau
Wolfram Research

```

• References:
• optimize
• From: kimhhans@online.no (Holger)
• Prev by Date: Re: A delauney triangulation problem.
• Next by Date: Re: ColorFunction and/or ColorOutput - mkdk