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,25 @@
package main
import (
"fmt"
"math"
)
func main() {
oldPhi := 1.0
var phi float64
iters := 0
limit := 1e-5
for {
phi = 1.0 + 1.0/oldPhi
iters++
if math.Abs(phi-oldPhi) <= limit {
break
}
oldPhi = phi
}
fmt.Printf("Final value of phi : %16.14f\n", phi)
actualPhi := (1.0 + math.Sqrt(5.0)) / 2.0
fmt.Printf("Number of iterations : %d\n", iters)
fmt.Printf("Error (approx) : %16.14f\n", phi-actualPhi)
}