Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Pairing of Nodes
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Xah Lee

Posts: 171
Registered: 12/4/04
Pairing of Nodes
Posted: Nov 12, 1996 1:20 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

This is a summary on a programing problem "pairing of nodes". Not many
people wrote. I wish they would.

Problem: Pairing of Nodes.
Given two list of the same Dimensions, how to combine the list so that
the end nodes of the new list pair the end nodes of given lists. Example
and solution:

Clear[li1, li2]

li1 = Array[f, {2,3,4}]
li2 = Array[g, {2,3,4}]

Transpose[ {li1, li2},RotateRight@ Range@ Length@ Dimensions@ {li1,
li2}]

(* ---------solutions --------------*)

(*From: fransm@win.tue.nl (Frans Martens) *)
MapThread[List, {li1,li2}, Length[Dimensions[li1]]]

(*rhall2@umbc.edu (hall robert)*)
MapThread[List, {li1, li2}, Depth[li1] -2]

li1 + li2 /. Plus -> List

Xah
xah@best.com; 74631.731@compuserve.com

http://www.best.com/~xah/SpecialPlaneCurves_dir/InversionGallery_dir/inversionGallery.html
Mountain View, CA, USA







Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.