MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Function to handle array with variable _number_ of dimensions?


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/


  • Prev by Date: Re: display of function
  • Next by Date: Re: display of function
  • Previous by thread: Re: Function to handle array with variable _number_ of dimensions?
  • Next by thread: Re: Re: Function to handle array with variable _number_ of dimensions?