tangxu
2022-10-24 d9f0427d4e079d866d1b17dfc204fee9aaa69b1b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
using Complex = System.Numerics.Complex;
 
namespace IStation.Numerics
{
    /// <summary>
    /// This partial implementation of the SpecialFunctions class contains all methods related to the Bessel functions.
    /// </summary>
    public static partial class SpecialFunctions
    {
        /// <summary>
        /// Returns the Bessel function of the first kind.
        /// <para>BesselJ(n, z) is a solution to the Bessel differential equation.</para>
        /// </summary>
        /// <param name="n">The order of the Bessel function.</param>
        /// <param name="z">The value to compute the Bessel function of.</param>
        /// <returns>The Bessel function of the first kind.</returns>
        public static Complex BesselJ(double n, Complex z)
        {
            return Amos.Cbesj(n, z);
        }
 
        /// <summary>
        /// Returns the exponentially scaled Bessel function of the first kind.
        /// <para>ScaledBesselJ(n, z) is given by Exp(-Abs(z.Imaginary)) * BesselJ(n, z).</para>
        /// </summary>
        /// <param name="n">The order of the Bessel function.</param>
        /// <param name="z">The value to compute the Bessel function of.</param>
        /// <returns>The exponentially scaled Bessel function of the first kind.</returns>
        public static Complex BesselJScaled(double n, Complex z)
        {
            return Amos.ScaledCbesj(n, z);
        }
 
        /// <summary>
        /// Returns the Bessel function of the first kind.
        /// <para>BesselJ(n, z) is a solution to the Bessel differential equation.</para>
        /// </summary>
        /// <param name="n">The order of the Bessel function.</param>
        /// <param name="z">The value to compute the Bessel function of.</param>
        /// <returns>The Bessel function of the first kind.</returns>
        public static double BesselJ(double n, double z)
        {
            return Amos.Cbesj(n, z);
        }
 
        /// <summary>
        /// Returns the exponentially scaled Bessel function of the first kind.
        /// <para>ScaledBesselJ(n, z) is given by Exp(-Abs(z.Imaginary)) * BesselJ(n, z).</para>
        /// </summary>
        /// <param name="n">The order of the Bessel function.</param>
        /// <param name="z">The value to compute the Bessel function of.</param>
        /// <returns>The exponentially scaled Bessel function of the first kind.</returns>
        public static double BesselJScaled(double n, double z)
        {
            return Amos.ScaledCbesj(n, z);
        }
 
        /// <summary>
        /// Returns the Bessel function of the second kind.
        /// <para>BesselY(n, z) is a solution to the Bessel differential equation.</para>
        /// </summary>
        /// <param name="n">The order of the Bessel function.</param>
        /// <param name="z">The value to compute the Bessel function of.</param>
        /// <returns>The Bessel function of the second kind.</returns>
        public static Complex BesselY(double n, Complex z)
        {
            return Amos.Cbesy(n, z);
        }
 
        /// <summary>
        /// Returns the exponentially scaled Bessel function of the second kind.
        /// <para>ScaledBesselY(n, z) is given by Exp(-Abs(z.Imaginary)) * Y(n, z).</para>
        /// </summary>
        /// <param name="n">The order of the Bessel function.</param>
        /// <param name="z">The value to compute the Bessel function of.</param>
        /// <returns>The exponentially scaled Bessel function of the second kind.</returns>
        public static Complex BesselYScaled(double n, Complex z)
        {
            return Amos.ScaledCbesy(n, z);
        }
 
        /// <summary>
        /// Returns the Bessel function of the second kind.
        /// <para>BesselY(n, z) is a solution to the Bessel differential equation.</para>
        /// </summary>
        /// <param name="n">The order of the Bessel function.</param>
        /// <param name="z">The value to compute the Bessel function of.</param>
        /// <returns>The Bessel function of the second kind.</returns>
        public static double BesselY(double n, double z)
        {
            return Amos.Cbesy(n, z);
        }
 
        /// <summary>
        /// Returns the exponentially scaled Bessel function of the second kind.
        /// <para>ScaledBesselY(n, z) is given by Exp(-Abs(z.Imaginary)) * BesselY(n, z).</para>
        /// </summary>
        /// <param name="n">The order of the Bessel function.</param>
        /// <param name="z">The value to compute the Bessel function of.</param>
        /// <returns>The exponentially scaled Bessel function of the second kind.</returns>
        public static double BesselYScaled(double n, double z)
        {
            return Amos.ScaledCbesy(n, z);
        }
 
        /// <summary>
        /// Returns the modified Bessel function of the first kind.
        /// <para>BesselI(n, z) is a solution to the modified Bessel differential equation.</para>
        /// </summary>
        /// <param name="n">The order of the modified Bessel function.</param>
        /// <param name="z">The value to compute the modified Bessel function of.</param>
        /// <returns>The modified Bessel function of the first kind.</returns>
        public static Complex BesselI(double n, Complex z)
        {
            return Amos.Cbesi(n, z);
        }
 
        /// <summary>
        /// Returns the exponentially scaled modified Bessel function of the first kind.
        /// <para>ScaledBesselI(n, z) is given by Exp(-Abs(z.Real)) * BesselI(n, z).</para>
        /// </summary>
        /// <param name="n">The order of the modified Bessel function.</param>
        /// <param name="z">The value to compute the modified Bessel function of.</param>
        /// <returns>The exponentially scaled modified Bessel function of the first kind.</returns>
        public static Complex BesselIScaled(double n, Complex z)
        {
            return Amos.ScaledCbesi(n, z);
        }
 
        /// <summary>
        /// Returns the modified Bessel function of the first kind.
        /// <para>BesselI(n, z) is a solution to the modified Bessel differential equation.</para>
        /// </summary>
        /// <param name="n">The order of the modified Bessel function.</param>
        /// <param name="z">The value to compute the modified Bessel function of.</param>
        /// <returns>The modified Bessel function of the first kind.</returns>
        public static double BesselI(double n, double z)
        {
            return BesselI(n, new Complex(z, 0)).Real;
        }
 
        /// <summary>
        /// Returns the exponentially scaled modified Bessel function of the first kind.
        /// <para>ScaledBesselI(n, z) is given by Exp(-Abs(z.Real)) * BesselI(n, z).</para>
        /// </summary>
        /// <param name="n">The order of the modified Bessel function.</param>
        /// <param name="z">The value to compute the modified Bessel function of.</param>
        /// <returns>The exponentially scaled modified Bessel function of the first kind.</returns>
        public static double BesselIScaled(double n, double z)
        {
            return Amos.ScaledCbesi(n, z);
        }
 
        /// <summary>
        /// Returns the modified Bessel function of the second kind.
        /// <para>BesselK(n, z) is a solution to the modified Bessel differential equation.</para>
        /// </summary>
        /// <param name="n">The order of the modified Bessel function.</param>
        /// <param name="z">The value to compute the modified Bessel function of.</param>
        /// <returns>The modified Bessel function of the second kind.</returns>
        public static Complex BesselK(double n, Complex z)
        {
            return Amos.Cbesk(n, z);
        }
 
        /// <summary>
        /// Returns the exponentially scaled modified Bessel function of the second kind.
        /// <para>ScaledBesselK(n, z) is given by Exp(z) * BesselK(n, z).</para>
        /// </summary>
        /// <param name="n">The order of the modified Bessel function.</param>
        /// <param name="z">The value to compute the modified Bessel function of.</param>
        /// <returns>The exponentially scaled modified Bessel function of the second kind.</returns>
        public static Complex BesselKScaled(double n, Complex z)
        {
            return Amos.ScaledCbesk(n, z);
        }
 
        /// <summary>
        /// Returns the modified Bessel function of the second kind.
        /// <para>BesselK(n, z) is a solution to the modified Bessel differential equation.</para>
        /// </summary>
        /// <param name="n">The order of the modified Bessel function.</param>
        /// <param name="z">The value to compute the modified Bessel function of.</param>
        /// <returns>The modified Bessel function of the second kind.</returns>
        public static double BesselK(double n, double z)
        {
            return Amos.Cbesk(n, z);
        }
 
        /// <summary>
        /// Returns the exponentially scaled modified Bessel function of the second kind.
        /// <para>ScaledBesselK(n, z) is given by Exp(z) * BesselK(n, z).</para>
        /// </summary>
        /// <param name="n">The order of the modified Bessel function.</param>
        /// <param name="z">The value to compute the modified Bessel function of.</param>
        /// <returns>The exponentially scaled modified Bessel function of the second kind.</returns>
        public static double BesselKScaled(double n, double z)
        {
            return Amos.ScaledCbesk(n, z);
        }
    }
}