Created
June 14, 2017 20:35
-
-
Save unixpickle/5d9922b2012b21cebd94fa740a3a7103 to your computer and use it in GitHub Desktop.
Normalizing coefficient for tanh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math" | |
"github.com/unixpickle/num-analysis/integration" | |
) | |
func main() { | |
v := integration.Integrate(func(x float64) float64 { | |
return math.Exp(-x*x/2) / math.Sqrt(2*math.Pi) * math.Pow(math.Tanh(x), 2) | |
}, integration.Interval{Start: -20, End: 20}) | |
fmt.Println(1 / math.Sqrt(v)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment