MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: The Scan Built-In Function


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



  • Prev by Date: Re: question: How to get Mathematica to show more than one value of a complex valued function?
  • Next by Date: RE: Understanding Flatten
  • Previous by thread: Re: The Scan Built-In Function
  • Next by thread: question: How to get Mathematica to show more than one value of a complex valued function?