Re: Sums of Functions as Derivative Operators
- To: mathgroup at smc.vnet.net
- Subject: [mg33127] Re: Sums of Functions as Derivative Operators
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Mon, 4 Mar 2002 06:04:03 -0500 (EST)
- Organization: Universitaet Leipzig
- References: <a5nsgn$reb$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
whats wrong with:
Unprotect[Derivative]
Derivative[n_Integer][f_ + g_] := Derivative[n][f] + Derivative[n][g]
Protect[Derivative]
??
Regards
Jens
David Park wrote:
>
> Dear MathGroup,
>
> I would be interested in any comments on this little piece of Mathematica
> and mathematics.
>
> If f and g are functions and a and b are constants, we usually use the rule
>
> (a f + b g)[t] == a f[t] + b g[t]
>
> What about
>
> (a f + b g)'[t] == a f'[t] + b g'[t] ?
>
> What is the easiest method to get Mathematica to make this simplification?
> Mathematica won't simplify the above expression (of course, how does it know
> that f and g are functions?), but it won't simplify the following either.
>
> (Cos + Sin)'[t] or even
>
> (Cos[#] & + (Sin[#] &))'[t]
>
> Nor does Through seem to work.
>
> It seems that the way to simplify (a f + b g)'[t] is to actually write
>
> (Function[t, a Function[t, f[t]][t] + b Function[t, g[t]][t]])'[t]
> a f'[t] + b g'[t]
>
> But that is certainly quite cumbersome. So I wrote a little routine which
> will convert a linear derivative expression to the functional form. You have
> to give it a list of symbols which will be regarded as functions.
>
> DerivativeBreakout[functions_List][expr_] :=
> Module[{temp},
> temp =
> expr //. Derivative[args__][a_ + b_] :>
> Derivative[args][Function[t, a[t] + b[t]]];
> temp //.
> Derivative[args__][
> a_?(FreeQ[#, Alternatives @@ functions] &) f_?(MemberQ[
> functions, #] &)] :>
> Derivative[args][Function[t, a f[t]]]
> ]
>
> (a f + b g)'[t]// DerivativeBreakout[{f, g}]
> a f'[t] + b g'[t]
>
> (Cos + Sin)'[t] // DerivativeBreakout[{Cos, Sin}]
> Cos[t] - Sin[t]
>
> Is there a better method for doing this?
>
> David Park
> djmp at earthlink.net
> http://home.earthlink.net/~djmp/