[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Axiom-developer] [statistical functions] (nouveau)
From: |
kratt6 |
Subject: |
[Axiom-developer] [statistical functions] (nouveau) |
Date: |
Sat, 11 Jun 2005 05:11:20 -0500 |
Changes
http://page.axiom-developer.org/zope/mathaction/StatisticalFunctions/diff
--
I just started to hack together a couple of statistical functions. Should be
extended of course. The median could be implemented in 'O(n)' steps, but I
don't have the time.
\begin{axiom}
)abb package STAT StatisticalFunctions
StatisticalFunctions(F:Field): Exports == Implementation where
Exports == with
mean: List F -> F
stddev: List F -> F
if F has OrderedRing then
median: List F -> F
Implementation == add
mean l ==
n := #l::F
if n = 0 then error "The mean of an empty list is not defined"
reduce(_+, l)/n
stddev l ==
n := #l::F
if n = 0 then error "The standard deviation of an empty list is not _
defined"
m := mean l
reduce(_+, map((#1-m)**2, l)$ListFunctions2(F,F))/(n-1)
if F has OrderedRing then
median l ==
n := #l
if n = 0 then error "The median of an empty list is not defined"
sort(l).(n quo 2)
\end{axiom}
--
forwarded from http://page.axiom-developer.org/zope/mathaction/address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Axiom-developer] [statistical functions] (nouveau),
kratt6 <=