// g01mu Example Program Text // C# version, NAG Copyright 2008 using System; using NagLibrary; using System.Globalization; using System.IO; namespace NagDotNetExamples { public class G01MUE { static string datafile = "ExampleData/g01mue.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 = 0; double beta2, c1, c2, rkappa, x, xl, xu, y; double[] comm = new double[322]; int ifail; bool carryon = true; Console.WriteLine("g01mu Example Program Results"); // Skip heading in data file sr.Reset(); c1 = -X02.x02al(); c2 = -X02.x02al(); Console.WriteLine(""); Console.WriteLine(" {0}", " x rkappa beta2 y ifail"); Console.WriteLine(""); 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 the first call to G01.g01mu and // on subsequent calls when rkappa or beta2 has changed. // // G01.g01zu(rkappa, beta2, mode, out xl, out xu, comm, out ifail); // if (ifail != 0) { Console.WriteLine("** g01zu failed with ifail = {0,5}", ifail); break; } // } // // Compute the value of the Vavilov density function // // y = G01.g01mu(x, comm, out ifail); // if (ifail == 0) { Console.WriteLine(" {0,4:f1} {1,4:f1} {2,4:f1} {3,12:e4}{4,6}", x, rkappa, beta2, y, ifail); c1 = (double)rkappa; c2 = (double)beta2; continue; } else { Console.WriteLine("** g01mu failed with ifail = {0,5}", ifail); } // } } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine( "Exception Raised"); } } } }