MathGroup Archive 2010

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

Search the Archive

Re: 2 quick questions

  • To: mathgroup at
  • Subject: [mg112028] Re: 2 quick questions
  • From: Bill Rowe <readnews at>
  • Date: Wed, 25 Aug 2010 06:05:06 -0400 (EDT)

On 8/24/10 at 6:14 AM, lrebanks at (Lea Rebanks) wrote:

>I have 2 quick questions regarding the Solve[Function].

>Firstly I wish to use Solve[eqns, {A, B}] on a simple system of
>equations with missing variables A & B.

>However I wish to constrain the results from Solve ...

>1# - For all values of A and B to be positive values.


>2# - One of the variables, say B, to be a positive integer.

>Please could someone show me the correct coding for these 2
>requirements with a simple working example in both cases.

If I wanted to add constraints on variables in equations, I
would probably use Reduce rather than Solve. That is something like

Reduce[And@@Flatten[{eqns, A>0,B>0,Element[B, Integers]}],{A,B}]

for example

In[10]:= eqns = {x^2 - 1 == 0, 2*x*y^2 == 200};

In[11]:= Reduce[
  And @@ Flatten[{eqns, x > 0, y > 0, Element[y, Integers]}],
{x, y}]

Out[11]= x == 1 && y == 10

  • Prev by Date: Re: Solve[Function] 2 quick questions
  • Next by Date: Re: All componens different
  • Previous by thread: Re: Selecting points from graphics
  • Next by thread: A question about NDSolve