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

Edit detail for SandBoxCS224 revision 2 of 2

1 2
Editor: muede
Time: 2017/12/17 08:48:52 GMT+0
Note:

changed:
-[1/2, 3/4, 2/3]
artanh:(Float) -> Float
artanh(x) == 
    y := x 
    k := 1
    for k in 1..precision() repeat
        z := x^(2*k+1) / (2 * k + 1)
        y := z + y
    return y

ln2:() -> Float
ln2() == artanh(0.5) + artanh(1.0 / 7)

gamma:(NonNegativeInteger) -> Float
gamma(e) ==
    precision(2 ^ e + 100)
    n := 2.0 ^ e
    eps := 1.0 / n
    A := - e * ln2()
    B := 1.0
    U := A 
    V := 1.0
    k := 1
    repeat
        B := B * n^2 / k^2
        A := (A * n^2 / k + B) / k
        if (A < eps) /\ (B < eps) then
            return U / V
        U := U + A
        V := V + B
        k := k + 1

fractions:(NonNegativeInteger, Integer) -> List(Integer)
fractions(e, n) ==
    y := gamma(e)
    l : List(Integer) := []
    for i in 0..n repeat
        f := floor(y)
        l := cons(f, l)
        y := y - f
        if y > 0 then 
            y := 1 / y
    reverse(l)


removed:
-

changed:
-matA := matrix [[0,0,80],[250,0,-40],[250,-250,80]]
-invmatA := inverse matA
-vecA := [300,300,0]
-invmatA * vecA
-
-matB := matrix [[0,0,l * 72],[250,0,l * -36],[250,-250,l * 72]]
-invmatB := inverse matB
-vecB := [300,300,0]
-invmatB * vecB
-
-matC := matrix [[l1 * 0,l1 * 0,l1 * 80],[l2 * 250,l2 * 0,l2 * -40],[l3 * 250,l3 * -250,l3 *80]]
-invmatC := inverse matC
-vecC := [l1 * 300,l2 * 300,0]
-invmatC * vecC
-
-matPastaA := matrix [[0,0,80,0,-300],[250,0,-40,0,-300],[250,-250,80,0,0],[250,0,100,-250,0],[0,c1,-200,c2,0]]
-matPastaATimeShift := diagonalMatrix [l1,l2,l3,l4,l5]
-matPastaATimeShift * matPastaA
-eqPastaA := determinant (matPastaATimeShift * matPastaA)
-solve(eqPastaA,c1)
-
-matPastaB := matrix [[0,0,80,0],[250,0,-40,0],[250,-250,80,0],[250,0,100,-250]]
-invmatPastaB := inverse matPastaB
-vecPastaB := [300,300,0,0]
-invmatPastaB * vecPastaB
-
-fmatPasta := matrix [[1,-1,0,0,0],[0,-1,1,1,0],[0,0,250,0,-c1],[0,0,0,250,-c2],[0,0,0,0,200]]
-invfmatPasta := inverse fmatPasta
-fvecPasta := [0,0,0,0,W]
-invfmatPasta * fvecPasta
-
-fmatPastaB := matrix [[1,-1,0,0,0],[0,-1,1,1,0],[0,0,250,0,-c1],[0,0,0,250,-c2],[80,40,80,100,0]]
-invfmatPastaB := inverse fmatPastaB
-invfmatPastaB * fvecPasta
-
-detmatFoodClothes := matrix [[0,0,80,0,0,-300],[250,0,-40,0,0,-300],[250,-250,80,0,0,0],[0,0,-200,100000,0,0],[0,0,200,50000,-20,0],[0,167 * c1,-200,0,2 * c2,0]]
-eqFoodClothes := determinant detmatFoodClothes
-solve(eqFoodClothes,c1)
-
-
-matFoodClothes := matrix [[0,0,80,0,0],[250,0,-40,0,0],[250,-250,80,0,0],[0,0,-200,100000,0],[0,0,200,50000,-20]]
-invmatFoodClothes := inverse matFoodClothes
-vecFoodClothes := [300,300,0,0,0]
-invmatFoodClothes * vecFoodClothes
-
fractions(12, 1000)

fricas
(1) -> artanh:(Float) -> Float
Type: Void
fricas
artanh(x) == 
    y := x 
    k := 1
    for k in 1..precision() repeat
        z := x^(2*k+1) / (2 * k + 1)
        y := z + y
    return y
Type: Void
fricas
ln2:() -> Float
Type: Void
fricas
ln2() == artanh(0.5) + artanh(1.0 / 7)
Type: Void
fricas
gamma:(NonNegativeInteger) -> Float
Type: Void
fricas
gamma(e) ==
    precision(2 ^ e + 100)
    n := 2.0 ^ e
    eps := 1.0 / n
    A := - e * ln2()
    B := 1.0
    U := A 
    V := 1.0
    k := 1
    repeat
        B := B * n^2 / k^2
        A := (A * n^2 / k + B) / k
        if (A < eps) /\ (B < eps) then
            return U / V
        U := U + A
        V := V + B
        k := k + 1
Type: Void
fricas
fractions:(NonNegativeInteger, Integer) -> List(Integer)
Type: Void
fricas
fractions(e, n) ==
    y := gamma(e)
    l : List(Integer) := []
    for i in 0..n repeat
        f := floor(y)
        l := cons(f, l)
        y := y - f
        if y > 0 then 
            y := 1 / y
    reverse(l)
Type: Void

fricas
fractions(12, 1000)
fricas
Compiling function artanh with type Float -> Float
fricas
Compiling function ln2 with type () -> Float
fricas
Compiling function gamma with type NonNegativeInteger -> Float
fricas
Compiling function fractions with type (NonNegativeInteger, Integer)
       -> List(Integer)

\label{eq1}\begin{array}{@{}l}
\displaystyle
\left[ 0, \: 1, \: 1, \: 2, \: 1, \: 2, \: 1, \: 4, \: 3, \:{1
3}, \: 5, \: 1, \: 1, \: 8, \: 1, \: 2, \: 4, \: 1, \: 1, \:{4
0}, \: 1, \:{11}, \: 3, \: 7, \: \right.
\
\
\displaystyle
\left.1, \: 7, \: 1, \: 1, \: 5, \: 1, \:{49}, \: 4, \: 1, \:{6
5}, \: 1, \: 4, \: 7, \:{11}, \: 1, \:{399}, \: 2, \: 1, \: 3, \: 2, \: 1, \: 2, \: 1, \: \right.
\
\
\displaystyle
\left.5, \: 3, \: 2, \: 1, \:{10}, \: 1, \: 1, \: 1, \: 1, \: 2, \: 1, \: 1, \: 3, \: 1, \: 4, \: 1, \: 1, \: 2, \: 5, \: 1, \: 3, \: 6, \: 2, \: 1, \: 2, \: \right.
\
\
\displaystyle
\left.1, \: 1, \: 1, \: 2, \: 1, \: 3, \:{16}, \: 8, \: 1, \: 1, \: 2, \:{16}, \: 6, \: 1, \: 2, \: 2, \: 1, \: 7, \: 2, \: 1, \: 1, \: 1, \: 3, \: 1, \: 2, \right.
\
\
\displaystyle
\left.\: 1, \: 2, \:{13}, \: 5, \: 1, \: 1, \: 1, \: 6, \: 1, \: 2, \: 1, \: 1, \:{11}, \: 2, \: 5, \: 6, \: 1, \: 1, \: 1, \: 6, \: 1, \: 2, \: 2, \: 1, \: 5, \right.
\
\
\displaystyle
\left.\: 6, \: 2, \: 1, \: 1, \: 7, \:{13}, \: 4, \: 1, \: 2, \: 4, \: 1, \: 4, \: 1, \: 1, \:{23}, \: 1, \: 9, \: 5, \: 2, \: 1, \: 1, \: 1, \: 8, \: 3, \: 2, \right.
\
\
\displaystyle
\left.\: 4, \: 2, \:{33}, \: 5, \: 1, \: 2, \: 1, \: 3, \: 2, \: 4, \: 2, \: 1, \: 5, \:{12}, \: 1, \:{17}, \: 6, \: 2, \:{3
2}, \: 5, \: 3, \: 1, \: 6, \: 1, \right.
\
\
\displaystyle
\left.\: 3, \: 1, \: 2, \: 1, \:{18}, \: 1, \: 2, \:{17}, \: 1, \: 6, \: 1, \:{21}, \: 1, \: 6, \: 1, \:{71}, \:{18}, \: 1, \: 6, \:{58}, \: 2, \: 1, \: \right.
\
\
\displaystyle
\left.{13}, \:{55}, \: 1, \:{103}, \: 1, \:{14}, \: 1, \: 5, \: 8, \: 1, \: 2, \:{10}, \: 2, \: 1, \: 1, \: 3, \: 3, \: 2, \: 1, \:{182}, \: 1, \: 4, \right.
\
\
\displaystyle
\left.\: 3, \: 2, \: 4, \: 1, \: 2, \: 1, \: 1, \: 1, \: 6, \: 1, \: 1, \: 1, \: 6, \: 1, \: 3, \: 2, \:{69}, \: 2, \: 1, \: 6, \: 2, \: 2, \:{12}, \: 1, \: 1, \right.
\
\
\displaystyle
\left.\: 1, \: 8, \: 1, \: 2, \: 3, \: 2, \: 1, \:{52}, \: 1, \:{25}, \: 4, \: 2, \:{18}, \: 1, \:{40}, \: 1, \:{18}, \: 1, \: 2, \:{14}, \: 1, \: 2, \: 2, \right.
\
\
\displaystyle
\left.\:{10}, \: 1, \: 1, \: 2, \: 6, \:{71}, \: 7, \: 1, \:{1
0}, \: 2, \: 1, \: 1, \: 1, \: 2, \: 1, \: 3, \: 2, \: 4, \: 1, \: 6, \: 3, \: 1, \: 1, \:{29}, \right.
\
\
\displaystyle
\left.\: 1, \:{29}, \: 1, \: 1, \: 3, \: 4, \: 7, \: 1, \: 1, \:{10}, \: 2, \: 2, \:{30}, \: 1, \:{21}, \: 3, \:{12}, \: 1, \:{39}, \: 8, \: 7, \: 1, \: 2, \right.
\
\
\displaystyle
\left.\: 1, \: 2, \: 2, \: 1, \: 1, \: 2, \: 3, \: 1, \:{13}, \: 1, \: 2, \: 3, \: 1, \: 1, \: 1, \: 1, \: 8, \: 7, \: 1, \: 1, \: 1, \: 4, \: 2, \: 5, \:{12}, \right.
\
\
\displaystyle
\left.\: 1, \:{15}, \: 5, \: 1, \: 7, \: 1, \: 5, \: 1, \: 1, \: 1, \: 6, \: 5, \: 1, \:{41}, \: 1, \: 5, \: 1, \: 9, \:{1
3}, \: 1, \: 1, \: 5, \:{21}, \: \right.
\
\
\displaystyle
\left.{25}, \: 8, \: 5, \: 1, \:{14}, \: 1, \: 1, \: 1, \: 6, \: 3, \: 1, \:{100}, \: 1, \:{265}, \: 1, \: 1, \:{40}, \: 1, \: 3, \: 2, \: 8, \: 1, \: \right.
\
\
\displaystyle
\left.3, \: 1, \: 1, \:{19}, \: 2, \: 1, \: 1, \: 1, \: 1, \: 9, \: 1, \: 1, \: 6, \:{13}, \: 7, \: 1, \: 2, \: 4, \: 1, \: 1, \: 4, \:{11}, \: 1, \: 2, \: \right.
\
\
\displaystyle
\left.2, \: 1, \: 1, \: 1, \: 1, \: 2, \: 6, \:{13}, \: 2, \: 1, \: 1, \: 1, \: 1, \:{12}, \: 3, \:{14}, \: 1, \:{73}, \:{1
0}, \: 2, \:{17}, \:{10}, \: \right.
\
\
\displaystyle
\left.1, \: 9, \: 6, \: 1, \: 1, \:{32}, \: 1, \:{55}, \: 1, \: 3, \: 1, \: 1, \: 1, \: 1, \: 5, \: 1, \: 5, \: 1, \: 1, \: 3, \: 1, \: 1, \: 1, \: 1, \: 3, \right.
\
\
\displaystyle
\left.\: 2, \: 1, \: 1, \: 4, \: 9, \: 2, \: 1, \: 1, \: 1, \: 3, \: 1, \: 2, \: 1, \: 1, \: 1, \: 1, \: 1, \: 2, \: 4, \: 1, \: 3, \: 2, \:{10}, \: 1, \: 4, \: \right.
\
\
\displaystyle
\left.1, \: 1, \:{10}, \:{24}, \:{11}, \: 1, \:{36}, \: 3, \: 1, \: 1, \: 2, \: 1, \: 1, \: 4, \: 1, \: 6, \: 1, \: 1, \: 1, \: 1, \: 2, \: 1, \: 4, \: 1, \right.
\
\
\displaystyle
\left.\: 1, \:{11}, \:{33}, \: 2, \: 7, \: 1, \: 1, \:{10}, \: 1, \: 8, \: 4, \: 1, \: 1, \: 1, \: 5, \: 2, \: 2, \: 3, \: 2, \: 3, \: 2, \: 5, \: 4, \: 2, \: \right.
\
\
\displaystyle
\left.1, \: 3, \: 4, \: 5, \:{2076}, \: 2, \: 1, \: 4, \:{10}, \: 2, \: 1, \: 1, \: 1, \: 1, \:{246}, \: 1, \:{174}, \: 1, \:{14}, \: 2, \: 1, \: \right.
\
\
\displaystyle
\left.1, \: 3, \: 2, \: 1, \: 1, \: 5, \: 2, \: 1, \:{27}, \: 1, \: 1, \: 1, \: 1, \: 1, \:{35}, \: 1, \: 1, \:{27}, \: 1, \: 1, \: 1, \: 1, \:{51}, \: 7, \right.
\
\
\displaystyle
\left.\:{58}, \: 1, \: 2, \: 2, \: 2, \: 3, \: 9, \: 1, \: 1, \:{39}, \: 1, \: 2, \: 4, \: 1, \:{10}, \: 9, \: 1, \: 4, \:{1
1}, \: 1, \: 6, \: 1, \: 1, \: 2, \right.
\
\
\displaystyle
\left.\:{29}, \: 7, \: 2, \: 2, \: 1, \:{11}, \: 2, \: 2, \: 1, \: 5, \: 1, \: 8, \: 1, \: 1, \: 1, \: 1, \: 1, \: 2, \: 3, \: 1, \:{20}, \: 1, \: 4, \:{16}, \right.
\
\
\displaystyle
\left.\:{28}, \:{12}, \: 4, \: 1, \: 9, \: 3, \: 1, \: 1, \: 2, \: 2, \: 1, \: 2, \: 1, \:{73}, \: 3, \: 6, \: 1, \: 2, \: 4, \: 1, \:{12}, \: 5, \: 3, \: 1, \right.
\
\
\displaystyle
\left.\: 3, \: 2, \: 1, \: 4, \: 2, \: 6, \:{15}, \: 2, \: 4, \:{22}, \: 1, \: 1, \: 1, \: 1, \:{25}, \: 1, \:{10}, \: 2, \: 2, \: 7, \: 2, \: 1, \: 2, \: \right.
\
\
\displaystyle
\left.{22}, \: 2, \: 1, \: 5, \: 1, \: 2, \: 1, \:{30}, \: 2, \: 1, \: 1, \: 7, \:{10}, \: 1, \: 3, \:{16}, \:{38}, \: 1, \: 1, \: 3, \: 1, \: 1, \: 4, \: \right.
\
\
\displaystyle
\left.1, \: 2, \: 3, \: 4, \: 2, \:{198}, \:{18}, \: 2, \: 4, \: 2, \: 2, \: 1, \: 3, \: 7, \: 2, \:{23}, \: 1, \: 2, \: 2, \: 3, \: 6, \: 3, \: 1, \: 1, \right.
\
\
\displaystyle
\left.\: 6, \:{17}, \: 1, \: 8, \: 5, \:{48}, \: 1, \: 2, \: 1, \:{23}, \: 3, \: 3, \: 1, \: 1, \: 1, \: 3, \: 5, \: 2, \: 1, \: 1, \:{81}, \: 2, \:{12}, \: \right.
\
\
\displaystyle
\left.3, \: 8, \: 1, \: 2, \:{11}, \: 1, \: 1, \: 3, \: 1, \: 1, \:{18}, \: 2, \:{27}, \: 1, \: 6, \: 2, \:{13}, \: 4, \: 1, \: 1, \: 2, \: 2, \: 2, \: 5, \right.
\
\
\displaystyle
\left.\: 2, \: 1, \:{14}, \: 1, \: 1, \: 1, \: 1, \: 3, \: 1, \: 4, \: 5, \: 1, \: 2, \: 5, \: 1, \: 7, \: 1, \: 4, \:{94}, \: 1, \: 1, \: 2, \: 2, \:{10}, \: \right.
\
\
\displaystyle
\left.7, \: 2, \: 2, \:{19}, \: 3, \: 2, \: 1, \: 1, \: 2, \: 1, \: 1, \: 2, \: 8, \: 1, \: 1, \:{273}, \: 2, \:{18}, \: 6, \: 1, \: 1, \: 1, \: 1, \: 1, \right.
\
\
\displaystyle
\left.\: 3, \: 1, \:{13}, \: 1, \: 1, \: 1, \: 1, \: 1, \: 4, \: 1, \:{10}, \: 1, \: 5, \: 1, \:{14}, \: 6, \: 4, \: 1, \: 2, \: 1, \:{11}, \:{80}, \: 2, \: \right.
\
\
\displaystyle
\left.4, \: 2, \: 1, \: 1, \: 1, \: 1, \:{35}, \: 1, \:{16}, \: 2, \:{19}, \: 3, \: 2, \: 5, \:{41}, \: 7, \: 1, \: 1, \: 1, \: 1, \: 1, \: 2, \: 2, \: 3, \right.
\
\
\displaystyle
\left.\: 1, \:{12}, \:{10}, \: 4, \: 1, \: 1, \: 6, \:{17}, \:{2
6}, \: 1, \: 1, \: 1, \: 1, \: 1, \: 1, \:{52}, \: 2, \: 3, \: 5, \:{216}, \: 4, \: 3, \: \right.
\
\
\displaystyle
\left.3, \: 4, \: 1, \: 4, \: 6, \: 1, \: 7, \: 1, \: 1, \: 1, \: 1, \: 1, \: 4, \: 1, \: 1, \: 1, \: 2, \: 1, \: 1, \: 1, \: 3, \: 1, \: 5, \:{214}, \: \right.
\
\
\displaystyle
\left.{21}, \: 3, \: 3, \: 2, \: 5, \:{12}, \: 8, \: 4, \: 2, \: 1, \: 2, \:{52}, \: 2, \: 4, \: 1, \: 3, \: 8, \: 1, \: 4, \: 1, \: 1, \:{25}, \: 2, \: 5, \right.
\
\
\displaystyle
\left.\: 1, \:{20}, \: 4, \: 2, \:{10}, \: 1, \: 2, \: 1, \: 1, \: 3, \: 1, \: 1, \: 8, \: 4, \: 1, \: 3, \: 8, \: 1, \:{2
0}, \: 3, \: 1, \: 4, \: 2, \: 2, \: \right.
\
\
\displaystyle
\left.1, \: 4, \: 1, \: 7, \:{10}, \: 2, \: 4, \: 2, \: 1, \: 2, \: 1, \: 3, \: 1, \: 1, \:{11}, \: 2, \: 2, \:{11}, \: 4, \: 1, \: 9, \: 1, \: 1, \: 2, \: \right.
\
\
\displaystyle
\left.3, \: 5, \:{11}, \: 1, \: 5, \: 1, \: 3, \: 2, \: 2, \: 3, \:{157}, \: 1, \: 2, \: 2, \: 1, \: 8, \: 6, \: 1, \:{40}, \: 9, \: 2, \:{13}, \: 1, \: \right.
\
\
\displaystyle
\left.1, \: 1, \: 2, \: 3, \: 3, \: 1, \:{177}\right] 
(1)
Type: List(Integer)