Re: A nasty 2x2 system of equations?
- To: mathgroup at smc.vnet.net
- Subject: [mg54137] Re: [mg54098] A nasty 2x2 system of equations?
- From: DrBob <drbob at bigfoot.com>
- Date: Fri, 11 Feb 2005 03:34:10 -0500 (EST)
- References: <200502100747.CAA16654@smc.vnet.net>
- Reply-to: drbob at bigfoot.com
- Sender: owner-wri-mathgroup at wolfram.com
It's a nasty problem, but here's what appears to be a solution: X = BetaDistribution[a1, b1]; Y = BetaDistribution[a2, b2]; Z = BetaDistribution[a3, b3]; meanEQ = Mean[Z] == c*Mean[X] + (1 - c)*Mean[Y]; varianceEQ = Variance[Z] == c^2*Variance[X] + (1 - c)^2*Variance[Y]; Solving the first equation: Off[Solve::"svars"] a3Rule = First@Solve[meanEQ, {a3, b3}] {a3 -> -((b3*(a1*a2 + a2*b1 - a2*b1*c + a1*b2*c))/ ((-a1)*b2 - b1*b2 - a2*b1*c + a1*b2*c))} (checking) meanEQ/.a3Rule//Simplify True Applying that to the other equation and solving: Solve[varianceEQ /. a3Rule, {b3}] {{b3 -> (a1^2*a2*b2^2 + a1^3*a2*b2^2 + 2*a1*a2*b1* b2^2 + 3*a1^2*a2*b1* b2^2 + a2*b1^2*b2^2 + 3*a1*a2*b1^2*b2^2 + a2*b1^3*b2^2 + a1*a2*b1*b2* c + a1^2*a2*b1*b2*c + 2*a1*a2^2*b1*b2*c + 2*a1^2*a2^2*b1*b2*c + a2*b1^2*b2*c + 2*a1*a2* b1^2*b2*c + 2*a2^2*b1^2* b2*c + 4*a1*a2^2*b1^2*b2* c + a2*b1^3*b2*c + 2*a2^2*b1^3*b2*c + a1^2*b2^2*c + a1^3*b2^2* c - 2*a1^2*a2*b2^2*c - 2*a1^3*a2*b2^2*c + a1*b1*b2^2*c + 2*a1^2*b1* b2^2*c - 3*a1*a2*b1*b2^2* c - 5*a1^2*a2*b1*b2^2*c + a1*b1^2*b2^2*c - a2*b1^2*b2^2*c - 4*a1*a2*b1^2*b2^2*c - a2*b1^3*b2^2*c + a1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- 6*a1*a2*b1^2*b2*c - 2*a2*b1^3*b2*c + a1*a2^2*b1*c^2 + a1*a2^3*b1*c^2 + a1^2*a2*b2*c^2 + a1^3*a2*b2*c^2 + 4*a1*a2*b1*b2*c^2 + 3*a1^2*a2*b1*b2*c^2 + 3*a1*a2^2*b1*b2*c^2 + a2*b1^2*b2*c^2 + 3*a1*a2*b1^2*b2*c^2 + a2*b1^3*b2*c^2 + a1*b1*b2^2*c^2 + 3*a1*a2*b1*b2^2*c^2 + a1*b1*b2^3*c^2)}} Yikes!! Solving in the other order (varianceEQ first) doesn't work so well. Bobby On Thu, 10 Feb 2005 02:47:14 -0500 (EST), Bruce Colletti <vze269bv at verizon.net> wrote: > Re Mathematica 5.1. > > The code below keeps running without getting an answer. Is the code flawed or is this a really nasty system of 2-equations in 2-unknowns? > > Here's background: X and Y are independent beta-distributed random variables and Z is a convex combination of X and Y, i.e., Z = cX + (1 - c)Y. > > Although Z need not be beta-distributed, let's pretend it is and in turn, solve for its parms (a3 and b3) in terms of c and the known parms of X and Y. > > Thanks. > > Bruce > > ------------- > > > X = BetaDistribution[a1, b1]; > Y = BetaDistribution[a2, b2]; > Z = BetaDistribution[a3, b3]; > > Solve[{Mean[Z] == c*Mean[X] + (1 - c)*Mean[Y], > Variance[Z] == c^2*Variance[X] + (1 - c)^2*Variance[Y]}, {a3, b3}] > > > > -- DrBob at bigfoot.com www.eclecticdreams.net
- References:
- A nasty 2x2 system of equations?
- From: Bruce Colletti <vze269bv@verizon.net>
- A nasty 2x2 system of equations?