MathGroup Archive 2004

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

Search the Archive

Re: Simplify using custom function


Jens wrote:
> example:    complicated expression: -1+2 x +2 e^x
> function: f[x_]=x+e^x
> 
> Mathematica should return: -1+2 f[x]

I use Simplify or FullSimplify and tell mathematica your substitution rules
as equalities in the assumptions argument to the function:

In  := Simplify[-1 + 2 x + 2 e^x, f[x] == x + e^x]
Out := -1 + 2 f[x]

If you need more than one substitution rule then specify them as, for
example, "f[x] == x + e^x && g[x] == x - 2 e^x". If you want to make the
substitution then apply it as a rule:

In  := -1 + 2 f[x] /. f[x] -> x + e^xb
Out := -1 + 2 (e^x + x)

HTH.

Cheers,
Jon.


  • Prev by Date: MultipleListPLot ErrorBar colour bug?
  • Next by Date: Re: NIntegrate or For or Special Function?
  • Previous by thread: RE: Simplify using custom function
  • Next by thread: mathematica 5.0 plot crashes