Defining differential operators question
- To: mathgroup at smc.vnet.net
- Subject: [mg13797] Defining differential operators question
- From: tgoetze at my-dejanews.com
- Date: Fri, 28 Aug 1998 04:18:21 -0400
- Organization: Deja News - The Leader in Internet Discussion
- Sender: owner-wri-mathgroup at wolfram.com
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'''
My attempt was a package that looks like this:
----------------------------Package Code----------------------------
NewD::usage = "A differential operator defined by the list."
Begin["Private`"]
NewD[myList_List,f_Symbol]:= Module[{}, If[myList[[1]] > 0,
If[Length[myList] > 1, myList[[1]]*Identity +
Sum[(myList[[i]])(Derivative[i-1][f]), {i,2,Length[myList]}],
myList[[1]]*Identity],
Sum[Times[myList[[i]],Derivative[i-1][f]],{i,2,Length[myList]}] ]];
End[] --------------------------End of Package
code----------------------------
Now this package seems to work for some simple cases, but for more
complicated cases, it seems I get into a "nest" of pure functions that
I can't seem to get Mathematica to evaluate.
For example, here is a short kernel session illustrating the problem:
------------------------Notebook Extract------------------------------
Mathematica 3.0 for Microsoft Windows Copyright 1988-97 Wolfram
Research, Inc.
-- Terminal graphics initialized --
In[1]:= <<"a:/diffop.m"
Out[1]= Private`
In[2]:= g[x_]:=x^3;
In[3]:= NewD[{0,2,0,4},g]
2
Out[3]= 4 (6 & ) + 2 (3 #1 & )
In[4]:= %[1]
2
Out[4]= (4 (6 & ) + 2 (3 #1 & ))[1]
In[5]:= Through[%,Plus]
2
Out[5]= (4 (6 & ))[1] + (2 (3 #1 & ))[1]
In[6]:= NewD[{1,1,1},g]
2 Out[6]= Identity + (6 #1 & ) + (3
#1 & )
In[7]:= %[1]
2 Out[7]= (Identity + (6 #1 & ) +
(3 #1 & ))[1]
In[8]:= Through[%,Plus]
Out[8]= 10
--------------------End of Notebook Extract-----------------------
I want to be able to get %5 evaluated. Any suggestions? It looks like it
might be a problem with the constant mulitple of a pure function. For
example, what is 6 Identity as a pure function? I guess I want (6 #)&,
but it's not clear how to do that. (I've tried (myList[[1]])& instead
of myList[[1]]*Identity, but pure functions have Hold All, so it
doesn't quite work).
Thanks,
Tom Goetze
TomG at UltimateTech.com
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum