MathGroup Archive 2006

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

Search the Archive

Re: Ask Mathematica to sub for a long expression

  • To: mathgroup at smc.vnet.net
  • Subject: [mg71933] Re: Ask Mathematica to sub for a long expression
  • From: "dimitris" <dimmechan at yahoo.com>
  • Date: Mon, 4 Dec 2006 06:39:23 -0500 (EST)
  • References: <ekp4o4$2fq$1@smc.vnet.net><ekudat$86k$1@smc.vnet.net>

-a - b /. (n_.)*a + (m_.)*b -> c
c

2*a + 2*b /. (n_.)*a + (m_.)*b -> c
c

Look at the FullForm of expressions

FullForm[-a - b]
Plus[Times[-1,a],Times[-1,b]]

FullForm[2a+2b]
Plus[Times[2,a],Times[2,b]]

Information["_.", LongForm -> False]
p:v is a pattern object which represents an expression of the form p,
which, \
if omitted, should be replaced by v.

Regards
Dimitris


aaronfude at gmail.com wrote:
> Hi,
>
> Thanks for all the responses. It doesn't quite work for me, but maybe
> with a little extra expertise it will. The problem is that that pattern
> is not always obvious w/o extra algebra. The basic problem is
> summarized in the fact that the following doesn't work the way I'd like
> it to:
>
> -a-b/.a+b->c
> 
> 2a+2b/.a+b->c
> 
> Many thanks in advance!
> 
> Aaron Fude


  • Prev by Date: Re: Solving the Cubic
  • Next by Date: Making plots using transformation rules
  • Previous by thread: Re: Ask Mathematica to sub for a long expression
  • Next by thread: Re: Ask Mathematica to sub for a long expression