MathGroup Archive 2012

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

Search the Archive

Re: [newb] simple equation substitutions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg128542] Re: [newb] simple equation substitutions
  • From: p-crossbow <goramedforsiktigt at gmail.com>
  • Date: Fri, 2 Nov 2012 00:43:46 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <k6t7qk$1mi$1@smc.vnet.net>

You would have to use Solve[%,{x,y}] to get the answer you're looking for. My best understanding of this is that Mathematica sees a system of equations with two unknowns - x & y despite the fact that the solution for x is trivial. As such, Solve[] requires both unknowns specified as solve variables in order to return a result that isn't full dimensional.

When you know the value for a variable, as in the case above, it is simpler if you perform a substitution rather than creating another equation for Solve[] to wrestle with.

{y==x+2}/.{x->7}
Solve[%, y]

If you would rather post-process your equations to perform this substitution, one way to do this could be:

eqns={y==x+2,x==7};
eqns/.(Cases[eqns,_Symbol==_Integer]/.{(u_Symbol==v_Integer)->(u->v})

I've assumed above that the RHS is always an integer in my pattern, but this can be adjusted "to taste". I'm sure there are more elegant ways of doing this, and perhaps some of the fine people here can help there.

Le jeudi 1 novembre 2012 00:21:48 UTC-7, Neal Becker a =E9crit :
> {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: Conformal Mapping
  • Next by Date: Add an Expiry Date to a CDF
  • Previous by thread: Re: [newb] simple equation substitutions
  • Next by thread: Re: [newb] simple equation substitutions