MathGroup Archive 2004

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

Search the Archive

Re: Simplify using custom function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg47711] Re: Simplify using custom function
  • From: Jon Harrop <jdh30 at cam.ac.uk>
  • Date: Fri, 23 Apr 2004 02:30:39 -0400 (EDT)
  • Organization: University of Cambridge
  • References: <c65fnl$2pn$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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