Re: Forcing Argument Evaluation
- To: mathgroup at smc.vnet.net
- Subject: [mg49881] Re: [mg49848] Forcing Argument Evaluation
- From: "David Park" <djmp at earthlink.net>
- Date: Thu, 5 Aug 2004 09:20:50 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Scott,
If you want to use operators this way you might want to look at the
Algebra`PushThrough package at my web site below.
Needs["Algebra`PushThrough`"]
f[x_] := x^2;
{f, f/2}[2]
% // PushThrough[]
{f, f/2}[2]
{4, 2}
Whereas if you use the regular Through command you get
{f, f/2}[2] // Through
{4, (f/2)[2]}
Similarly
(f/2)[2] // Through
4*(1/2)[2]
Through pushed the argument 2 onto f AND onto (1/2).
(f/2)[2] // PushThrough[]
2
Also
(f/a)[2] // PushThrough[Constants -> {a}]
4/a
(f^2 - 2*f)[x]//PushThrough[]
-2*x^2 + x^4
but
(f^2 - 2f)[x] // Through
(-2*f)[x] + (f^2)[x]
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: Scott Guthery [mailto:sguthery at mobile-mind.com]
To: mathgroup at smc.vnet.net
f[x_] := x^2;
a = {f,f/2};
a[[1]][2]
4
a[[2]][[2]
f/2[2]
I know I'm missing something fundamental.
Cheers, Scott