RE: The Scan Built-In Function
- To: mathgroup at smc.vnet.net
- Subject: [mg46331] RE: [mg46313] The Scan Built-In Function
- From: "David Park" <djmp at earthlink.net>
- Date: Sat, 14 Feb 2004 22:19:42 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Harold,
Your first example didn't show any expression involving Plus for the same
reason that your second example didn't show any expression involving Times.
Scan applies the function to the elements of the expression, but not
normally to the entire expression. However you can also apply the function
to the entire expression by changing the level specification. For your first
example...
Scan[Print, a*x^2 + b*x, {0, Infinity}]
and for your second example...
Scan[Print, a*(x + 2)*b*y, {0, Infinity}]
You may wish to check the documentation for Level Specifications in A.3.6.
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: Harold Noffke [mailto:Harold.Noffke at wpafb.af.mil]
To: mathgroup at smc.vnet.net
Mathematica 5.0.1 on Windows 2000
MathGroup:
When I studied Scan, I found the following example reasonable ...
In[4]:= Scan[ Print, a x^2 + b x, Infinity ]
b
x
b x
a
x
2
2
x
2
a x
Then I modified the example to this ...
In[5]:= Scan[ Print, a (x + 2) b*y, Infinity ]
a
b
2
x
2 + x
y
Then I got confused.
Here's my question. In In[4], why does Mathematica not show any
expressions which use "+"? In abstract group theory, there is no
distinction between "+" and "*", and this is what confuses me when I
think about Scan from the group theory perspective.
Can anyone guide my thinking back onto the Mathematica track?
Thanks.
Harold