Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #2554

Re: Maximize a single variable and solve for the rest

From Ramiro Barrantes <rbarrant@uvm.edu>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Maximize a single variable and solve for the rest
Date 2011-05-21 10:46 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <ir855q$bcn$1@smc.vnet.net> (permalink)

Show all headers | View raw


thank you Daniel and Bob, this solved it, please excuse my confusion.

On 5/20/11 6:49 AM, Bob Hanlon wrote:
> It makes no sense to Maximixe the LHS of an equation since it is fixed to be equal to the RHS. Presumably you are trying to maximize the variable c.
>
> r1 = 3/4;
> r2 = 1;
>
> Maximize[{c, b == c*r1, h + s + b + d == 1, d == c*r2, h == s,
>    b + d<= 9/10}, {h, s, b, d, c}]
>
> {18/35, {h ->  1/20, s ->  1/20, b ->  27/70, d ->  18/35, c ->  18/35}}
>
> Solve[{b == c*r1, h + s + b + d == 1, d == c*r2, h == s, b + d<= 9/10}, {h,
>     s, b, d, c}, Reals] // Quiet
>
> {{h ->  ConditionalExpression[1 - (7*c)/4 + (1/2)*(-1 + (7*c)/4),
>      c<= 18/35],
>       s ->  ConditionalExpression[(1/2)*(1 - (7*c)/4), c<= 18/35],
>       b ->  ConditionalExpression[(3*c)/4, c<= 18/35],
>       d ->  ConditionalExpression[c, c<= 18/35]}}
>
> Since you want c maximized,
>
> %[[1]] /. c ->  18/35
>
> {h ->  1/20, s ->  1/20, b ->  27/70, d ->  18/35}
>
>
> Bob Hanlon
>
> ---- Ramiro<ramiro.barrantes@gmail.com>  wrote:
>
> =============
> Hello,
>
> I have a problem where I would like to solve an equation (namely (h+s+b
> +d==1) with some constraints, while maximizing for a related variable
> "c" (c<=9).  Please see below,  any suggestions?
>
> r1 = 3/4;
> r2 = 1;
> Block[{h, s, b, d, c},
>   NMaximize[{h + s + b + d,
>     b == c*r1&&  h + s + b + d == 1&&  d == c*r2&&  h == s&&
>      b + d<= 0.9}, {h, s, b, d, c}]]
>
>   {1., {h ->  0.5, s ->  0.5, (3 c)/4 ->  0., c ->  0., c ->  0.}}
>
> Should I be using NSolve?
>
> Thanks in advance,
> Ramiro

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Maximize a single variable and solve for the rest Ramiro Barrantes <rbarrant@uvm.edu> - 2011-05-21 10:46 +0000

csiph-web