// g01jd Example Program Text // C# version, NAG Copyright 2008 using System; using NagLibrary; using System.Globalization; using System.IO; namespace NagDotNetExamples { public class G01JDE { static string datafile = "ExampleData/g01jde.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 n=10; double c, d, prob; int i; string method=""; double[] rlam = new double[n]; int ifail; Console.WriteLine("g01jd Example Program Results"); // Skip heading in data file sr.Reset(); sr.Reset(); method = sr.Next(); d = double.Parse(sr.Next(), CultureInfo.InvariantCulture); c = double.Parse(sr.Next(), CultureInfo.InvariantCulture); sr.Reset(); for (i = 1 ; i <= n ; i++) { rlam[i - 1] = double.Parse(sr.Next(), CultureInfo.InvariantCulture); } // // G01.g01jd(method, n, rlam, d, c, out prob, out ifail); // if (ifail == 0) { Console.WriteLine(""); Console.Write(" {0}", " Values of lambda "); for (i = 1 ; i <= n ; i++) { Console.Write(" {0, 6:f2}", rlam[i - 1]); } Console.WriteLine(""); Console.WriteLine(" {0}{1,6:f2}"," Value of D ",d); Console.WriteLine(" {0}{1,6:f2}"," value of C ",c); Console.WriteLine(""); Console.WriteLine(" {0}{1,10:f4}"," Probability = ",prob); } else { Console.WriteLine(""); Console.WriteLine("** g01jd failed with ifail = {0,5}", ifail); } // } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine( "Exception Raised"); } } } }