Menu Close

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

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

Function prototype:

func J1(num float64) float64

Return value:

J1() function in math package returns
the order-one Bessel function of the
first kind

Example with code:

package main

import (
  "fmt"
  "math"
)

func main() {

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

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

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

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

Output:

0.5
0.5
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.

Contact Us