       Re: Problem with Patterns and Integrate

• To: mathgroup at smc.vnet.net
• Subject: [mg123257] Re: Problem with Patterns and Integrate
• From: Bob Hanlon <hanlonr357 at gmail.com>
• Date: Tue, 29 Nov 2011 07:05:35 -0500 (EST)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• References: <201111281053.FAA19741@smc.vnet.net>

```Compare Rule with RuleDelayed

func -> Integrate[func, x]

func -> func*x

func :> Integrate[func, x]

func :> Integrate[func, x]

expr = D[f[x], x];

expr /. func_ :> Integrate[func, x]

f[x]

Bob Hanlon

On Mon, Nov 28, 2011 at 5:53 AM, Jack McInerney <ejmcinerney at gmail.com> wrote:
> There is something about using patterns that I don't understand, and
> am hoping someone can shed some light.  Here is an example of my
> problem.  Say I have a function f[x] and I take the derivative of it.
> I can then integrate it and get f[x] back:
>
>
> In:= expr = D[ f[x], x ]
> Out= f=E2=80=B2[x]
>
> In:= Integrate[expr, x]
> Out= f[x]
>
> If I use a ReplaceAll and a pattern to do the integration, the
> Integrate function treats f'[x] as a constant and returns the wrong
> answer:
>
> In:= expr /. func_ ->  Integrate[func,x]
> Out= x f=E2=80=B2[x]
>
> Any thoughts as to what I am doing wrong?
>
> Jack
>

```

• Prev by Date: Re: import data problem
• Next by Date: Re: Problem with Patterns and Integrate
• Previous by thread: Problem with Patterns and Integrate
• Next by thread: Re: Problem with Patterns and Integrate