       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[] > 0,
If[Length[myList] > 1,	myList[]*Identity +
Sum[(myList[[i]])(Derivative[i-1][f]),	{i,2,Length[myList]}],
myList[]*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:= <<"a:/diffop.m"

Out= Private`

In:= g[x_]:=x^3;

In:= NewD[{0,2,0,4},g]

2
Out= 4 (6 & ) + 2 (3 #1  & )

In:= %

2
Out= (4 (6 & ) + 2 (3 #1  & ))

In:= Through[%,Plus]

2
Out= (4 (6 & )) + (2 (3 #1  & ))

In:= NewD[{1,1,1},g]

2 Out= Identity + (6 #1 & ) + (3
#1  & )

In:= %

2 Out= (Identity + (6 #1 & ) +
(3 #1  & ))

In:= Through[%,Plus]

Out= 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[])& instead
of myList[]*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

```

• Prev by Date: Re: Disappearing variables
• Next by Date: Re: Disappearing variables
• Previous by thread: Re: MacOS vs. Windows PC for Mathematica?
• Next by thread: Re: Defining differential operators question