MathGroup Archive 2009

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

Search the Archive

Re: what is my error?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg100456] Re: [mg100438] what is my error?
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Thu, 4 Jun 2009 06:32:31 -0400 (EDT)
  • References: <200906040731.DAA11724@smc.vnet.net>

On 4 Jun 2009, at 16:31, Richard Palmer wrote:

> eqns = {mr + mp == 13, fr + fp == 19, mr + fr == 15, mp + fp ==  
> 17}NSolve[eqns,
> {mr, mp, fr, fp}]
>
> gives {{mr->-4.+1. fp,mp->17.-1. fp,fr->19.-1. fp}}
>
> The solution is  {mr->8, mp->5, fr->7, fp->12} if mr,mp,fr,fp are  
> greater
> than zero
>
> -- 
> Richard Palmer

What makes you think so?

eqns = {mr + mp == 13, fr + fp == 19, mr + fr == 15, mp + fp == 17};

  sols = FindInstance[
   And @@ eqns && mr > 0 && mp > 0 && fr > 0 && fp > 0, {mr, mp, fr,  
fp}]

  {{mr -> 13/2, mp -> 13/2, fr -> 17/2, fp -> 21/2}}

eqns /. sols
{{True, True, True, True}}

????

Actually, even if you only want positive integer solutions you will  
find more than the one you gave:

  {mr, mp, fr, fp} /. {ToRules[Reduce[
     And @@ eqns && mr > 0 && mp > 0 && fr > 0 && fp > 0, {mr, mp, fr,  
fp},
          Integers]]}

{{1, 12, 14, 5}, {2, 11, 13, 6}, {3, 10, 12, 7}, {4, 9, 11, 8}, {5, 8,  
10, 9},
    {6, 7, 9, 10}, {7, 6, 8, 11}, {8, 5, 7, 12}, {9, 4, 6, 13}, {10,  
3, 5, 14},
    {11, 2, 4, 15}, {12, 1, 3, 16}}

Andrzej Kozlowski




  • Prev by Date: Series Expansion
  • Next by Date: Re: Re: problem writing debugging utility function
  • Previous by thread: Re: what is my error?
  • Next by thread: Re: what is my error?