Menu Close

Go – How to get the order-zero Bessel function of the first kind in go

Here, We will learn how to get the order-zero Bessel function of the first kind in go. We can get it by using J0() function in math package in go golang.

Function prototype:

func J0(num float64) float64

Return value:

J0() function in math package returns
the order-zero Bessel function of the
first kind

Example with code:

package main

import (
  "fmt"
  "math"
)

func main() {

  no := math.J0(2.51)
  fmt.Printf("%.1f\n", no)

  no = math.J0(2.39)
  fmt.Printf("%.1f\n", no)

  no = math.J0(3.12)
  fmt.Printf("%.1f\n", no)

  no = math.J0(-3.21)
  fmt.Printf("%.1f\n", no)
}

Output:

-0.1
0.0
-0.3
-0.3

To learn more about golang, Please refer given below link:

https://www.techieindoor.com/go-lang-tutorial/

References:

https://golang.org/doc/
https://golang.org/pkg/
Posted in golang, math

Leave a Reply

Your email address will not be published. Required fields are marked *