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

Testing Martin's statistics code

fricas
)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)
fricas
Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/7576195002424551243-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.03 SEC.
compiling exported stddev : List F -> F Time: 0.01 SEC.
****** Domain: F already in scope augmenting F: (OrderedRing) compiling exported median : List F -> F Time: 0.01 SEC.
****** Domain: F already in scope augmenting F: (OrderedRing) (time taken in buildFunctor: 0)
;;; *** |StatisticalFunctions| REDEFINED
;;; *** |StatisticalFunctions| REDEFINED Time: 0 SEC.
Cumulative Statistics for Constructor StatisticalFunctions Time: 0.05 seconds
finalizing NRLIB STAT Processing StatisticalFunctions for Browser database: --->-->StatisticalFunctions(constructor): Not documented!!!! --->-->StatisticalFunctions((mean (F (List F)))): Not documented!!!! --->-->StatisticalFunctions((stddev (F (List F)))): Not documented!!!! --->-->StatisticalFunctions((median (F (List F)))): Not documented!!!! --->-->StatisticalFunctions(): Missing Description ; compiling file "/var/aw/var/LatexWiki/STAT.NRLIB/STAT.lsp" (written 04 APR 2022 05:34:57 PM):
; /var/aw/var/LatexWiki/STAT.NRLIB/STAT.fasl written ; compilation finished in 0:00:00.025 ------------------------------------------------------------------------ StatisticalFunctions is now explicitly exposed in frame initial StatisticalFunctions will be automatically loaded when needed from /var/aw/var/LatexWiki/STAT.NRLIB/STAT

fricas
mean [1,2,3]

\label{eq1}2(1)
Type: Fraction(Integer)

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

\label{eq2}median_{\verb#"a"# , \: \verb#"g"# , \: \verb#"u"# , \: \verb#"a"# , \: \verb#"d"#}(2)
Type: Symbol




  Subject:   Be Bold !!
  ( 15 subscribers )  
Please rate this page: