Mathematica 9 is now available

MapAt

Usage

MapAt[f, expr, n]f 应用到expr中位置 n 上的元素中. 如果 n 为负数, 该位置从末尾开始倒着计数.
MapAt[f, expr,  i, j, ...  ]f 应用到 expr 中位置  i, j, ...  上的元素中.
MapAt[f, expr,    ,  , ...  ,   ,  , ...  , ...  ]f 应用到 expr 几个位置的部分中.


Notes

• 例如: MapAt[f,  a, b, c , 2]LongRightArrow .
MapAt[f, expr,  i, j, ...  ]MapAt[f, expr,   i, j, ...   ]f 应用到 expr[[i, j, ... ]]部分.
MapAt[f, expr,    ,  , ...  ,   ,  , ...  , ...  ]f 应用到 expr[[ ,  , ... ]], expr[[ ,  , ... ]], ...等部分.
MapAt 使用的位置列表同函数 Position 返回的列表具有同样的形式.
• 如果某个部分在位置列表中提到不止一次,MapAt会把 f 重复应用到这个特殊部分.
• 例如: MapAt[f,  a, b, c ,   1 ,  3 ,  1  ]LongRightArrow .
• 参见 Mathematica全书: 2.2.4节.
• 同时参见: ReplacePart, Delete, FlattenAt.
Further Examples

This specifies that f is mapped across the list at position  only.

In[1]:=  

Out[1]=

Here f is mapped on the second position of the first element.

In[2]:=  

Out[2]=

To avoid ambiguity when there is more than one part specification, you must put each of them in a separate sublist.

In[3]:=  

Out[3]=

In[4]:=  

Out[4]=

Here is a  x  matrix.

In[5]:=  

Out[5]=

This replaces all the elements of the second row and the first element of the third row by zeros.

In[6]:=  

Out[6]=

In[7]:=  



Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.