ZOJ-3443-Bessel Function II

3443-Bessel Function II

Bessel function is one of the most important special functions in the field of physics. Many solutions of various physical phenomena have the form of this function. In mathematic notation, this function is deduced from the following differential equation:
这里写图片描述

There are two classes of solution of the above equation. One class of the solution (which is called the second kind of Bessel function) has the following image:


Because of its importance in the physics and it cannot be expressed by elementary functions, many formulas are deduced to numerically calculate it. The following integral is one of them.

Now you are asked to calculate Bessel function of the second kind using the above integral.

Input
The input consists multiple test cases. In each test case, there are two numbers in one line, indicating the v and z in the above integral. (0≤v≤20, 1≤z≤20.0)

Output
For each case, just format and print Yv(z) in “%.6le”. See sample for more details.

Sample Input
0 1.00
1 4.00
10 11.11
20 20.00

Sample Output
8.825696e-02
3.979257e-01
-1.797017e-01
-2.854895e-01

题目链接:ZOJ-3443

以下是代码:

#include <cmath>
#include <cstdio>

using namespace std;

int main()
{
    int n;
    double z;
    while(scanf("%d%lf",&n,&z) != EOF)
    {
        printf("%.6le\n",yn(n,z));
    }
    return 0;
}

你可能感兴趣的:(ZOJ-3443-Bessel Function II)