Re: Defining differential operators question
- To: mathgroup at smc.vnet.net
- Subject: [mg13825] Re: Defining differential operators question
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Sat, 29 Aug 1998 04:41:05 -0400
- Organization: University of Western Australia
- References: <6s5lh8$c91@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
tgoetze at my-dejanews.com wrote:
> I would like to be able to define a family of differential operators
> that act on a function being passed in. For simplicity sake, I will
> assume that the functions being passed in are functions of one
> variable.
>
> Suppose that given a list L={a0,a1,a2,a3}, that the differential
> operator defined by L, acts on a function F by:
>
> a0*F + a1*F' + a2*F'' + a3*F'''
Here is one solution using MapIndexed:
In[1]:= NewD[l_List,f_]:=Function[x,Evaluate[
Plus@@MapIndexed[#1 Derivative[First[#2]-1][f][x]&,l]]]
In[2]:= g[x_] := x^3
In[3]:= NewD[{a0,a1,a2,a3},g]
Out[3]=
3 2
Function[x$, a0 x$ + 3 a1 x$ + 6 a2 x$ + 6 a3]
In[4]:= %[1]
Out[4]= a0 + 3 a1 + 6 a2 + 6 a3
Cheers,
Paul
____________________________________________________________________
Paul Abbott Phone: +61-8-9380-2734
Department of Physics Fax: +61-8-9380-1014
The University of Western Australia Nedlands WA 6907
mailto:paul at physics.uwa.edu.au AUSTRALIA
http://www.physics.uwa.edu.au/~paul
God IS a weakly left-handed dice player
____________________________________________________________________