Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #7770 > unrolled thread
| Started by | Bob Hanlon <hanlonr357@gmail.com> |
|---|---|
| First post | 2012-01-12 09:18 +0000 |
| Last post | 2012-01-12 09:18 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: take square of the second and third column of a table Bob Hanlon <hanlonr357@gmail.com> - 2012-01-12 09:18 +0000
| From | Bob Hanlon <hanlonr357@gmail.com> |
|---|---|
| Date | 2012-01-12 09:18 +0000 |
| Subject | Re: take square of the second and third column of a table |
| Message-ID | <jem8hm$190$1@smc.vnet.net> |
Note that Power is Listable
Attributes[Power]
{Listable, NumericFunction, OneIdentity, Protected}
{a, b, c}^{k, m, n}
{a^k, b^m, c^n}
dataA = RandomInteger[{1, 9}, {100, 3}]
dataB = #^{1, 2, 2} & /@ dataA
Bob Hanlon
On Wed, Jan 11, 2012 at 5:20 PM, hanciong awesome <hanciong@gmail.com> wrote:
> Hello, suppose I have a very long table like this:
>
> 1 2 3
> 4 5 6
> 7 8 9
> .......
> 2 3 4
>
> how can I take square of the 2nd and 3rd column? I always do it by
> making a new table. so let's say the above table is A and it has 100
> lines, then I make the new table as the following:
>
> B=Table[{A[[n]][[1]],A[[n]][[2]]^2,A[[n]][[3]]^2},{n,1,100}]
>
> But if the length of the table is unknown, this way is impractical.
> Could anyone suggests better way? thank you
>
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web