|
|
last edited 11 years ago by test1 |
1 2 | ||
Editor:
Time: 2007/11/18 18:38:23 GMT-8 |
||
Note: is it possible to change the package |
changed: - Testing Martin's statistics code \begin{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) \end{axiom} \begin{axiom} mean [1,2,3] \end{axiom} From unknown Tue Jul 26 05:15:09 -0500 2005 From: unknown Date: Tue, 26 Jul 2005 05:15:09 -0500 Subject: is it possible to change the package Message-ID: <20050726051509-0500@page.axiom-developer.org> \begin{axiom} median (["a","g","u","a","d"]) \end{axiom}
Testing Martin's statistics code
)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)
Compiling FriCAS source code from file /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/4372653822899247572-25px.001.spad using old system compiler. STAT abbreviates package StatisticalFunctions ******** Spad syntax error detected ******** Expected: |)| The prior line was:
25> m := mean l
The current line is:
26> reduce(_+,map((#1-m)**2, l)$ListFunctions2(F, F))/(n-1)
The number of valid tokens is 1. The prior token was #S(TOKEN :SYMBOL |)| :TYPE KEYWORD :NONBLANK 26) The current token is #S(TOKEN :SYMBOL POWER :TYPE KEYWORD :NONBLANK 26)
mean [1,2, 3]
(1) |
median (["a","g", "u", "a", "d"])
(2) |