22 lines
757 B
Plaintext
22 lines
757 B
Plaintext
> mean( { 1/2, 2/3, 3/4, 4/5, 5/6 } ); # set
|
|
71
|
|
---
|
|
100
|
|
|
|
> mean( [ a, 2, c, 2.3, e ] ); # list
|
|
0.8600000000 + a/5 + c/5 + e/5
|
|
|
|
> mean( Array( [ 1, sin( s ), 3, exp( I*t ), 5 ] ) ); # array
|
|
9/5 + 1/5 sin(s) + 1/5 exp(t I)
|
|
|
|
> mean( [ sin(s)^2, cos(s)^2 ] );
|
|
2 2
|
|
1/2 sin(s) + 1/2 cos(s)
|
|
|
|
> Normalizer := simplify: # use a stronger normalizer than the default
|
|
> mean( [ sin(s)^2, cos(s)^2 ] );
|
|
1/2
|
|
|
|
> mean([]); # empty argument causes an exception to be raised.
|
|
Error, (in mean) numeric exception: division by zero
|