This file is indexed.

/usr/share/axiom-20170501/src/algebra/RFDIST.spad is in axiom-source 20170501-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
)abbrev package RFDIST RandomFloatDistributions
++ Description:
++ This package exports random floating-point distributions

RandomFloatDistributions() : SIG == CODE where

  NNI ==> NonNegativeInteger

  SIG ==> with

    uniform01 : () -> Float
      ++ uniform01() \undocumented

    normal01 : () -> Float
      ++ normal01() \undocumented

    exponential1 : () -> Float
      ++ exponential1() \undocumented

    chiSquare1 : NNI -> Float
      ++ chiSquare1(n) \undocumented

    uniform : (Float, Float) -> (() -> Float)
      ++ uniform(f,g) \undocumented

    normal : (Float, Float) -> (() -> Float)
      ++ normal(f,g) \undocumented

    exponential : (Float) -> (() -> Float)
      ++ exponential(f) \undocumented

    chiSquare : (NNI) -> (() -> Float)
      ++ chiSquare(n) \undocumented

    Beta : (NNI, NNI) -> (() -> Float)
      ++ Beta(n,m) \undocumented

    F : (NNI, NNI) -> (() -> Float)
      ++ F(n,m) \undocumented

    t : (NNI) -> (() -> Float)
      ++ t(n) \undocumented

  CODE ==> add

        import RandomNumberSource()

        -- random()  generates numbers in 0..rnmax
        rnmax := (size()$RandomNumberSource() - 1)::Float

        uniform01() ==
            randnum()::Float/rnmax

        uniform(a,b) ==
            a + uniform01()*(b-a)

        exponential1() ==
            u: Float := 0
            -- This test should really be  u < m where m is
            -- the minumum acceptible argument to log.
            while u = 0 repeat u := uniform01()
            - log u
        exponential(mean) ==
            mean*exponential1()

        -- This method is correct but slow.
        normal01() ==
            s := 2::Float
            while s >= 1 repeat
                v1 := 2 * uniform01() - 1
                v2 := 2 * uniform01() - 1
                s  := v1**2 + v2**2
            v1 * sqrt(-2 * log s/s)
        normal(mean, stdev) ==
            mean + stdev*normal01()

        chiSquare1 dgfree ==
            x: Float := 0
            for i in 1..dgfree quo 2 repeat
                x := x + 2*exponential1()
            if odd? dgfree then
                x := x + normal01()**2
            x
        chiSquare dgfree ==
            chiSquare1 dgfree

        Beta(dgfree1, dgfree2) ==
            y1 := chiSquare1 dgfree1
            y2 := chiSquare1 dgfree2
            y1/(y1 + y2)

        F(dgfree1, dgfree2) ==
            y1 := chiSquare1 dgfree1
            y2 := chiSquare1 dgfree2
            (dgfree2 * y1)/(dgfree1 * y2)

        t dgfree ==
            n := normal01()
            d := chiSquare1(dgfree) / (dgfree::Float)
            n / sqrt d