Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,3 @@
proc nthroot {n A} {
expr {pow($A, 1.0/$n)}
}

View file

@ -0,0 +1,11 @@
proc nthroot {n A} {
set x0 [expr {$A / double($n)}]
set m [expr {$n - 1.0}]
while 1 {
set x1 [expr {($m*$x0 + $A/$x0**$m) / $n}]
if {abs($x1 - $x0) < abs($x0 * 1e-9)} {
return $x1
}
set x0 $x1
}
}

View file

@ -0,0 +1,5 @@
puts [nthroot 2 2]
puts [nthroot 5 34]
puts [nthroot 5 [expr {34**5}]]
puts [nthroot 10 [expr 7131.5**10]]
puts [nthroot 0.5 7]; # Squaring!