Re: Defining differential operators question
- To: mathgroup at smc.vnet.net
- Subject: [mg13850] Re: [mg13797] Defining differential operators question
- From: "Jurgen Tischer" <jtischer at col2.telecom.com.co>
- Date: Sun, 30 Aug 1998 03:35:37 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Hi Tom, this worked on my PC for your examples: NewD[li_List,f_Symbol]:= Evaluate[li. Table[Derivative[n][f][#],{n,0,Length[li]-1}]]& Jurgen -----Original Message----- From: tgoetze at my-dejanews.com <tgoetze at my-dejanews.com> To: mathgroup at smc.vnet.net Subject: [mg13850] [mg13797] Defining differential operators question >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 > >