From: Kevin T. <aca...@us...> - 2001-05-28 04:28:16
|
Quoting from numdoc.pdf, dated March 31, 2001, in section "Creating an array from a function: fromfunction()" > The implementation of fromfunction consists of: > > def fromfunction(function, dimensions): > return apply(function, tuple(indices(dimensions))) > > which means that the function function is called for each element in > the sequence indices(dimensions) [...] This is wholly incorrect. apply() does not call a function for each element in the sequence, apply calls a function exactly *once*, using the elements of the sequence for arguments. Also, that same section of the documentation refers to "the first example below [...] works" and "the second array [...] fails", but there is only one example, which apparently is the failing one (as it's named "buggy"). Having a *working* example would be nice. =) Perhaps this is a formatting glitch in the documentation processor, but I couldn't find the documentation's source format. and then... there's always the possibility that I'm barking up the wrong tree. What I'm trying to achieve is this: I've got a function which, given a vector describing a point in n-dimensional space, returns a value for that point. I want a matrix of the shape I specify, filled these values, with the array indicies as coordinates for the points. Is that too much to ask? ;) Thanks, - Kevin Turner [using Python version 2.0, PyNum 19.0.0] -- Kevin Turner <aca...@us...> | OpenPGP encryption welcome here http://www.purl.org/wiki/python/KevinTurner |