Re: NSolve output
- To: mathgroup at smc.vnet.net
- Subject: [mg129433] Re: NSolve output
- From: Bob Hanlon <hanlonr357 at gmail.com>
- Date: Mon, 14 Jan 2013 00:00:50 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-newout@smc.vnet.net
- Delivered-to: mathgroup-newsend@smc.vnet.net
- References: <20130113025310.BFB386957@smc.vnet.net>
$Version
"9.0 for Mac OS X x86 (64-bit) (November 20, 2012)"
a = x z + 2 x y + 2 y z;
v = x y z;
a2 = a /. x -> 2 z;
v2 = v /. x -> 2 z;
NSolve[{a2 == 60, v2 == 40, x == 2 z, x > 0},
{x, y, z}]
{{x -> 5.1156, y -> 3.05701, z -> 2.5578}, {x -> 7.46083,
y -> 1.43719, z -> 3.73042}}
Solve[{a2 == 60, v2 == 40, x == 2 z, x > 0},
{x, y, z}, Reals] // N
{{x -> 5.1156, y -> 3.05701, z -> 2.5578}, {x -> 7.46083,
y -> 1.43719, z -> 3.73042}}
{Reduce[{a2 == 60, v2 == 40, x == 2 z, x > 0},
{x, y, z},
Backsubstitution -> True] // N // ToRules}
{{x -> 5.1156, y -> 3.05701, z -> 2.5578}, {x -> 7.46083,
y -> 1.43719, z -> 3.73042}}
Bob Hanlon
On Sat, Jan 12, 2013 at 9:53 PM, Berthold Hamburger
<b-hamburger at artinso.com> wrote:
> Hello,
>
> I want to solve two simple equations with NSOLVE to calculate the
> dimensions of a rectangular box that is open on top. The length of the
> box is twice the width and the volume and area of the box are
> respectively 40 cubic feet and 60 square feet.
>
> I defined the area and volume:
> a = xz + 2xy + 2yz
> v = xyz
>
> then substituted x with 2z:
>
> a2 = a /. x->2z
> v2 = v /. x->2z
>
>
>
> a2 = 6 y z + 2 z^2
> v2 = 2 y z^2
>
> solved with NSolve:
> step1 = NSolve[{a2 == 60, v2 == 40}, {y, z}, Reals] [[1,2]] //Column
>
> which returns the results
> {y->3.05701,z->2.5578}
>
> I would like to get an output that returns values for all 3 variables
> x,y,z as in
>
> {x->5.1156,y->3.05701,z->2.5578}
>
> but somehow cannot find a way to do it
>
> What would be the correct way for doing that?
>
> Regards
>
> Berthold Hamburger
>
- References:
- NSolve output
- From: Berthold Hamburger <b-hamburger@artinso.com>
- NSolve output