MathGroup Archive 2012

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

Search the Archive

Re: simple equation substitutions


eqns = {y == x + 2, x == 7};

Solve[eqns, {x, y}]

{{x -> 7, y -> 9}}

Solve[eqns, Variables[eqns]]

{{x -> 7, y -> 9}}

Simplify[Solve[eqns[[1]], y], eqns[[2]]]

{{y -> 9}}

Simplify[Solve[#[[1]], y], #[[2]]] &@eqns

{{y -> 9}}

Solve[eqns, y, Integers]

{{y -> ConditionalExpression[9, x == 7]}}

Reduce[eqns, {x, y}] // ToRules

{x -> 7, y -> 9}

Reduce[eqns, y] // ToRules

{x -> 7, y -> 9}

Reduce[eqns, x] // ToRules

{y -> 9, x -> 7}

Eliminate[eqns, x] // ToRules

{y -> 9}


Bob Hanlon


On Thu, Nov 1, 2012 at 3:19 AM, Neal Becker <ndbecker2 at gmail.com> wrote:
> {y == x + 2, x == 7}
>
> Solve[%, y]
>
> -> {}
>
> What I expected to happen is have x->7 applied to y == x+2.
>
> My real plan is to develop a list of (a lot more complicated) expressions that will have repeated substitutions applied.
>
> Why didn't the above work and/or what should I do instead?
>



  • Prev by Date: Re: Solve...or not
  • Next by Date: Abs in the denominator
  • Previous by thread: [newb] simple equation substitutions
  • Next by thread: Re: simple equation substitutions