Re: combinations of pure functions
- To: mathgroup at smc.vnet.net
- Subject: [mg16598] Re: [mg16532] combinations of pure functions
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Wed, 17 Mar 1999 23:55:05 -0500
- Sender: owner-wri-mathgroup at wolfram.com
Gianluca: Just one more adition to my previous answer to your question. If for some reason you do not like to add new global rules you can of course do this: In[1]:= op = Identity - (D[#,x]&) Out[1]= Identity - (D[#1, x] & ) In[2]:= Through[op[x^2],Plus]/.(-f_)[x_]->-(f[x]) Out[2]= 2 -2 x + x Andrzej On Tue, Mar 16, 1999, Gianluca Gorni <gorni at dimi.uniud.it> wrote: >Hello! > >Talking of operators, consider the example of the Book >at Section 2.2.9: > > op = Identity + (D[#,x]&) > >To find the value of op on the expression x^2 it is >suggested to use Through: > > Through[op[x^2], Plus] > >Unfortunately the suggestion fails if we just change + >into - in op: > > op2 = Identity - (D[#,x]&) > >What can one do? I have thought of a replacement rule: > > op2 /. {Identity -> x^2, f_Function -> f[x^2] } > >Anyone has a better idea? > >Thank you in advance, > > Gianluca Gorni > > > +---------------------------------+ > | Gianluca Gorni | > | Universita` di Udine | > | Dipartimento di Matematica | > | e Informatica | > | via delle Scienze 208 | > | I-33100 Udine UD | > | Italy | > +---------------------------------+ > | Ph.: (39) 0432-558422 | > | Fax: (39) 0432-558499 | > | mailto:gorni at dimi.uniud.it | > | http://www.dimi.uniud.it/~gorni | > +---------------------------------+ > > > Andrzej Kozlowski Toyama International University JAPAN http://sigma.tuins.ac.jp/ http://eri2.tuins.ac.jp/