PRODUCTS
Products Overview
Mathematica
Mathematica Student Edition
Mathematica Home Edition
Wolfram
CDF Player
(free download)
Computable Document Format (CDF)
web
Mathematica
grid
Mathematica
Wolfram
Workbench
Wolfram
SystemModeler
Wolfram
Finance Platform
Mathematica
Add-Ons
Wolfram|Alpha Products
SOLUTIONS
Solutions Overview
Engineering
Aerospace Engineering & Defense
Chemical Engineering
Control Systems
Electrical Engineering
Image Processing
Industrial Engineering
Materials Science
Mechanical Engineering
Operations Research
Optics
Petroleum Engineering
Biotechnology & Medicine
Bioinformatics
Medical Imaging
Finance, Statistics & Business Analysis
Actuarial Sciences
Data Analysis & Mining
Econometrics
Economics
Financial Engineering & Mathematics
Financial Risk Management
Statistics
Software Engineering & Content Delivery
Authoring & Publishing
Interface Development
Software Engineering
Web Development
Science
Astronomy
Biological Sciences
Chemistry
Environmental Sciences
Geosciences
Social & Behavioral Sciences
Design, Arts & Entertainment
Game Design, Special Effects & Generative Art
Education
STEM Education Initiative
Higher Education
Community & Technical College Education
Primary & Secondary Education
Students
Technology
Computable Document Format (CDF)
High-Performance & Parallel Computing (HPC)
See Also: Technology Guide
PURCHASE
Online Store
Other Ways to Buy
Volume & Site Licensing
Contact Sales
Software
Service
Upgrades
Training
Books
Merchandise
SUPPORT
Support Overview
Mathematica
Documentation
Knowledge Base
Learning Center
Technical Services
Community & Forums
Training
Does My Site Have a License?
Wolfram User Portal
COMPANY
About Wolfram Research
News
Events
Wolfram Blog
Partnerships
Employment Opportunities
History of
Mathematica
Stephen Wolfram's Home Page
Contact Us
OUR SITES
All Sites
Wolfram|Alpha
Demonstrations Project
MathWorld
Integrator
Wolfram Functions Site
Mathematica Journal
Wolfram Media
Wolfram
Tones
Wolfram Science
Stephen Wolfram
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE
DOCUMENTATION CENTER
FOR THE LATEST INFORMATION.
DOCUMENTATION CENTER SEARCH
New to
Mathematica
?
Find your learning path
»
Mathematica
>
Core Language
>
Expressions
>
Parts of Expressions
>
Sow
>
BUILT-IN MATHEMATICA SYMBOL
Constructing Lists
Collecting Expressions During Evaluation
Tutorials »
|
Reap
Throw
AppendTo
EvaluationMonitor
StepMonitor
Monitor
Scan
See Also »
|
Constructing Lists
Language Overview
List Manipulation
Parts of Expressions
Tuning & Debugging
More About »
Sow
Sow
[
e
]
specifies that
e
should be collected by the nearest enclosing
Reap
.
Sow
specifies that
e
should be collected by the nearest enclosing
Reap
whose pattern matches
tag
.
Sow
specifies that
e
should be collected once for each pattern that matches a
.
MORE INFORMATION
Sow
returns
e
.
By having several identical
, a single expression can be made to appear multiple times in a list returned by
Reap
.
Sow
[
e
]
is equivalent to
Sow
[
e
,
None
]
.
Sow
sows an expression with tag
{
tag
}
.
EXAMPLES
CLOSE ALL
Basic Examples
(4)
Evaluate a sequence of expressions, "sowing" some to be collected by
Reap
:
Compute a sum, "sowing"
at each step:
Make separate lists for expressions "sown" with different tags:
Reap only expressions "sown" with tag
:
Evaluate a sequence of expressions, "sowing" some to be collected by
Reap
:
In[1]:=
Out[1]=
Compute a sum, "sowing"
at each step:
In[1]:=
Out[1]=
Make separate lists for expressions "sown" with different tags:
In[1]:=
Out[1]=
Reap only expressions "sown" with tag
:
In[1]:=
Out[1]=
Scope
(5)
Sow
can be used anywhere in a computation:
It still works inside a function:
A single expression can be "sown" with multiple tags:
If a single tag is repeated, the expression is sown repeatedly:
A pattern in
Reap
can be used to specify which tags to collect:
The default is the pattern
, so that everything is collected:
Tags can have any form; here they are
True
and
False
:
Applications
(3)
Make a list of all the steps taken in evaluating
FindRoot
:
Evaluate an iterated map, keeping iterates that are below 1/100:
Find equivalence classes with respect to the value of
mod 10:
Properties & Relations
(2)
Sow
[
x
]
returns
x
, "sowing" it as a side effect:
Expressions sown are reaped by the innermost enclosing
Reap
:
SEE ALSO
Reap
Throw
AppendTo
EvaluationMonitor
StepMonitor
Monitor
Scan
TUTORIALS
Constructing Lists
Collecting Expressions During Evaluation
MORE ABOUT
Constructing Lists
Language Overview
List Manipulation
Parts of Expressions
Tuning & Debugging
New in 5