help-octave
[Top][All Lists]

## mapping a scalar function over an array

 From: Giulio Bottazzi Subject: mapping a scalar function over an array Date: Tue, 7 Mar 2000 12:06:55 +0100

```Dear Octave users,
I've not found in the Octave manual (probably for my stupidity) a way of
"mapping" a scalar function over an array. What I mean is: given a function
defined for a (truly) scalar argument, for instance

function foo(x)
.
.
integrate a given function between 0 and x
.
endfunction

and an array

A=[a1,...,aN],

is there a way to obtain the array of results

B=[foo(a1),...,foo(aN)]

with a single simple command? Something like: Map(foo,A)? ( this is approx. the
syntax I use on Mathematica).

Please, point me to the correct place in the manual if the answer is there and
forgive me for my silliness.

Thank you,
G.B.

-----------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.che.wisc.edu/octave/octave.html
How to fund new projects:  http://www.che.wisc.edu/octave/funding.html
Subscription information:  http://www.che.wisc.edu/octave/archive.html
-----------------------------------------------------------------------

```