Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
12
Task/Nth-root/E/nth-root.e
Normal file
12
Task/Nth-root/E/nth-root.e
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
def nthroot(n, x) {
|
||||
require(n > 1 && x > 0)
|
||||
def np := n - 1
|
||||
def iter(g) { return (np*g + x/g**np) / n }
|
||||
var g1 := x
|
||||
var g2 := iter(g1)
|
||||
while (!(g1 <=> g2)) {
|
||||
g1 := iter(g1)
|
||||
g2 := iter(iter(g2))
|
||||
}
|
||||
return g1
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue