Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum > General > > "Functions calling for exactly Two Arguments"

Post Reply:
Name:
Email Address:

Please send email when my message is replied to.

Url (optional):
Subject:
Message: view original message?
Attachment (optional):
Please answer this:1+1 =



Original Message (ID '548034') By jf:
To run a function of multiple arguments over many sets of arguments, use Thread or MapThread. Schematic example: Make a list of all possible pairs. In[1]:= ol = Outer[List, {a, b, c}, {a, b, c}] Get rid of the extra level of nesting. In[2]:= olf = Flatten[ol, 1] Drop the cases in which the two elements are the same. In[3]:= olfd = DeleteCases[olf, {q_, q_}] Drop the redundant cases in which the two elements are in opposite order. In[4]:= dd = DeleteDuplicates[Map[Sort, olfd ]] // Transpose Out[4]= {{a, a, b}, {b, c, c}} Now run the function over the two lists. In[5]:= MapThread[LongestCommonSubsequence, dd]