login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Testing Martin's statistics code

axiom
)abbrev 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)
axiom
Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/4372653822899247572-25px.001.spad using 
      old system compiler.
   STAT abbreviates package StatisticalFunctions 
------------------------------------------------------------------------
   initializing NRLIB STAT for StatisticalFunctions 
   compiling into NRLIB STAT 
   compiling exported mean : List F -> F
Time: 0.11 SEC.
compiling exported stddev : List F -> F Time: 0.06 SEC.
****** Domain: F already in scope augmenting F: (OrderedRing) augmenting $: (SIGNATURE $ median (F (List F))) compiling exported median : List F -> F Time: 0.02 SEC.
****** Domain: F already in scope augmenting F: (OrderedRing) augmenting $: (SIGNATURE $ median (F (List F))) (time taken in buildFunctor: 0)
;;; *** |StatisticalFunctions| REDEFINED
;;; *** |StatisticalFunctions| REDEFINED Time: 0 SEC.
Cumulative Statistics for Constructor StatisticalFunctions Time: 0.19 seconds
finalizing NRLIB STAT Processing StatisticalFunctions for Browser database: --->-->StatisticalFunctions((mean (F (List F)))): Not documented!!!! --->-->StatisticalFunctions((stddev (F (List F)))): Not documented!!!! --->-->StatisticalFunctions((median (F (List F)))): Not documented!!!! --->-->StatisticalFunctions(constructor): Not documented!!!! --->-->StatisticalFunctions(): Missing Description ------------------------------------------------------------------------ StatisticalFunctions is now explicitly exposed in frame initial StatisticalFunctions will be automatically loaded when needed from /var/zope2/var/LatexWiki/STAT.NRLIB/code

axiom
mean [1,2,3]
LatexWiki Image(1)
Type: Fraction Integer

is it possible to change the package --unknown, Tue, 26 Jul 2005 05:15:09 -0500 reply
axiom
median (["a","g","u","a","d"])
LatexWiki Image(2)
Type: Symbol




subject:
  ( 7 subscribers )  
Please rate this page: