Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1999
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

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

Search the Archive

Re: Q: NSolve with conditions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg20101] Re: [mg20068] Q: NSolve with conditions
  • From: "David Park" <djmp at earthlink.net>
  • Date: Thu, 30 Sep 1999 02:43:12 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

Alphons wrote:

>Hello,
>
>I'm trying to solve a system of linear equations by NSolve. How can I
>restrict the solutions, to a subset, that machtes given conditions.
>
>e.g.:
>GlgSys = {EDTAtot == 0.002,
>      EDTA1 == 10^10.26*EDTA*H,
>      EDTA2 == 10^6.61*EDTA1*H,
>      EDTA3 == 10^2.76*EDTA2*H,
>      EDTA + EDTA1 + EDTA2 + EDTA3 == EDTAtot,
>      H + 2*EDTAtot == 10^(-14)/H + 2*EDTA2 + 3*EDTA1 + EDTA3 + 4*EDTA};
>
>Following conditions should be kept:
>0<= EDTA <= 0.002,
>0<= EDTA1 <= 0.002,
>0<= EDTA2 <= 0.002,
>0<= EDTA3 <= 0.002,
>0<= H <= 10^(-4)
>
>Thanks for your reply
>
>
>--
>Alphons Fakler
>Zentrum fur Chemische Sensoren
>ETH Technopark
>Technoparkstr. 1
>CH - 8005 Zurich
>Tel. (01) 445-1492
>Fax: (01) 445-1233
>EMail: fakler at chemsens.pharma.ethz.ch
>


I believe you have to use Solve, not NSolve which applies only to a single polynomial
equation.

sols = Solve[GlgSys];

This selects the solutions which meet the specified conditions. (1 out of the 5
solutions in this case.)

Select[sols,
  And @@ ({0 <= EDTA <= 0.002, 0 <= EDTA1 <= 0.002, 0 <= EDTA2 <= 0.002,
            0 <= EDTA3 <= 0.002, 0 <= H <= 10^(-4)} /. #) &]

{{EDTA3 -> 0.00001686620576306438,
   EDTAtot -> 0.002,
   EDTA -> 1.1679338483726822*^-10,
   EDTA1 -> 0.000031886523318127736,
   EDTA2 -> 0.0019512471541458206,
   H -> 0.000015021216707804835}}

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/



  • Prev by Date: Re: Sorting problem
  • Next by Date: Re: Re: List-Selection
  • Previous by thread: Start Debugger for MathLink from Mathematica
  • Next by thread: Re: Q: NSolve with conditions