Re: solving a system of two equations
- To: mathgroup at smc.vnet.net
- Subject: [mg101998] Re: [mg101984] solving a system of two equations
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Sun, 26 Jul 2009 03:54:07 -0400 (EDT)
- References: <200907250817.EAA29655@smc.vnet.net>
- Reply-to: drmajorbob at bigfoot.com
Solve for both parameters (since you need them both!) and don't use 0.5 when you mean 1/2: Solve[{a/(a + b) == 1/2, a*b/((a + b)^2 (a + b + 1)) == 2}, {a, b}] {a/(a + b) == 1/2, a*b/((a + b)^2 (a + b + 1)) == 2} /. % {{a -> -(7/16), b -> -(7/16)}} {{True, True}} Symbolic solve doesn't work well with approximate numbers, so 0.5 was a bad idea, although, in this case, it still works: Solve[{a/(a + b) == 0.5, a*b/((a + b)^2 (a + b + 1)) == 2}, {a, b}] {a/(a + b) == 1/2, a*b/((a + b)^2 (a + b + 1)) == 2} /. % {{a -> -0.4375, b -> -0.4375}} {{True, True}} You certainly can't get a AND b without solving for them, however. Bobby On Sat, 25 Jul 2009 03:17:20 -0500, per <perfreem at gmail.com> wrote: > hi all, > > i am trying to find two parameters a, b of the Beta distribution that > make its mean equal to some given constant m and its variance equal to > some given constant v. this reduces to solving a system of two > equations based on the mean/variance definitions of the beta > distribution: > > a/(a+b) = m > a*b/((a + b)^2 (a + b + 1)) = v > > i want to solve this equation for a and b. i tried to solve this in > mathematica, as follows (for m = .5, v = 1): > > Solve[{a/(a + b) == .5, a*b/((a + b)^2 (a + b + 1)) == 2}, a] > But it returns: {} > > i want to get back values for a and b. does anyone know how i can do > this? also, this is subject to the constraint that a and b are > positive real numbers but i am not sure how to express that. > > thank you. > -- DrMajorBob at bigfoot.com
- References:
- solving a system of two equations
- From: per <perfreem@gmail.com>
- solving a system of two equations