Skip to content

Instantly share code, notes, and snippets.

@suzuken
Created March 8, 2014 07:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suzuken/9426581 to your computer and use it in GitHub Desktop.
Save suzuken/9426581 to your computer and use it in GitHub Desktop.
package main
import "fmt"
func Cbrt(x complex128) complex128 {
var z complex128 = 1
for i:=0; i < 10000000; i++ {
z = z - ((z * z * z - x) / 3 * z * z)
}
return z
}
func main() {
fmt.Println(Cbrt(2))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment