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
>
MapAt
>
BUILT-IN MATHEMATICA SYMBOL
Applying Functions to Parts of Expressions
Tutorials »
|
Map
MapIndexed
ReplacePart
Delete
FlattenAt
See Also »
|
Applying Functions to Lists
Elements of Lists
Expressions
Functional Programming
Parts of Expressions
Structural Operations on Expressions
More About »
MapAt
MapAt
applies
f
to the element at position
n
in
expr
. If
n
is negative, the position is counted from the end.
MapAt
applies
f
to the part of
expr
at position
.
MapAt
applies
f
to parts of
expr
at several positions.
MORE INFORMATION
MapAt
or
MapAt
applies
f
to the part
.
MapAt
applies
f
to parts
,
, ....
»
The list of positions used by
MapAt
is in the same form as is returned by the function
Position
.
»
MapAt
applies
f
repeatedly to a particular part if that part is mentioned more than once in the list of positions.
»
EXAMPLES
CLOSE ALL
Basic Examples
(3)
Map
onto the part at position
:
Map
onto multiple parts:
Map
onto a more deeply nested part:
Map
onto the part at position
:
In[1]:=
Out[1]=
Map
onto multiple parts:
In[1]:=
Out[1]=
Map
onto a more deeply nested part:
In[1]:=
Out[1]=
Scope
(5)
A single element of the expression:
Negative numbers count from the end:
Map at a part at level 2:
Map at several elements:
Map at several nested parts:
Generalizations & Extensions
(3)
MapAt
can be used on expressions with any head:
The function can be mapped onto the heads as well:
Map
can be used on sparse arrays:
Applications
(4)
Reset an element in a matrix:
Reverse the sign of an element in a matrix:
Enumerate cases with
mapped onto successive elements:
Reverse the color of a cell at a random position at each step:
Properties & Relations
(2)
MapAt
can use lists of parts returned by
Position
:
These are the subexpressions returned by
Extract
:
MapAt
applies
repeatedly if a part is mentioned repeatedly:
SEE ALSO
Map
MapIndexed
ReplacePart
Delete
FlattenAt
TUTORIALS
Applying Functions to Parts of Expressions
MORE ABOUT
Applying Functions to Lists
Elements of Lists
Expressions
Functional Programming
Parts of Expressions
Structural Operations on Expressions
RELATED LINKS
NKS|Online
(
A New Kind of Science
)
New in 1