docs-v2/content/flux/v0/stdlib/math/jn.md

3.3 KiB

title description menu weight
math.jn() function `math.jn()` returns the order-n Bessel function of the first kind.
flux_v0_ref
name parent identifier
math.jn math math/jn
101

math.jn() returns the order-n Bessel function of the first kind.

Function type signature
(n: int, x: float) => float

{{% caption %}} For more information, see Function type signatures. {{% /caption %}}

Parameters

n

({{< req >}}) Order number.

x

({{< req >}}) Value to operate on.

Examples

Return the order-n Bessel function of a value

import "math"

math.jn(n: 2, x: 1.23)// 0.16636938378681407


Use math.jn in map

import "sampledata"
import "math"

sampledata.float()
    |> map(fn: (r) => ({r with _value: math.jn(n: 4, x: r._value)}))

{{< expand-wrapper >}} {{% expand "View example input and output" %}}

Input data

_time *tag _value
2021-01-01T00:00:00Z t1 -2.18
2021-01-01T00:00:10Z t1 10.92
2021-01-01T00:00:20Z t1 7.35
2021-01-01T00:00:30Z t1 17.53
2021-01-01T00:00:40Z t1 15.23
2021-01-01T00:00:50Z t1 4.43
_time *tag _value
2021-01-01T00:00:00Z t2 19.85
2021-01-01T00:00:10Z t2 4.97
2021-01-01T00:00:20Z t2 -3.75
2021-01-01T00:00:30Z t2 19.77
2021-01-01T00:00:40Z t2 13.86
2021-01-01T00:00:50Z t2 1.86

Output data

_time _value *tag
2021-01-01T00:00:00Z 0.046148335742456664 t1
2021-01-01T00:00:10Z -0.03367382202216673 t1
2021-01-01T00:00:20Z 0.06455053599079605 t1
2021-01-01T00:00:30Z -0.016152633110842446 t1
2021-01-01T00:00:40Z -0.15300380439231542 t1
2021-01-01T00:00:50Z 0.3401384178914538 t1
_time _value *tag
2021-01-01T00:00:00Z 0.14801732445932958 t2
2021-01-01T00:00:10Z 0.3896093468299793 t2
2021-01-01T00:00:20Z 0.24301709268606153 t2
2021-01-01T00:00:30Z 0.15603599253486927 t2
2021-01-01T00:00:40Z 0.10341672446511223 t2
2021-01-01T00:00:50Z 0.026150267042506597 t2

{{% /expand %}} {{< /expand-wrapper >}}