Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #3126
| From | StatsMath <stats.math8@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Partition a list based on columns |
| Date | 2011-06-16 08:02 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <itcdai$d13$1@smc.vnet.net> (permalink) |
Hi All,
I am looking for help in partition a list based on columns. For ex,
given a list {{3,1},{2,4}}, I want to sort it and then partition it
along columns.
So for the given example, I want the answer to be, {{1,3},{2,4}}.
Right now If I try, Partition[Sort[Flatten[{{3,1},{2,4}}]]],2], I get
{{1,2},{3,4}}.
Looking at doc for Partition[], it doesn't seem to support aligning
rows on columns. I can do it in a For[] loop, but that seems un-
mathematica like, is there a good functional way to do this??
------------
What would be a good way to line up elements in a list in a diagonal
fashion, for ex: from Range[9] want to create the follwing matrix:
1 2 4
3 5 7
6 8 9
Thanks in advance!
Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread
Partition a list based on columns StatsMath <stats.math8@gmail.com> - 2011-06-16 08:02 +0000 Re: Partition a list based on columns Ray Koopman <koopman@sfu.ca> - 2011-06-16 10:24 +0000 Re: Partition a list based on columns Ray Koopman <koopman@sfu.ca> - 2011-06-17 04:09 +0000 Re: Partition a list based on columns Ray Koopman <koopman@sfu.ca> - 2011-06-17 04:06 +0000 Re: Partition a list based on columns DrMajorBob <btreat1@austin.rr.com> - 2011-06-17 09:52 +0000
csiph-web