Data update
This commit is contained in:
parent
29a5eea0d4
commit
5c1bb7bfa9
2011 changed files with 35081 additions and 3229 deletions
|
|
@ -3,17 +3,17 @@ writeln (7131.5 ^ 10) ^/ 10
|
|||
writeln 64 ^/ 6
|
||||
writeln()
|
||||
|
||||
val .nthroot = fn(.n, .A, .p) {
|
||||
var .x = [.A, .A / .n]
|
||||
while abs(.x[2]-.x[1]) > .p {
|
||||
.x = [.x[2], ((.n-1) x .x[2] + .A / (.x[2] ^ (.n-1))) / .n]
|
||||
val nthroot = fn(n, A, p) {
|
||||
var x = [A, A / n]
|
||||
while abs(x[2]-x[1]) > p {
|
||||
x = [x[2], ((n-1) * x[2] + A / (x[2] ^ (n-1))) / n]
|
||||
}
|
||||
simplify .x[2]
|
||||
simplify x[2]
|
||||
}
|
||||
|
||||
# To make the example from the D language work, we set a low maximum for the number of digits after a decimal point in division.
|
||||
mode divMaxScale = 7
|
||||
|
||||
writeln "function"
|
||||
writeln .nthroot(10, 7131.5 ^ 10, 0.001)
|
||||
writeln .nthroot(6, 64, 0.001)
|
||||
writeln nthroot(10, 7131.5 ^ 10, 0.001)
|
||||
writeln nthroot(6, 64, 0.001)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue