forked from tsai/mathnet-numerics
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
3.5 KiB
61 lines
3.5 KiB
using MathNet.Numerics.UnitTests;
|
|
using NUnit.Framework;
|
|
using Complex = System.Numerics.Complex;
|
|
|
|
namespace MathNet.Numerics.UnitTests.SpecialFunctionsTests
|
|
{
|
|
/// <summary>
|
|
/// Hankel functions tests.
|
|
/// </summary>
|
|
[TestFixture, Category("Functions")]
|
|
public class HankelTests
|
|
{
|
|
[TestCase(0, 1.0, 0.0, 0.76519768655796655145, 0.088256964215676957983, 14)]
|
|
[TestCase(0, -1.0, 0.0, -0.76519768655796655145, 0.088256964215676957983, 14)]
|
|
[TestCase(0, 0.0, 1.0, 0.0, -0.26803248203398854876, 14)]
|
|
[TestCase(0, 0.0, -1.0, 2.5321317555040166712, -0.26803248203398854876, 14)]
|
|
[TestCase(0, 1.0, 1.0, 0.22744989480229475542, -0.051055458673089618135, 14)]
|
|
[TestCase(0, -1.0, -1.0, 2.1026668484143533086, -1.0441153538913338825, 14)]
|
|
[TestCase(0, 10.0, 5.0, -0.0014390626993822736024, 0.00069798313383186497809, 13)]
|
|
[TestCase(0, -10.0, -5.0, -35.580621321600125310, 0.40212121657624156694, 13)]
|
|
[TestCase(0.001, 1.0, 1.0, 0.22736947730907729941, -0.051412645636651723164, 14)]
|
|
[TestCase(1, 10.0, 5.0, 0.00065590035117675806376, 0.0014959445758611476093, 13)]
|
|
[TestCase(-1, 10.0, 5.0, -0.00065590035117675806376, -0.0014959445758611476093, 13)]
|
|
[TestCase(1, 100.0, 100.0, -2.4773994749804332257E-45, 3.4002907029806139579E-46, 14)]
|
|
[TestCase(2, 4.0, 0.0, 0.36412814585207280421, 0.21590359460361499453, 14)]
|
|
[TestCase(2, 32.0, -64.0, -5.3677688223644563726E26, -2.0457056534982487923E26, 14)]
|
|
[TestCase(100, 1.0, 1.0, -1.6892209981554826575E168, 3.3446291442187872047E170, 11)]
|
|
public void HankelH1Approx(double v, double zr, double zi, double cyr, double cyi, int decimalPlaces)
|
|
{
|
|
AssertHelpers.AlmostEqualRelative(
|
|
new Complex(cyr, cyi),
|
|
SpecialFunctions.HankelH1(v, new Complex(zr, zi)),
|
|
decimalPlaces
|
|
);
|
|
}
|
|
|
|
[TestCase(0, 1.0, 0.0, 0.76519768655796655145, -0.088256964215676957983, 14)]
|
|
[TestCase(0, -1.0, 0.0, 2.2955930596738996543, -0.088256964215676957983, 14)]
|
|
[TestCase(0, 0.0, 1.0, 2.5321317555040166712, 0.26803248203398854876, 14)]
|
|
[TestCase(0, 0.0, -1.0, 0.0, 0.26803248203398854876, 14)]
|
|
[TestCase(0, 1.0, 1.0, 1.6477670588097637978, -0.94200443654515464620, 14)]
|
|
[TestCase(0, -1.0, -1.0, -0.22744989480229475542, 0.051055458673089618135, 14)]
|
|
[TestCase(0, 10.0, 5.0, -35.577743196201360763, 0.40072525030857783699, 13)]
|
|
[TestCase(0, -10.0, -5.0, 0.0014390626993822736024, -0.00069798313383186497809, 13)]
|
|
[TestCase(0.001, 1.0, 1.0, 1.6492441345285023430, -0.93941539521920296528, 14)]
|
|
[TestCase(1, 10.0, 5.0, -1.8435187716318316449, -34.874375165530875652, 13)]
|
|
[TestCase(-1, 10.0, 5.0, 1.8435187716318316449, 34.874375165530875652, 13)]
|
|
[TestCase(1, 100.0, 100.0, -1.4341664112841885712E42, 1.0880361861214243394E42, 14)]
|
|
[TestCase(2, 4.0, 0.0, 0.36412814585207280421, -0.21590359460361499453, 14)]
|
|
[TestCase(2, 32.0, -64.0, -1.1400282228790383437E-29, -1.0479217248690493285E-29, 14)]
|
|
[TestCase(100, 1.0, 1.0, 1.6892209981554826575E168, -3.3446291442187872047E170, 10)]
|
|
public void HankelH2Approx(double v, double zr, double zi, double cyr, double cyi, int decimalPlaces)
|
|
{
|
|
AssertHelpers.AlmostEqualRelative(
|
|
new Complex(cyr, cyi),
|
|
SpecialFunctions.HankelH2(v, new Complex(zr, zi)),
|
|
decimalPlaces
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|