// s14ae Example Program Text // C# version, NAG Copyright 2008 using System; using NagLibrary; using System.Globalization; namespace NagDotNetExamples { public class S14AEE { static string datafile = "ExampleData/s14aee.d"; static void Main(String[] args) { if (args.Length == 1) { datafile = args[0]; } StartExample(); } public static void StartExample() { try { PrintManager.Warning = new PrintManager.MessageLogger(discardmessage); DataReader sr = new DataReader(datafile); double x, y; int k; int ifail; Console.WriteLine("s14ae Example Program Results"); // Skip heading in data file sr.Reset(); Console.WriteLine(""); Console.WriteLine(" {0}", " x k (d^k/dx^k)psi(x) ifail"); Console.WriteLine(""); try { while (true) { sr.Reset(); x = double.Parse(sr.Next(), CultureInfo.InvariantCulture); k = int.Parse(sr.Next()); // y = S.s14ae(x, k, out ifail); // if (ifail >= 0) { Console.WriteLine(" {0,5:f1}{1,5} {2,12:e4} {3,7}", x, k, y, ifail); } else { Console.WriteLine("** s14ae failed with ifail = {0,5}", ifail); } } } catch { } // } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine("Exception Raised"); } } static void discardmessage(String message) { } } }