|
[Date Index]
[Thread Index]
[Author Index]
Re: The Scan Built-In Function
- To: mathgroup at smc.vnet.net
- Subject: [mg46323] Re: [mg46313] The Scan Built-In Function
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Sat, 14 Feb 2004 04:37:57 -0500 (EST)
- References: <200402140258.VAA08616@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On 14 Feb 2004, at 03:58, Harold Noffke wrote:
> 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
>
>
Group theory has very little relevance here. What is relevant is the
FullForm of the expression and the level at which Times and Plus occur.
FullForm[a (x+2) b y]
Times[a,b,Plus[2,x],y]
The default setting for Heads in Scan is False, hence the heads
themselves (Plus and Times) are not shown. Times occurs in the
expression only as Head of the entire expression while Plus occurs as
Head in an expression on level 1. Because Scan does not return the
entire expression itself you never see anything with Times. This has
nothing to do with Plus and Times themselves, to see that just evaluate
Scan[ Print, Plus[a,b,Times[2,x],y], Infinity]
to reverse the effect.
Also
Scan[ Print, a (x + 2) b*y, Infinity, Heads->True]
will show you both Times and Plus.
Andrzej Kozlowski
Chiba, Japan
http://www.mimuw.edu.pl/~akoz/
Prev by Date:
Re: question: How to get Mathematica to show more than one value of a complex valued function?
Next by Date:
Re: A zillion times slower in version 5
Previous by thread:
The Scan Built-In Function
Next by thread:
RE: The Scan Built-In Function
|