"logo.gif"  
Main
Read Online
Download PDF
Additional resources
Revision history
Known typos/bugs
Report a bug
License terms
About the author
"node502_1.gif" "node502_2.gif" "node502_3.gif"

5.3.4.8     Using  Outer in more complicated cases: a caution

Outer may be used in more general setting, in particular when the input lists are not simple, but nested lists. There is one specific instance of that case which I would like to discuss now.

"node502_4.gif"

Consider the following situation:

"node502_5.gif"

"node502_6.gif"

This output is not what one would immediately expect. What if I want to get my function <f> applied to the sublists, like {{f[{1,2},{5,6}],...}}. To achieve this, we have to tell Outer that it should treat sublists as individual elements. This is done by specifying elements on which level of the input lists (first in this case) should be treated as individual elements:

"node502_7.gif"

"node502_8.gif"

Now we get what we wanted. In this particular case, another possibility to get it is to use Distribute:

"node502_9.gif"

"node502_10.gif"

For more details on Distribute, consult Mathematica  Help and Mathematica  Book.

"node502_11.gif" "node502_12.gif" "node502_13.gif"

Created by Wolfram Mathematica 6.0  (05 February 2009) Valid XHTML 1.1!