// g01eu Example Program Text // C# version, NAG Copyright 2008 using System; using NagLibrary; using System.Globalization; using System.IO; namespace NagDotNetExamples { public class G01EUE { static string datafile = "ExampleData/g01eue.d"; static void Main(String[] args) { if (args.Length == 1) { datafile = args[0]; } StartExample(); } public static void StartExample() { try { DataReader sr = new DataReader(datafile); const int mode = 1; double beta2, c1, c2, rkappa, x, xl, xu, y; double[] comm = new double[322]; int ifail; bool carryon = true; Console.WriteLine("g01eu Example Program Results"); // Skip heading in data file sr.Reset(); c1 = -X02.x02al(); c2 = -X02.x02al(); while (carryon) { try { sr.Reset(); x = double.Parse(sr.Next(), CultureInfo.InvariantCulture); rkappa = double.Parse(sr.Next(), CultureInfo.InvariantCulture); beta2 = double.Parse(sr.Next(), CultureInfo.InvariantCulture); } catch { break; } if (rkappa != c1 || beta2 != c2) { // // Initialise array comm before the call to g01eu // // G01.g01zu(rkappa, beta2, mode, out xl, out xu, comm, out ifail); // Console.WriteLine(""); if (ifail == 0) { Console.WriteLine(" {0,2} {1,6} {2,5} {3,1} {4,5}\n", "x", "rkappa", "beta2", "y", "ifail"); } else { Console.WriteLine("** g01zu failed with ifail = {0,5}", ifail); break; } // } // // Compute the value of the Vavilov distribution function // // y = G01.g01eu(x, comm, out ifail); // if (ifail == 0) { Console.WriteLine(" {0,4:f1} {1,4:f1} {2,4:f1} {3,12:e4} {4,2}", x, rkappa, beta2, y, ifail); c1 = (double)rkappa; c2 = (double)beta2; continue; } else { Console.WriteLine(""); Console.WriteLine("** g01eu failed with ifail = {0,5}", ifail); break; } } // } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine( "Exception Raised"); } } } }