Last active
August 29, 2015 14:02
-
-
Save r9y9/edd779e58130b75d7ab5 to your computer and use it in GitHub Desktop.
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" | |
) | |
func HermitePolynomialsProb(x float64, n int) float64 { | |
norm := float64(factorial(n)) | |
y := 0.0 | |
bound := math.Floor(float64(n) / 2.0) | |
for m := 0; m <= int(bound); m++ { | |
y += math.Pow(-1, float64(m)) * math.Pow(x, float64(n-2*m)) / | |
(float64(factorial(m)) * float64(factorial(n-2*m)) * | |
math.Pow(2, float64(m))) | |
} | |
return y * norm | |
} | |
func factorial(x int) int { | |
if x == 0 { | |
return 1 | |
} | |
return x * factorial(x-1) | |
} | |
func main() { | |
fmt.Println("Hello Hermite Polynomials.") | |
for i := 0; i < 10; i++ { | |
fmt.Println(HermitePolynomialsProb(0, i)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
scipy.special.hermitenorm 的なの