AppleScript does not support extending the standard operators (+ - * /) to custom data types.
To perform arithmetic operations on arrays of real (or on lists of numbers) you must use specific commands. The commands below provide for basic arithmetic operations. See also evalformula in another page to compute any expression.
- addlist
- sublist
- multlist
- divlist
The commands above may mix arrays of real and numbers.
set a to createarray 10000 range {0, 2*pi}
set c to (cos a)
set s to (sin a)
set cs to multlist c with s
set s2 to multlist cs with 2
-- s2 contains 2 * sin a * cos a
- runningsum returns the running sum of an array of real.
|