Re: Function to handle array with variable _number_ of dimensions?
- To: mathgroup at smc.vnet.net
- Subject: [mg58519] Re: Function to handle array with variable _number_ of dimensions?
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Tue, 5 Jul 2005 04:52:27 -0400 (EDT)
- Organization: The University of Western Australia
- References: <dad7t1$36$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <dad7t1$36$1 at smc.vnet.net>, Joe Christy <joe at eshu.net> wrote: > I'd like to write a function that takes two integer arguments, P and Q > say, and then returns a value calculated from the P x P x ... x P (Q > factors) array, whose entries depend on both P and Q. My first impulse > is to try and iterate over the array, but I don't see how to generate a > non-fixed number of iteration variables. > > Does anyone have a suggestion of a good way to do this, short of writing > a a distinct variant function for each possible value of Q? I'm not exactly sure what you are trying to do, but I would have a look at Outer and Tuples (in 5.1). Also have a look at the Advanced Documentation for these functions in the Help Browser. Cheers, Paul -- Paul Abbott Phone: +61 8 6488 2734 School of Physics, M013 Fax: +61 8 6488 1014 The University of Western Australia (CRICOS Provider No 00126G) AUSTRALIA http://physics.uwa.edu.au/~paul http://InternationalMathematicaSymposium.org/IMS2005/
- Follow-Ups:
- Re: Re: Function to handle array with variable _number_ of dimensions?
- From: Daniel Lichtblau <danl@wolfram.com>
- Re: Re: Function to handle array with variable _number_ of dimensions?