diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..412eeda
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,22 @@
+# Auto detect text files and perform LF normalization
+* text=auto
+
+# Custom for Visual Studio
+*.cs diff=csharp
+*.sln merge=union
+*.csproj merge=union
+*.vbproj merge=union
+*.fsproj merge=union
+*.dbproj merge=union
+
+# Standard to msysgit
+*.doc diff=astextplain
+*.DOC diff=astextplain
+*.docx diff=astextplain
+*.DOCX diff=astextplain
+*.dot diff=astextplain
+*.DOT diff=astextplain
+*.pdf diff=astextplain
+*.PDF diff=astextplain
+*.rtf diff=astextplain
+*.RTF diff=astextplain
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..05651d4
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,74 @@
+############
+## Windows
+############
+
+# Windows image file caches
+Thumbs.db
+*.o
+
+# Folder config file
+Desktop.ini
+
+#################
+## Visual Studio
+#################
+
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+# User-specific files
+**/Debug
+**/Release
+win32/packages/
+**/.vs
+*.tlog
+*.obj
+*.log
+*.filters
+*.lastbuildstate
+*.manifest
+*.cache
+*.users
+*.user
+*.res
+*.opendb
+*.db
+*.unsuccessfulbuild
+*.ipch
+*.pdb
+*.exp
+*.ilk
+*.idb
+*.opensdf
+*.sdf
+*.u2d
+*.suo
+*.tiff
+*.txt
+*.aps
+
+################
+# Linux and OSX
+###############
+\.DS*
+*.so
+*.d
+
+
+# Created by https://www.gitignore.io
+
+### Xcode ###
+build/
+*.pbxuser
+!default.pbxuser
+*.mode1v3
+!default.mode1v3
+*.mode2v3
+!default.mode2v3
+*.perspectivev3
+!default.perspectivev3
+xcuserdata
+*.xccheckout
+*.moved-aside
+DerivedData
+*.xcuserstate
+
diff --git a/LFMF_Examples.csv b/LFMF_Examples.csv
new file mode 100644
index 0000000..0d036f0
--- /dev/null
+++ b/LFMF_Examples.csv
@@ -0,0 +1,6 @@
+h_tx__meter,h_rx__meter,f__mhz,P_tx__watt,N_s,d__km,epsilon,sigma,pol,rtn,A_btl__db,E_dBuVm,P_rx__dbm,method
+0,0,0.01,1000,301,1000,15,0.005,0,0,184.5,-82.5,-114.9,1
+0,0,1,5000,301,5000,15,0.005,1,0,536.5,-387.5,-459.9,1
+5.5,1.5,10,500,315,15,15,0.005,0,0,151.3,7.6,-84.8,0
+1,1,0.45,1000,315,3000,15,0.005,1,0,264.3,-129.3,-194.8,1
+10,10,30,10000,315,5000,15,0.005,0,0,1574.9,-1393.3,-1495.3,1
diff --git a/LICENSE.md b/LICENSE.md
new file mode 100644
index 0000000..12746a1
--- /dev/null
+++ b/LICENSE.md
@@ -0,0 +1,14 @@
+SOFTWARE DISCLAIMER / RELEASE
+
+This software was developed by employees of the National Telecommunications and Information Administration (NTIA), an agency of the Federal Government and is provided to you as a public service. Pursuant to Title 15 United States Code Section 105, works of NTIA employees are not subject to copyright protection within the United States.
+
+The software is provided by NTIA “AS IS.” NTIA MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NTIA does not warrant or make any representations regarding the use of the software or the results thereof, including but not limited to the correctness, accuracy, reliability or usefulness of the software.
+
+To the extent that NTIA holds rights in countries other than the United States, you are hereby granted the non-exclusive irrevocable and unconditional right to print, publish, prepare derivative works and distribute the NTIA software, in any medium, or authorize others to do so on your behalf, on a royalty-free basis throughout the World.
+
+You may improve, modify, and create derivative works of the software or any portion of the software, and you may copy and distribute such modifications or works. Modified works should carry a notice stating that you changed the software and should note the date and nature of any such change.
+
+You are solely responsible for determining the appropriateness of using and distributing the software and you assume all risks associated with its use, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of operation. This software is not intended to be used in any situation where a failure could cause risk of injury or damage to property.
+
+Please provide appropriate acknowledgments of NTIA’s creation of the software in any copies or derivative works of this software.
+
diff --git a/README.md b/README.md
index 56c3c73..bcd516a 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,77 @@
-# LFMF
-Low Frequency / Medium Frequency (LF/MF) Propagation Model
+# Low Frequency / Medium Frequency (LF/MF) Propagation Model
+
+This code repository contains an the NTIA/ITS implementation of the Low Frequency / Medium Frequency (LF/MF) Propagation Model. LF/MF predicts basic transmission loss in the frequency range 0.01 - 30 MHz for propagation paths over a smooth Earth and antenna heights less than 50 meters.
+
+## Inputs ##
+
+| Variable | Type | Units | Limits | Description |
+|-------------------|--------|-------|--------------|--------------|
+| `h_tx__meter` | double | meter | 0 <= `h_tx__meter` <= 50 | Height of the transmitter |
+| `h_rx__meter` | double | meter | 0 <= `h_rx__meter` <= 50 | Height of the receiver |
+| `f__mhz` | double | MHz | 0.01 <= `f__mhz` <= 30 | Frequency |
+| `P_tx__watt` | double | Watt | 0 < `P_tx__watt` | Transmitter power |
+| `N_s` | double | N-Units | 250 <= `N_s` <= 400 | Surface refractivity |
+| `d__km` | double | km | 0 < `d__km` | Path distance |
+| `epsilon` | double | | 1 <= `epsilon` | Relative permittivity |
+| `sigma` | double | S/m | 0 < `sigma` | Conductivity |
+| `pol` | int | | | Polarization
0 = Horizontal
1 = Vertical
|
+
+## Outputs ##
+
+Outputs to LFMF are contained within a defined `Result` structure.
+
+| Variable | Type | Units | Description |
+|---------------|--------|-------|-------------|
+| `A_btl__db` | double | dB | Basic transmission loss |
+| `E_dBuVm` | double | dB(uV/m) | Electrice field strength |
+| `P_rx__dbm` | double | dBm | Received power |
+| `method` | int | | Solution method
0 = Flat earth with curve correction
1 = Residue series
|
+
+## Return Codes ##
+
+Possible return codes, including the corresponding defined constant name as defined in `LFMF.h`:
+
+| Value | Const Name | Description |
+| ------|----------------------------------|--------------|
+| 0 | `SUCCESS` | Successful execution |
+| 1000 | `ERROR__TX_TERMINAL_HEIGHT` | TX terminal height is out of range |
+| 1001 | `ERROR__RX_TERMINAL_HEIGHT` | RX terminal height is out of range |
+| 1002 | `ERROR__FREQUENCY` | Frequency is out of range |
+| 1003 | `ERROR__TX_POWER` | Transmit power is out of range |
+| 1004 | `ERROR__SURFACE_REFRACTIVITY` | Surface refractivity is out of range |
+| 1005 | `ERROR__PATH_DISTANCE` | Path distance is out of range |
+| 1006 | `ERROR__EPSILON` | Epsilon is out of range |
+| 1007 | `ERROR__SIGMA` | Sigma is out of range |
+| 1008 | `ERROR__POLARIZATION` | Invalid value for polarization |
+
+## Example Values ##
+
+A set of example inputs and outputs are provided for testing purposes. This is not a comprehensive validation test set. The test set can be found in [LFMF_Examples.csv](LFMF_Examples.csv).
+
+## Notes on Code Style ##
+
+* In general, variables follow the naming convention in which a single underscore denotes a subscript (pseudo-LaTeX format), where a double underscore is followed by the units, i.e. h_tx__meter.
+* Variables are named to match their corresponding mathematical variables from their publication text.
+* Wherever possible, equation numbers are provided.
+
+## Configure and Build ##
+
+### C++ Software
+
+The software is designed to be built into a DLL (or corresponding library for non-Windows systems). The source code can be built for any OS that supports the standard C++ libraries. A Visual Studio 2019 project file is provided for Windows users to support the build process and configuration.
+
+### C#/.NET Wrapper Software
+
+The .NET support of LFMF consists of a simple pass-through wrapper around the native DLL. It is compiled to target .NET Framework 4.7.2. Distribution and updates are provided through the published NuGet package.
+
+## References ##
+
+* Bremmer, H. "Terrestrial Radio Waves" _Elsevier_, 1949.
+* DeMinco, N. "Medium Frequency Propagation Prediction Techniques and Antenna Modeling for Intelligent Transportation Systems (ITS) Broadcast Applications", [_NTIA Report 99-368_](https://www.its.bldrdoc.gov/publications/2399.aspx), August 1999
+* DeMinco, N. "Ground-wave Analysis Model For MF Broadcast System", [_NTIA Report 86-203_](https://www.its.bldrdoc.gov/publications/2226.aspx), September 1986
+* Sommerfeld, A. "The propagation of waves in wireless telegraphy", _Ann. Phys._, 1909, 28, p.665
+* Wait, J. "Radiation From a Vertical Antenna Over a Curved Stratified Ground", _Journal of Research of the National Bureau of Standards_. Vol 56, No. 4, April 1956. Research Paper 2671
+
+## Contact ##
+
+For questions, contact Nick DeMinco, (303) 497-3453, NDeminco@ntia.gov
\ No newline at end of file
diff --git a/dotnet/ITS.Propagation.LFMF/ITS.Propagation.LFMF.csproj b/dotnet/ITS.Propagation.LFMF/ITS.Propagation.LFMF.csproj
new file mode 100644
index 0000000..d12cec5
--- /dev/null
+++ b/dotnet/ITS.Propagation.LFMF/ITS.Propagation.LFMF.csproj
@@ -0,0 +1,51 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {1C761232-C4C0-4403-AA3A-7160DCDF48C8}
+ Library
+ Properties
+ ITS.Propagation
+ ITS.Propagation.LFMF
+ v4.7.2
+ 512
+ true
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ bin\Debug\ITS.Propagation.LFMF.xml
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ bin\Release\ITS.Propagation.LFMF.xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dotnet/ITS.Propagation.LFMF/ITS.Propagation.LFMF.sln b/dotnet/ITS.Propagation.LFMF/ITS.Propagation.LFMF.sln
new file mode 100644
index 0000000..46e729b
--- /dev/null
+++ b/dotnet/ITS.Propagation.LFMF/ITS.Propagation.LFMF.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.30320.27
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ITS.Propagation.LFMF", "ITS.Propagation.LFMF.csproj", "{1C761232-C4C0-4403-AA3A-7160DCDF48C8}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {1C761232-C4C0-4403-AA3A-7160DCDF48C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1C761232-C4C0-4403-AA3A-7160DCDF48C8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1C761232-C4C0-4403-AA3A-7160DCDF48C8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1C761232-C4C0-4403-AA3A-7160DCDF48C8}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {ECF2AF6A-510E-4A3F-BAA6-51FDC7F311C6}
+ EndGlobalSection
+EndGlobal
diff --git a/dotnet/ITS.Propagation.LFMF/LFMF.cs b/dotnet/ITS.Propagation.LFMF/LFMF.cs
new file mode 100644
index 0000000..e72c476
--- /dev/null
+++ b/dotnet/ITS.Propagation.LFMF/LFMF.cs
@@ -0,0 +1,82 @@
+using System;
+using System.Runtime.InteropServices;
+
+namespace ITS.Propagation
+{
+ ///
+ /// The Low Frequency / Medium Frequency (LF/MF) Propagation Model
+ ///
+ public static partial class LFMF
+ {
+ #region 32-Bit P/Invoke Definitions
+
+ [DllImport("LFMF_x86.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, EntryPoint = "LFMF")]
+ private static extern int LFMF_x86(double h_tx__meter, double h_rx__meter, double f__mhz, double P_tx__watt,
+ double N_s, double d__km, double epsilon, double sigma, int pol, out Result result);
+
+ #endregion
+
+ #region 64-Bit P/Invoke Definitions
+
+ [DllImport("LFMF_x64.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, EntryPoint = "LFMF")]
+ private static extern int LFMF_x64(double h_tx__meter, double h_rx__meter, double f__mhz, double P_tx__watt,
+ double N_s, double d__km, double epsilon, double sigma, int pol, out Result result);
+
+ #endregion
+
+ private delegate int LFMF_Delegate(double h_tx__meter, double h_rx__meter, double f__mhz, double P_tx__watt,
+ double N_s, double d__km, double epsilon, double sigma, int pol, out Result result);
+
+ private static LFMF_Delegate LFMF_Invoke;
+
+ static LFMF()
+ {
+ if (Environment.Is64BitProcess)
+ LFMF_Invoke = LFMF_x64;
+ else
+ LFMF_Invoke = LFMF_x86;
+ }
+
+ ///
+ /// Compute the LFMF propagation prediction
+ ///
+ /// Transmitter height, in meters
+ /// Receiver height, in meters
+ /// Frequency, in MHz
+ /// Transmit power, in Watts
+ /// Surface refractivity, in N-Units
+ /// Path distance, in km
+ /// Relative permittivity
+ /// Conductivity
+ /// Polarization
+ /// Prediction result
+ /// Error code
+ public static int Invoke(double h_tx__meter, double h_rx__meter, double f__mhz, double P_tx__watt,
+ double N_s, double d__km, double epsilon, double sigma, Polarization pol, out Result result)
+ {
+ return LFMF_Invoke(h_tx__meter, h_rx__meter, f__mhz, P_tx__watt, N_s,
+ d__km, epsilon, sigma, (int)pol, out result);
+ }
+
+ ///
+ /// Compute the LFMF propagation prediction
+ ///
+ /// Transmitter height, in meters
+ /// Receiver height, in meters
+ /// Frequency, in MHz
+ /// Transmit power, in Watts
+ /// Surface refractivity, in N-Units
+ /// Path distance, in km
+ /// Relative permittivity
+ /// Conductivity
+ /// Polarization
+ /// Prediction result
+ /// Error code
+ public static int Invoke(double h_tx__meter, double h_rx__meter, double f__mhz, double P_tx__watt,
+ double N_s, double d__km, double epsilon, double sigma, int pol, out Result result)
+ {
+ return LFMF_Invoke(h_tx__meter, h_rx__meter, f__mhz, P_tx__watt, N_s,
+ d__km, epsilon, sigma, pol, out result);
+ }
+ }
+}
diff --git a/dotnet/ITS.Propagation.LFMF/Properties/AssemblyInfo.cs b/dotnet/ITS.Propagation.LFMF/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..57259c0
--- /dev/null
+++ b/dotnet/ITS.Propagation.LFMF/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("ITS.Propagation.LFMF")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("ITS.Propagation.LFMF")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("1c761232-c4c0-4403-aa3a-7160dcdf48c8")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/dotnet/ITS.Propagation.LFMF/Result.cs b/dotnet/ITS.Propagation.LFMF/Result.cs
new file mode 100644
index 0000000..c083281
--- /dev/null
+++ b/dotnet/ITS.Propagation.LFMF/Result.cs
@@ -0,0 +1,67 @@
+using System;
+using System.Runtime.InteropServices;
+
+namespace ITS.Propagation
+{
+ public static partial class LFMF
+ {
+ ///
+ /// Polarization
+ ///
+ public enum Polarization : int
+ {
+ ///
+ /// Horizontal polarization
+ ///
+ Horizontal = 0,
+
+ ///
+ /// Vertical polarization
+ ///
+ Vertical = 1
+ }
+
+ ///
+ /// Solution method used
+ ///
+ public enum Method : int
+ {
+ ///
+ /// Flat earth with curve correction
+ ///
+ FlatEarthCurveCorrection = 0,
+
+ ///
+ /// Residue series
+ ///
+ ResidueSeries = 1
+ }
+
+ ///
+ /// LF/MF prediction results
+ ///
+ [StructLayout(LayoutKind.Sequential)]
+ public struct Result
+ {
+ ///
+ /// Basic transmission loss, in dB
+ ///
+ public double A_btl__db;
+
+ ///
+ /// Electic field strength, in db(uV/m)
+ ///
+ public double E_dBuVm;
+
+ ///
+ /// Received power, in dBm
+ ///
+ public double P_rx__dbm;
+
+ ///
+ /// Solution method used
+ ///
+ public Method Method;
+ }
+ }
+}
diff --git a/dotnet/nuget/LFMF.nuspec b/dotnet/nuget/LFMF.nuspec
new file mode 100644
index 0000000..99f0d27
--- /dev/null
+++ b/dotnet/nuget/LFMF.nuspec
@@ -0,0 +1,30 @@
+
+
+
+ LFMF
+ 1.0.0
+ The Institute for Telecommunication Sciences
+ The Institute for Telecommunication Sciences
+ LICENSE.md
+ https://github.com/NTIA/LFMF
+ images\itslogo.png
+ true
+ Low Frequency / Medium Frequency (LF/MF) Propagation Model
+ None
+ Propagation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dotnet/nuget/build/net472/LFMF.targets b/dotnet/nuget/build/net472/LFMF.targets
new file mode 100644
index 0000000..d4c1b1d
--- /dev/null
+++ b/dotnet/nuget/build/net472/LFMF.targets
@@ -0,0 +1,16 @@
+
+
+
+
+ PreserveNewest
+ LFMF_x86.dll
+
+
+
+
+
+ PreserveNewest
+ LFMF_x64.dll
+
+
+
\ No newline at end of file
diff --git a/dotnet/nuget/images/itslogo.png b/dotnet/nuget/images/itslogo.png
new file mode 100644
index 0000000..3d2f319
Binary files /dev/null and b/dotnet/nuget/images/itslogo.png differ
diff --git a/include/LFMF.h b/include/LFMF.h
new file mode 100644
index 0000000..f86066a
--- /dev/null
+++ b/include/LFMF.h
@@ -0,0 +1,89 @@
+
+#include
+
+// Export the DLL functions as "C" and not C++
+#define DLLEXPORT extern "C" __declspec(dllexport)
+#define MAX(x, y) (((x) > (y)) ? (x) : (y))
+#define MIN(x, y) (((x) < (y)) ? (x) : (y))
+#define DIM(x, y) (((x) > (y)) ? (x - y) : (0))
+
+using std::complex;
+
+#define PI 3.1415926535897932384
+#define epsilon_0 8.854187817e-12 // Vacuum permittivity (F/m)
+#define a_0__km 6370 // Earth radius, in km
+#define C 299792458.0 // Speed of light (m/s)
+#define SQRTPI sqrt(PI)
+#define THIRD 1.0 / 3.0
+#define FALSE 0
+#define TRUE 1
+#define D2R PI/180.0
+#define R2D 180.0/PI
+#define ETA 119.9169832*PI // Intrinsic impedance of free space (ohms)
+
+#define POLARIZATION__HORIZONTAL 0
+#define POLARIZATION__VERTICAL 1
+
+#define METHOD__FLAT_EARTH_CURVE 0
+#define METHOD__RESIUDE_SERIES 1
+
+#define WERF_TERMS 30 // Number of terms for the complex error function
+
+#define YES 1 // Find the derivative i.e., Ai'() or Bi'()
+#define NO 0 // Find Ai() or Bi()
+// kind
+#define AIRY 1 // Find the Airy Function
+#define AIRYD 2 // Find the Airy function Derivative
+#define BAIRY 3 // Find the Bairy Function
+#define BAIRYD 4 // Find the Bairy function Derivative
+#define WTWO 5 // find Hufford Wi(2) or Wait W2
+#define DWTWO 6 // find Hufford Wi'(2) or Wait W2'
+#define WONE 7 // find Hufford Wi(1) or Wait W1
+#define DWONE 8 // find Hufford Wi'(1) or Wait W1'
+// scaling
+#define HUFFORD 9 // Use Hufford scaling
+#define WAIT 10 // Use Wait scaling
+#define NONE 11 // No Scaling
+
+// Return codes
+#define SUCCESS 0
+
+// Error codes
+#define ERROR__TX_TERMINAL_HEIGHT 1000 // TX terminal height is out of range
+#define ERROR__RX_TERMINAL_HEIGHT 1001 // RX terminal height is out of range
+#define ERROR__FREQUENCY 1002 // Frequency is out of range
+#define ERROR__TX_POWER 1003 // Transmit power is out of range
+#define ERROR__SURFACE_REFRACTIVITY 1004 // Surface refractivity is out of range
+#define ERROR__PATH_DISTANCE 1005 // Path distance is out of range
+#define ERROR__EPSILON 1006 // Epsilon is out of range
+#define ERROR__SIGMA 1007 // Sigma is out of range
+#define ERROR__POLARIZATION 1008 // Invalid value for polarization
+
+//////////////////////////////////////
+// Data Structures
+
+struct Result
+{
+ double A_btl__db;
+ double E_dBuVm;
+ double P_rx__dbm;
+
+ int method;
+};
+
+//////////////////////////////////////
+// Main LFMF Function
+
+DLLEXPORT int LFMF(double h_tx__meter, double h_rx__meter, double f__mhz, double P_tx__watt,
+ double N_s, double d__km, double epsilon, double sigma, int pol, Result *result);
+
+//////////////////////////////////////
+// Helper Functions
+
+double FlatEarthCurveCorrection(complex delta, complex q, double h_1__km, double h_2__km, double d, double k);
+double ResidueSeries(double d, double k, double h_1__km, double h_2__km, double nu, double theta, complex q);
+complex werf(complex qi);
+complex Airy(complex Z, int kind, int scaling);
+complex WiRoot(int i, complex *DWi, complex q, complex *Wi, int kind, int scaling);
+int ValidateInput(double h_tx__meter, double h_rx__meter, double f__mhz, double P_tx__watt,
+ double N_s, double d__km, double epsilon, double sigma, int pol);
diff --git a/src/Airy.cpp b/src/Airy.cpp
new file mode 100644
index 0000000..37355a1
--- /dev/null
+++ b/src/Airy.cpp
@@ -0,0 +1,818 @@
+#include "..\include\LFMF.h"
+
+/*=============================================================================
+ |
+ | Description: This routine finds the Airy, Bariy, Wi(1) and Wi(2)
+ | functions and their derivatives for a complex input argument
+ | from a shifted Taylor series or by asymptotic approximation
+ | depending of the location of the input argument.
+ |
+ | This routine determines the so-called "Airy Functions of the
+ | third kind" Wi(1) and Wi(2) that are found in equation 38
+ | of NTIA Report 87-219 "A General Theory of Radio
+ | Propagation through a Stratified Atmosphere", George
+ | Hufford, July 1987
+ |
+ | The Airy function that appeared in the original GWINT and
+ | GWRES had the switches all mangled from what George Hufford
+ | had in mind this routine has the corrected switches. Please
+ | see the Airy function code that appears in the appendix of
+ | OT/ITS RR 11 "A Wave Hop Propagation Program for an
+ | Anisotropic Ionosphere" L. A. Berry and J. E. Herman
+ | April 1971
+ |
+ | Input: Z - Input argument
+ | kind - Switch that indicates what type of Airy
+ | function to solve for
+ | scaling -
+ |
+ | Outputs: [None]
+ |
+ | Returns: Ai - The desired Airy function calculated at Z
+ |
+ | Note: A note on scaling the output from this program
+ |
+ | There is a definitional problem with the Airy function
+ | which is inevitable relative to how it was defined in the
+ | original LFMF code originated with the Hufford's AIRY
+ | subroutine.
+ |
+ | Using the scaling equal to HUFFORD in this program follows
+ | the definitions of Wi(1) and Wi(2) as defined by Hufford
+ | (87-219)
+ |
+ | Using the scaling equal to WAIT in this program uses the
+ | definitions of W1 and W2 defined in Deminco (99-368) and
+ | in the original LFMF code following Berry via Wait.
+ |
+ | The two solutions differ by a constant. As Hufford notes
+ | concerning Wi(1) and Wi(2) in 87-219
+ |
+ | "Except for multiplicative constants they correspond to
+ | what Fock (1965) calls w1 and w2 and to what Wait (1962)
+ | calls w2 and w1"
+ |
+ | The following are the multiplicative constants that allow
+ | for the translation between Hufford Wi(2) and Wi(1) with
+ | Wait W1 and W2, respectively. These are given here as a
+ | reference if this function is used for programs other
+ | than LFMF.
+ |
+ | // Wait
+ | complex WW2 = complex( sqrt(3.0*PI), sqrt(PI));
+ | complex WDW2 = complex(-1.0*sqrt(3.0*PI), sqrt(PI));
+ | complex WW1 = complex( sqrt(3.0*PI), -1.0*sqrt(PI));
+ | complex WDW1 = complex(-1.0*sqrt(3.0*PI), -1.0*sqrt(PI));
+ |
+ | // Hufford
+ | complex HW2 = 2.0*complex(cos( PI/3.0), sin( PI/3.0));
+ | complex HDW2 = 2.0*complex(cos(-PI/3.0), sin(-PI/3.0));
+ | complex HW1 = 2.0*complex(cos(-PI/3.0), sin(-PI/3.0));
+ | complex HDW1 = 2.0*complex(cos( PI/3.0), sin( PI/3.0));
+ |
+ | // (Multiplicative constant) * Huffords Wi'(1) = Wait W1'
+ | // So the multiplicative constants are:
+ | complex uDW2 = WDW2/HDW1; // uDW2 = complex(0.0, sqrt(PI))
+ | complex uW2 = WW2/HW1; // uW2 = complex(0.0, sqrt(PI))
+ | complex uDW1 = WDW1/HDW2; // uDW1 = complex(0.0, -sqrt(PI))
+ | complex uW1 = WW1/HW2; // uW1 = complex(0.0, -sqrt(PI))
+ |
+ | To make the solutions that are generated by this program
+ | for the Hufford Airy functions of the "3rd kind" abundantly
+ | clear please examine the following examples.
+ |
+ | For Z = 8.0 + 8.0 i the Asymptotic Solution is used
+ |
+ | Ai( 8.0 + 8.0 i) = 6.576933e-007 + 9.312331e-006 i
+ | Ai'(8.0 + 8.0 i) = 9.79016e-006 + -2.992170e-005 i
+ | Bi( 8.0 + 8.0 i) = -1.605154e+003 + -4.807200e+003 i
+ | Bi'(8.0 + 8.0 i) = 1301.23 + -16956 i
+ | Wi(1)(8.0 + 8.0 i) = -4.807200e+003 + 1.605154e+003 i
+ | Wi(2)(8.0 + 8.0 i) = 4.807200e+003 + -1.605154e+003 i
+ | Ai(z) - j*Bi(z) = -4.807200e+003 + 1.605154e+003 i
+ | Ai(z) + j*Bi(z) = 4.807200e+003 + -1.605154e+003 i
+ |
+ | For Z = 1.0 - 2.0 i the Taylor series with a shifted
+ | center of expansion solution used.
+ |
+ | Ai( 1.0 - 2.0 i) = -2.193862e-001 + 1.753859e-001 i
+ | Ai'(1.0 - 2.0 i) = 0.170445 + -0.387622 i
+ | Bi( 1.0 - 2.0 i) = 4.882205e-002 + -1.332740e-001 i
+ | Bi'(1.0 - 2.0 i) = -0.857239 + -0.495506 i
+ | Wi(1)(1.0 - 2.0 i) = -3.526603e-001 + 1.265638e-001 i
+ | Wi(2)(1.0 - 2.0 i) = -8.611221e-002 + 2.242079e-001 i
+ | Ai(z) - j*Bi(z) = -3.526603e-001 + 1.265639e-001 i
+ | Ai(z) + j*Bi(z) = -8.611221e-002 + 2.242080e-001 i
+ |
+ *===========================================================================*/
+complex Airy(complex Z, int kind, int scaling)
+{
+ // NQTT, ASLT data
+ int NQTT[15] = { 1,3,7,12,17,23,29,35,41,47,53,59,64,68,71 }; // Centers of Expansion of Taylor series on real axis indices into the
+ // AV, APV, BV and BPV arrays
+ int N; // Index into NQTT[] array
+ int NQ8; // Index that indicates the radius of convergence of the Taylor series solution
+ int CoERealidx; // Center of Expansion of the Taylor Series real index
+ int CoEImagidx; // Center of Expansion of the Taylor Series imaginary index
+ int cnt; // loop counter for the Taylor series calculation
+ int derivative; // index for derivative
+
+ bool reflection; // Flag to indicate that the answer needs to be flipped over since this routine only finds solutions in quadrant 1 and 2
+
+ complex A[2], ZT, B0, B1, B2, B3, AN, U, AIRYW, ZA, ZB, ZE, ZR, V, ZV, ZU, PHZU; // Temps
+ complex CoE; // Center of Expansion of the Taylor series
+ complex Ai; // Ai is either Ai(at the center of expansion of the Taylor series) or Bi( at the center of expansion of the Taylor series )
+ complex Aip; // Aip is the derivative of the above
+ complex sum1; // Temp Sum for the asymptotic solution
+ complex sum2; // Temp Sum for the asymptotic solution
+ complex ZB2, ZB1;
+
+ double one; // Used in the calculation of the asymptotic solution is either -1 or 1
+
+ // terms for asymptotic series. second column is for derivative
+ int SIZE_OF_ASV = 15;
+ double ASV[15][2] = { {0.5989251E+5, -0.6133571E+5},
+ {0.9207207E+4, -0.9446355E+4},
+ {0.1533169E+4, -0.1576357E+4},
+ {0.2784651E+3, -0.2870332E+3},
+ {0.5562279E+2, -0.5750830E+2},
+ {0.1234157E+2, -0.1280729E+2},
+ {0.3079453E+1, -0.3210494E+1},
+ {0.8776670E+0, -0.9204800E+0},
+ {0.2915914E+0, -0.3082538E+0},
+ {0.1160991E+0, -0.1241059E+0},
+ {0.5764919E-1, -0.6266216E-1},
+ {0.3799306E-1, -0.4246283E-1},
+ {0.3713349E-1, -0.4388503E-1},
+ {0.6944444E-1, -0.9722222E-1},
+ {0.1000000E+1, 0.1000000E+1} };
+
+ // Complex array of the value Ai(a) Airy function
+ // where a is the complex location of the center of expansion of the Taylor series
+ complex AV[70];
+
+ // Complex array of the value Ai'(a) derivative of the Airy function
+ // where a is the complex location of the center of expansion of the Taylor series
+ // presumably for Ai'[z]
+ complex APV[70];
+
+ //////////////////////////////////////////////////////////////////////////
+ // Initialize the center of expansion arrays. //
+ //////////////////////////////////////////////////////////////////////////
+ // The array AV[] (and BV[]) is the Airy function for Ai(a) to shift //
+ // the Taylor series from the origin to the point a Thus the series is //
+ // f(z -a) //
+ // Why George Hufford choose these particular locations for the //
+ // of the centers of expansion is unknown. The centers of expansion are //
+ // included here to remove any ambiguity in the method. //
+ //////////////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////// Center of expansion
+ /////////////////////////////////////////////////// ( Real, Imaginary)
+ AV[0] = complex(-3.2914520e-001, +0.0000000e+000);// (-6,0)
+ AV[1] = complex(-2.6780040e+000, +1.4774590e+000);// (-6,1/sin(pi/3))
+ AV[2] = complex(+3.5076100e-001, +0.0000000e+000);// (-5,0)
+ AV[3] = complex(+2.4122260e+000, +6.9865120e-001);// (-5,1/sin(pi/3))
+ AV[4] = complex(+3.3635530e+001, -3.4600960e+000);// (-5,2/sin(pi/3))
+ AV[5] = complex(+3.4449740e+002, -3.3690890e+002);// (-5,3/sin(pi/3))
+ AV[6] = complex(-7.0265530e-002, +0.0000000e+000);// (-4,0)
+ AV[7] = complex(-5.4818220e-001, -1.9207370e+000);// (-4,1/sin(pi/3))
+ AV[8] = complex(-1.3383400e+001, -1.6022590e+001);// (-4,2/sin(pi/3))
+ AV[9] = complex(-2.2967800e+002, -3.2072450e+001);// (-4,3/sin(pi/3))
+ AV[10] = complex(-1.8040780e+003, +2.1917680e+003);// (-4,4/sin(pi/3))
+ AV[11] = complex(-3.7881430e-001, +0.0000000e+000);// (-3,0)
+ AV[12] = complex(-1.3491840e+000, +8.4969080e-001);// (-3,1/sin(pi/3))
+ AV[13] = complex(-6.0453340e+000, +1.0623180e+001);// (-3,2/sin(pi/3))
+ AV[14] = complex(+3.1169620e+001, +9.8813520e+001);// (-3,3/sin(pi/3))
+ AV[15] = complex(+9.8925350e+002, +1.3905290e+002);// (-3,4/sin(pi/3))
+ AV[16] = complex(+2.2740740e-001, +0.0000000e+000);// (-2,0)
+ AV[17] = complex(+7.1857400e-001, +9.7809090e-001);// (-2,1/sin(pi/3))
+ AV[18] = complex(+6.0621090e+000, +2.7203010e+000);// (-2,2/sin(pi/3))
+ AV[19] = complex(+3.6307080e+001, -2.0961360e+001);// (-2,3/sin(pi/3))
+ AV[20] = complex(-6.7139790e+001, -3.0904640e+002);// (-2,4/sin(pi/3))
+ AV[21] = complex(-2.8001650e+003, +4.6649370e+002);// (-2,5/sin(pi/3))
+ AV[22] = complex(+5.3556090e-001, +0.0000000e+000);// (-1,0)
+ AV[23] = complex(+9.2407370e-001, -1.9106560e-001);// (-1,1/sin(pi/3))
+ AV[24] = complex(+1.8716190e+000, -2.5743310e+000);// (-1,2/sin(pi/3))
+ AV[25] = complex(-7.2188440e+000, -1.2924200e+001);// (-1,3/sin(pi/3))
+ AV[26] = complex(-8.1787380e+001, +3.2087010e+001);// (-1,4/sin(pi/3))
+ AV[27] = complex(+2.9933950e+002, +5.6922180e+002);// (-1,5/sin(pi/3))
+ AV[28] = complex(+3.5502810e-001, +0.0000000e+000);// ( 0,0)
+ AV[29] = complex(+3.1203440e-001, -3.8845390e-001);// ( 0,1/sin(pi/3))
+ AV[30] = complex(-5.2840000e-001, -1.0976410e+000);// ( 0,2/sin(pi/3))
+ AV[31] = complex(-4.2009350e+000, +1.1940150e+000);// ( 0,3/sin(pi/3))
+ AV[32] = complex(+7.1858830e+000, +1.9600910e+001);// ( 0,4/sin(pi/3))
+ AV[33] = complex(+1.0129120e+002, -7.5951230e+001);// ( 0,5/sin(pi/3))
+ AV[34] = complex(+1.3529240e-001, +0.0000000e+000);// ( 1,0)
+ AV[35] = complex(+3.2618480e-002, -1.7084870e-001);// ( 1,1/sin(pi/3))
+ AV[36] = complex(-3.4215380e-001, -8.9067650e-002);// ( 1,2/sin(pi/3))
+ AV[37] = complex(-1.4509640e-001, +1.0328020e+000);// ( 1,3/sin(pi/3))
+ AV[38] = complex(+4.1001970e+000, -6.8936910e-001);// ( 1,4/sin(pi/3))
+ AV[39] = complex(-1.3030120e+001, -1.6910540e+001);// ( 1,5/sin(pi/3))
+ AV[40] = complex(+3.4924130e-002, +0.0000000e+000);// ( 2,0)
+ AV[41] = complex(-8.4464730e-003, -4.2045150e-002);// ( 2,1/sin(pi/3))
+ AV[42] = complex(-6.9313270e-002, +3.5364800e-002);// ( 2,2/sin(pi/3))
+ AV[43] = complex(+1.5227620e-001, +1.2848450e-001);// ( 2,3/sin(pi/3))
+ AV[44] = complex(+1.0681370e-001, -6.7766150e-001);// ( 2,4/sin(pi/3))
+ AV[45] = complex(-2.6193430e+000, +1.5699860e+000);// ( 2,5/sin(pi/3))
+ AV[46] = complex(+6.5911390e-003, +0.0000000e+000);// ( 3,0)
+ AV[47] = complex(-3.9443990e-003, -6.8060110e-003);// ( 3,1/sin(pi/3))
+ AV[48] = complex(-5.9820130e-003, +1.1799010e-002);// ( 3,2/sin(pi/3))
+ AV[49] = complex(+2.9922500e-002, -5.9772930e-003);// ( 3,3/sin(pi/3))
+ AV[50] = complex(-7.7464130e-002, -5.2292400e-002);// ( 3,4/sin(pi/3))
+ AV[51] = complex(+1.1276590e-001, +3.5112440e-001);// ( 3,5/sin(pi/3))
+ AV[52] = complex(+9.5156390e-004, +0.0000000e+000);// ( 4,0)
+ AV[53] = complex(-8.0843000e-004, -7.6590130e-004);// ( 4,1/sin(pi/3))
+ AV[54] = complex(+1.6147820e-004, +1.7661760e-003);// ( 4,2/sin(pi/3))
+ AV[55] = complex(+2.0138720e-003, -3.1976720e-003);// ( 4,3/sin(pi/3))
+ AV[56] = complex(-9.5086780e-003, +4.5377830e-003);// ( 4,4/sin(pi/3))
+ AV[57] = complex(+3.7560190e-002, +5.7361920e-004);// ( 4,5/sin(pi/3))
+ AV[58] = complex(+1.0834440e-004, +0.0000000e+000);// ( 5,0)
+ AV[59] = complex(-1.0968610e-004, -5.9902330e-005);// ( 5,1/sin(pi/3))
+ AV[60] = complex(+1.0778190e-004, +1.5771600e-004);// ( 5,2/sin(pi/3))
+ AV[61] = complex(-6.8980940e-005, -3.7626460e-004);// ( 5,3/sin(pi/3))
+ AV[62] = complex(-1.6166130e-004, +9.7457770e-004);// ( 5,4/sin(pi/3))
+ AV[63] = complex(+9.9476940e-006, +0.0000000e+000);// ( 6,0)
+ AV[64] = complex(-1.0956820e-005, -2.9508800e-006);// ( 6,1/sin(pi/3))
+ AV[65] = complex(+1.4709070e-005, +8.1042090e-006);// ( 6,2/sin(pi/3))
+ AV[66] = complex(-2.4446020e-005, -2.0638140e-005);// ( 6,3/sin(pi/3))
+ AV[67] = complex(+7.4921290e-007, +0.0000000e+000);// ( 7,0)
+ AV[68] = complex(-8.4619070e-007, -3.6807340e-008);// ( 7,1/sin(pi/3))
+ AV[69] = complex(+1.2183960e-006, +8.3589200e-008);// ( 7,2/sin(pi/3))
+
+ //////////////////////////////////////////////////////////////////////////
+ // This array APV[] is the derivative of the Airy function for Ai'(a) //
+ //////////////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////// Center of expansion
+ /////////////////////////////////////////////////// ( Real, Imaginary)
+ APV[0] = complex(+3.4593550e-001, +0.0000000e+000);// (-6,0)
+ APV[1] = complex(+4.1708880e+000, +6.2414440e+000);// (-6,1/sin(pi/3))
+ APV[2] = complex(+3.2719280e-001, +0.0000000e+000);// (-5,0)
+ APV[3] = complex(+1.0828740e+000, -5.4928300e+000);// (-5,1/sin(pi/3))
+ APV[4] = complex(-2.3363520e+001, -7.4901850e+001);// (-5,2/sin(pi/3))
+ APV[5] = complex(-1.0264880e+003, -5.6707940e+002);// (-5,3/sin(pi/3))
+ APV[6] = complex(-7.9062860e-001, +0.0000000e+000);// (-4,0)
+ APV[7] = complex(-3.8085830e+000, +1.5129610e+000);// (-4,1/sin(pi/3))
+ APV[8] = complex(-2.6086380e+001, +3.5540710e+001);// (-4,2/sin(pi/3))
+ APV[9] = complex(+1.0761840e+002, +5.1239940e+002);// (-4,3/sin(pi/3))
+ APV[10] = complex(+6.6597800e+003, +1.8096190e+003);// (-4,4/sin(pi/3))
+ APV[11] = complex(+3.1458380e-001, +0.0000000e+000);// (-3,0)
+ APV[12] = complex(+1.8715430e+000, +2.0544840e+000);// (-3,1/sin(pi/3))
+ APV[13] = complex(+2.2591740e+001, +4.8563000e+000);// (-3,2/sin(pi/3))
+ APV[14] = complex(+1.6163000e+002, -1.4335600e+002);// (-3,3/sin(pi/3))
+ APV[15] = complex(-8.0047160e+002, -2.1527450e+003);// (-3,4/sin(pi/3))
+ APV[16] = complex(+6.1825900e-001, +0.0000000e+000);// (-2,0)
+ APV[17] = complex(+1.3019600e+000, -1.2290770e+000);// (-2,1/sin(pi/3))
+ APV[18] = complex(+1.5036120e-001, -1.1008090e+001);// (-2,2/sin(pi/3))
+ APV[19] = complex(-7.0116800e+001, -4.0480820e+001);// (-2,3/sin(pi/3))
+ APV[20] = complex(-4.8317170e+002, +4.9692760e+002);// (-2,4/sin(pi/3))
+ APV[21] = complex(+4.8970660e+003, +4.8627290e+003);// (-2,5/sin(pi/3))
+ APV[22] = complex(-1.0160570e-002, +0.0000000e+000);// (-1,0)
+ APV[23] = complex(-5.4826640e-001, -7.1365290e-001);// (-1,1/sin(pi/3))
+ APV[24] = complex(-4.6749130e+000, -1.1924250e-001);// (-1,2/sin(pi/3))
+ APV[25] = complex(-1.0536400e+001, +2.4943710e+001);// (-1,3/sin(pi/3))
+ APV[26] = complex(+1.6333770e+002, +9.0394910e+001);// (-1,4/sin(pi/3))
+ APV[27] = complex(+5.6449460e+002, -1.4248320e+003);// (-1,5/sin(pi/3))
+ APV[28] = complex(-2.5881940e-001, +0.0000000e+000);// ( 0,0)
+ APV[29] = complex(-4.8620750e-001, +1.5689920e-001);// ( 0,1/sin(pi/3))
+ APV[30] = complex(-4.7348130e-001, +1.7093440e+000);// ( 0,2/sin(pi/3))
+ APV[31] = complex(+7.0373840e+000, +3.6281820e+000);// ( 0,3/sin(pi/3))
+ APV[32] = complex(+1.7739590e+001, -4.0360420e+001);// ( 0,4/sin(pi/3))
+ APV[33] = complex(-2.9791510e+002, -3.8408890e+001);// ( 0,5/sin(pi/3))
+ APV[34] = complex(-1.5914740e-001, +0.0000000e+000);// ( 1,0)
+ APV[35] = complex(-1.1340420e-001, +1.9730500e-001);// ( 1,1/sin(pi/3))
+ APV[36] = complex(+4.0126210e-001, +3.9223000e-001);// ( 1,2/sin(pi/3))
+ APV[37] = complex(+1.3348650e+000, -1.4377270e+000);// ( 1,3/sin(pi/3))
+ APV[38] = complex(-7.9022490e+000, -4.2063640e+000);// ( 1,4/sin(pi/3))
+ APV[39] = complex(-1.3892750e+000, +5.1229420e+001);// ( 1,5/sin(pi/3))
+ APV[40] = complex(-5.3090380e-002, +0.0000000e+000);// ( 2,0)
+ APV[41] = complex(-1.6832970e-003, +6.8366970e-002);// ( 2,1/sin(pi/3))
+ APV[42] = complex(+1.3789400e-001, -1.1613800e-002);// ( 2,2/sin(pi/3))
+ APV[43] = complex(-1.4713730e-001, -3.7151990e-001);// ( 2,3/sin(pi/3))
+ APV[44] = complex(-1.0070200e+000, +1.1591350e+000);// ( 2,4/sin(pi/3))
+ APV[45] = complex(+7.5045050e+000, +4.6913120e-001);// ( 2,5/sin(pi/3))
+ APV[46] = complex(-1.1912980e-002, +0.0000000e+000);// ( 3,0)
+ APV[47] = complex(+5.1468570e-003, +1.3660890e-002);// ( 3,1/sin(pi/3))
+ APV[48] = complex(+1.8309710e-002, -1.8808590e-002);// ( 3,2/sin(pi/3))
+ APV[49] = complex(-6.4461590e-002, -1.3611790e-002);// ( 3,3/sin(pi/3))
+ APV[50] = complex(+1.0516240e-001, +1.9313050e-001);// ( 3,4/sin(pi/3))
+ APV[51] = complex(+2.0520050e-001, -9.1772620e-001);// ( 3,5/sin(pi/3))
+ APV[52] = complex(-1.9586410e-003, +0.0000000e+000);// ( 4,0)
+ APV[53] = complex(+1.4695650e-003, +1.8086380e-003);// ( 4,1/sin(pi/3))
+ APV[54] = complex(+5.9709950e-004, -3.8332700e-003);// ( 4,2/sin(pi/3))
+ APV[55] = complex(-6.8910890e-003, +5.4467430e-003);// ( 4,3/sin(pi/3))
+ APV[56] = complex(+2.6167930e-002, -8.4092000e-004);// ( 4,4/sin(pi/3))
+ APV[57] = complex(-8.8284470e-002, -4.6475310e-002);// ( 4,5/sin(pi/3))
+ APV[58] = complex(-2.4741390e-004, +0.0000000e+000);// ( 5,0)
+ APV[59] = complex(+2.3707840e-004, +1.6461110e-004);// ( 5,1/sin(pi/3))
+ APV[60] = complex(-1.7465570e-004, -4.2026780e-004);// ( 5,2/sin(pi/3))
+ APV[61] = complex(-1.0394520e-004, +9.4761840e-004);// ( 5,3/sin(pi/3))
+ APV[62] = complex(+1.3004110e-003, -2.2446660e-003);// ( 5,4/sin(pi/3))
+ APV[63] = complex(-2.4765200e-005, +0.0000000e+000);// ( 6,0)
+ APV[64] = complex(+2.6714870e-005, +9.8691570e-006);// ( 6,1/sin(pi/3))
+ APV[65] = complex(-3.3539770e-005, -2.7113280e-005);// ( 6,2/sin(pi/3))
+ APV[66] = complex(+4.9197840e-005, +6.9349090e-005);// ( 6,3/sin(pi/3))
+ APV[67] = complex(-2.0081510e-006, +0.0000000e+000);// ( 7,0)
+ APV[68] = complex(+2.2671240e-006, +2.7848510e-007);// ( 7,1/sin(pi/3))
+ APV[69] = complex(-3.2692130e-006, -7.3943490e-007);// ( 7,2/sin(pi/3))
+
+ /////////////////////////////////////////////////////////////////////////
+
+ // Complex array of the value Bi(a) Airy function
+ // where a is the complex location of the center of expansion of the Taylor series
+ complex BV[70];
+
+ // Complex array of the value Bi'(a) derivative of the Airy function
+ // where a is the complex location of the center of expansion of the Taylor series
+ // presumably for Ai'[z]
+ complex BPV[70];
+
+ BV[0] = complex(-1.466984e-001, -9.813078e-017);// (-6,0)
+ BV[1] = complex(-1.489391e+000, -2.660635e+000);// (-6,1/sin(pi/3))
+ BV[2] = complex(-1.383691e-001, +0.000000e+000);// (-5,0)
+ BV[3] = complex(-7.034482e-001, +2.384547e+000);// (-5,1/sin(pi/3))
+ BV[4] = complex(+3.460723e+000, +3.363363e+001);// (-5,2/sin(pi/3))
+ BV[5] = complex(+3.369090e+002, +3.444973e+002);// (-5,3/sin(pi/3))
+ BV[6] = complex(+3.922347e-001, -1.041605e-016);// (-4,0)
+ BV[7] = complex(+1.956219e+000, -5.327226e-001);// (-4,1/sin(pi/3))
+ BV[8] = complex(+1.602464e+001, -1.338050e+001);// (-4,2/sin(pi/3))
+ BV[9] = complex(+3.207239e+001, -2.296777e+002);// (-4,3/sin(pi/3))
+ BV[10] = complex(-2.191768e+003, -1.804078e+003);// (-4,4/sin(pi/3))
+ BV[11] = complex(-1.982896e-001, +4.440892e-016);// (-3,0)
+ BV[12] = complex(-8.880754e-001, -1.308713e+000);// (-3,1/sin(pi/3))
+ BV[13] = complex(-1.062975e+001, -6.044056e+000);// (-3,2/sin(pi/3))
+ BV[14] = complex(-9.881405e+001, +3.116914e+001);// (-3,3/sin(pi/3))
+ BV[15] = complex(-1.390528e+002, +9.892534e+002);// (-3,4/sin(pi/3))
+ BV[16] = complex(-4.123026e-001, +1.451806e-016);// (-2,0)
+ BV[17] = complex(-1.034766e+000, +6.541962e-001);// (-2,1/sin(pi/3))
+ BV[18] = complex(-2.720266e+000, +6.048328e+000);// (-2,2/sin(pi/3))
+ BV[19] = complex(+2.096300e+001, +3.630613e+001);// (-2,3/sin(pi/3))
+ BV[20] = complex(+3.090465e+002, -6.713963e+001);// (-2,4/sin(pi/3))
+ BV[21] = complex(-4.664937e+002, -2.800165e+003);// (-2,5/sin(pi/3))
+ BV[22] = complex(+1.039974e-001, +0.000000e+000);// (-1,0)
+ BV[23] = complex(+2.797458e-001, +8.086491e-001);// (-1,1/sin(pi/3))
+ BV[24] = complex(+2.606133e+000, +1.870297e+000);// (-1,2/sin(pi/3))
+ BV[25] = complex(+1.292648e+001, -7.213647e+000);// (-1,3/sin(pi/3))
+ BV[26] = complex(-3.208774e+001, -8.178697e+001);// (-1,4/sin(pi/3))
+ BV[27] = complex(-5.692218e+002, +2.993394e+002);// (-1,5/sin(pi/3))
+ BV[28] = complex(+6.149266e-001, +0.000000e+000);// ( 0,0)
+ BV[29] = complex(+6.732023e-001, +3.575876e-001);// ( 0,1/sin(pi/3))
+ BV[30] = complex(+1.125057e+000, -4.471292e-001);// ( 0,2/sin(pi/3))
+ BV[31] = complex(-1.211148e+000, -4.191469e+000);// ( 0,3/sin(pi/3))
+ BV[32] = complex(-1.960240e+001, +7.182663e+000);// ( 0,4/sin(pi/3))
+ BV[33] = complex(+7.595175e+001, +1.012911e+002);// ( 0,5/sin(pi/3))
+ BV[34] = complex(+1.207424e+000, +0.000000e+000);// ( 1,0)
+ BV[35] = complex(+5.951440e-001, +6.156664e-001);// ( 1,1/sin(pi/3))
+ BV[36] = complex(-1.002325e-001, -1.338228e-001);// ( 1,2/sin(pi/3))
+ BV[37] = complex(-1.089323e+000, -2.019524e-001);// ( 1,3/sin(pi/3))
+ BV[38] = complex(+7.047139e-001, +4.091592e+000);// ( 1,4/sin(pi/3))
+ BV[39] = complex(+1.691067e+001, -1.302705e+001);// ( 1,5/sin(pi/3))
+ BV[40] = complex(+3.298095e+000, +0.000000e+000);// ( 2,0)
+ BV[41] = complex(+2.244706e-001, +2.421124e+000);// ( 2,1/sin(pi/3))
+ BV[42] = complex(-1.199515e+000, -1.167656e-001);// ( 2,2/sin(pi/3))
+ BV[43] = complex(+6.781072e-003, -2.225418e-001);// ( 2,3/sin(pi/3))
+ BV[44] = complex(+7.470822e-001, +1.832986e-001);// ( 2,4/sin(pi/3))
+ BV[45] = complex(-1.590993e+000, -2.617694e+000);// ( 2,5/sin(pi/3))
+ BV[46] = complex(+1.403733e+001, +0.000000e+000);// ( 3,0)
+ BV[47] = complex(-3.731398e+000, +1.066394e+001);// ( 3,1/sin(pi/3))
+ BV[48] = complex(-4.440986e+000, -4.309647e+000);// ( 3,2/sin(pi/3))
+ BV[49] = complex(+2.373933e+000, -5.300179e-001);// ( 3,3/sin(pi/3))
+ BV[50] = complex(-2.821481e-001, +5.657373e-001);// ( 3,4/sin(pi/3))
+ BV[51] = complex(-3.904913e-001, -5.168316e-002);// ( 3,5/sin(pi/3))
+ BV[52] = complex(+8.384707e+001, +0.000000e+000);// ( 4,0)
+ BV[53] = complex(-4.356467e+001, +5.497027e+001);// ( 4,1/sin(pi/3))
+ BV[54] = complex(-7.156364e+000, -4.113550e+001);// ( 4,2/sin(pi/3))
+ BV[55] = complex(+1.455852e+001, +1.109071e+001);// ( 4,3/sin(pi/3))
+ BV[56] = complex(-6.111359e+000, -1.094609e-001);// ( 4,4/sin(pi/3))
+ BV[57] = complex(+1.403434e+000, -7.255043e-001);// ( 4,5/sin(pi/3))
+ BV[58] = complex(+6.577920e+002, +0.000000e+000);// ( 5,0)
+ BV[59] = complex(-4.598656e+002, +3.242259e+002);// ( 5,1/sin(pi/3))
+ BV[60] = complex(+1.324505e+002, -3.294705e+002);// ( 5,2/sin(pi/3))
+ BV[61] = complex(+2.057579e+001, +1.674034e+002);// ( 5,3/sin(pi/3))
+ BV[62] = complex(-3.161505e+001, -5.302141e+001);// ( 5,4/sin(pi/3))
+ BV[63] = complex(+6.536446e+003, +0.000000e+000);// ( 6,0)
+ BV[64] = complex(-5.316522e+003, +1.992175e+003);// ( 6,1/sin(pi/3))
+ BV[65] = complex(+2.888529e+003, -2.373473e+003);// ( 6,2/sin(pi/3))
+ BV[66] = complex