|
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)
Type: List(Integer)