Re: combinations of pure functions
- To: mathgroup at smc.vnet.net
- Subject: [mg16590] Re: [mg16532] combinations of pure functions
- From: "David Park" <djmp at earthlink.net>
- Date: Wed, 17 Mar 1999 23:55:02 -0500
- Sender: owner-wri-mathgroup at wolfram.com
Gianluca, The use of Through is not as easy to use as one might expect. Sometimes you have to use the second argument which specifies the head of the expression. There are other subtitles such as when you push Power[# ,2]& through. Constants like 2 also get pushed through. I have designed a ThroughRule which makes it easier to apply Through to expressions. The ThroughRule is contained in and illustrated on many examples in a notebook, NewThroughRule.nb, available on my web site. This is the ThroughRule. ThroughRule::usage= "ThroughRule[argslist, constantslist:{}] is a rule which applies Through to subexpressions of the form a_. (h_)[args] where args are as in arglist. The rule may be used with ReplaceRepeated to push a complex head expression onto the arguments. The optional constantslist gives a list of symbols which are to be taken as constants. Numbers will automatically be treated as constants."; ThroughRule[{args___},constants_List:{}]= a_. (h_/;=ACMatchQ[Head[h],Derivative[__]] && =ACAtomQ[h])[args]:>( a Through[h[args],Head[h]]/.g_?NumberQ[___] :> g /.( g:(E|Pi|I))[___] :> g/. g_[___] :> g/; MemberQ[constants, g]); David Park djmp at earthlink.net http://home.earthlink.net/~djmp/