Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Trouble with a system of equations

  • To: mathgroup at smc.vnet.net
  • Subject: [mg77596] Re: Trouble with a system of equations
  • From: Yaroslav Bulatov <yaroslavvb at gmail.com>
  • Date: Wed, 13 Jun 2007 07:42:36 -0400 (EDT)
  • References: <f4lb44$fvv$1@smc.vnet.net>

On Jun 11, 10:31 pm, Ray Koopman <koop... at sfu.ca> wrote:
> On Mon, 11 Jun 2007 07:38:00 -0500 drmajor... at bigfoot.com wrote:
>
> > There's an unmatched bracket in
>
> >>    m = Inverse[ Subsets[Times@@#]& /@ Tuples[{0,1},k]] ].
>
> > and I haven't found a way (so far) to correct it so that the code works.
>
> > Bobby
>
> Ah, the joys and perils of posting code without testing it first.
> Maybe someday I'll get Mathematica for my machine at home.
>
> Aside from the extra ], that must must have been teleported from
> LinearSolve[x,Log[p/(1-p)], where a ] is missing, the problem is
> that I simply copied the form of an example in the Subsets online
> documentation, with h changed to Times, not realizing that Times@@#
> would be evaluated before Subsets got to it.
>
> Here are two ways to get x:
>
>    ReleaseHold@Subsets[Hold@Times@@#]& /@ Tuples[{0,1},k]
>
> or (preferably, I think)
>
>    Times@@@Subsets@#& /@ Tuples[{0,1},k].
>
> With[{k = 2}, Inverse[ Times@@@Subsets@#& /@ Tuples[{0,1},k] ]]
>
> {{ 1, 0, 0, 0},
>  {-1, 0, 1, 0},
>  {-1, 1, 0, 0},
>  { 1,-1,-1, 1}}
>
> With[{k = 3}, Inverse[ Times@@@Subsets@#& /@ Tuples[{0,1},k] ]]
>
> {{ 1, 0, 0, 0, 0, 0, 0, 0},
>  {-1, 0, 0, 0, 1, 0, 0, 0},
>  {-1, 0, 1, 0, 0, 0, 0, 0},
>  {-1, 1, 0, 0, 0, 0, 0, 0},
>  { 1, 0,-1, 0,-1, 0, 1, 0},
>  { 1,-1, 0, 0,-1, 1, 0, 0},
>  { 1,-1,-1, 1, 0, 0, 0, 0},
>  {-1, 1, 1,-1, 1,-1,-1, 1}}

OK that works, thanks. One problem with the original system is that I
set up the estimation equations in terms of E[x_i y] (assuming uniform
distribution over x's), and not empirical odds ratios which apparently
make it much harder to solve (Andrzei's solution works fine for 2
variables, but takes too long for 3)



  • Prev by Date: Re: Re: simplification of 0/0 to 1?
  • Next by Date: Re: Bare Bones Backup Button
  • Previous by thread: Re: Re: Trouble with a system of equations
  • Next by thread: Re: Re: Trouble with a system of equations