Jn()
function is used to find the order-n Bessel function of the first kind in Go language. The standard math package of Go programming language has Jn()
function.
Syntax of Jn()
Function in Go Language
The syntax of Jn()
function in Go Language is:
1 | func Jn(n int, x float64) float64 |
Note: float64
is a data type in Go language which has IEEE-754 64-bit floating-point numbers. And int
is a signed integer type that is at least 32 bits in size. It is a distinct type, however, and not an alias for, say, int32.
Special cases are:
Jn(n, ±Inf) = 0
Jn(n, NaN) = NaN
Parameters of Jn()
Function in Go Language
x
– Where x
is any Valid int
Input value. This parameter is required.y
– Where y
is any Valid float64
Input value. This parameter is also required.
Error Handling
If the
If there is no argument (
x
or y
parameter are not numbers (numeric values) Jn()
function returns an error
.If there is no argument (
x
or y
– input values) passes to the function, then the compiler will produce an error
.
Return Value of Jn()
Function in Go Language
Jn()
function will return the order-n Bessel function of the first kind..
GoLang Jn()
Function Example 1
1 2 3 4 5 6 7 8 9 10 | package main import "fmt" import "math" func main() { var x float64 x = math.Jn(-11, 2) fmt.Println(x) } |
Output:
-2.3042847583672514e-08
GoLang Jn()
Function Example 2
1 2 3 4 5 6 7 8 9 10 | package main import "fmt" import "math" func main() { var x float64 x = math.Jn(2, 13) fmt.Println(x) } |
Output:
-0.21774426424195684
GoLang Jn()
Function Example 3
1 2 3 4 5 6 7 8 9 10 | package main import "fmt" import "math" func main() { var x float64 x = math.Jn(-15, -6.21) fmt.Println(x) } |
Output:
9.95121283853212e-06