Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #2697

Re: Part isn't recursive?

From BernieTheJet <berniethejet@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Part isn't recursive?
Date 2011-05-25 09:57 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <irijpf$qes$1@smc.vnet.net> (permalink)
References <irdcnk$3o5$1@smc.vnet.net> <irfvih$bv0$1@smc.vnet.net>

Show all headers | View raw


On May 24, 5:59 am, "p.ramsden" <p.rams...@imperial.ac.uk> wrote:
> I suspect there's no easy way to set the attribute Listable over only
> some arguments, and that this goes quite deep into Mathematica's
> design. (For Part to work as you'd like, you in effect need it be
> Listable over all arguments except the first.)
>
> Could be wrong though.
>
> I don't think it's a huge problem; this sort of thing is why we have
> Map...

I am not sure I understand what you mean by 'Listable over all
arguments'.  I am pretty sure this is not what I am thinking should be
the default behaviour.  Map and Table here for my example achieve the
same result, but what I am talking about is the recursiveness.  This
example I gave works for Table and Map only because it just happens to
have only one more level.  But if I create a further level in X, i.e.:

X = Table[i + j + k, {i, 3}, {j, 6}, {k,9}]

then I would also like Part to automatically handle

X[[All, { {{1, 2, 3}, {4, 5, 6}}, {{1, 2, 3}, {4, 5, 6}}}]]

Right?

For Map to work you'd have to, again, role it by hand with two levels
of Map, I believe.

What would be required, in effect, is to have something like a Mapped
Nest:

MapNest[f, {{a,b},{c,d}}] -> f[{f[a],f[b]},{f[c], f[d]}]

Is that right?

I thought Inner might work, i.e.

Inner[Part[#1, #2] &, X, {{1, 2, 3}, {4, 5, 6}}, Part[#1, #2] &]

but to no effect.

Anyway, the point is the recursiveness.

As for Bill's point: I understand how Mathematica works, and I have already
achieved what I want.  Now I am on to the next step of telling Wolfram
what I would like them to do to improve Mathematica.

B

Back to comp.soft-sys.math.mathematica | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: Part isn't recursive? Bill Rowe <readnews@sbcglobal.net> - 2011-05-23 10:25 +0000
  Re: Part isn't recursive? "p.ramsden" <p.ramsden@imperial.ac.uk> - 2011-05-24 09:59 +0000
    Re: Part isn't recursive? BernieTheJet <berniethejet@gmail.com> - 2011-05-25 09:57 +0000

csiph-web