// c05ay Example Program Text // C# version, NAG Copyright 2008 using System; using NagLibrary; using System.Globalization; namespace NagDotNetExamples { public class C05AYE { static void Main(String[] args) { StartExample(); } public static void StartExample() { try { //C05.C05AD_F fC05AD = new C05.C05AD_F(f); C05.C05AY_F fC05AY = new C05.C05AY_F(f); double a, b, eps, eta, x; int ifail; Console.WriteLine("c05ay Example Program Results"); a = 0.00e0; b = 1.00e0; eps = 1.00e-5; eta = 0.00e0; // // C05.c05ad(a, b, eps, eta, fC05AD, out x, out ifail); C05.c05ay(a, b, eps, eta, fC05AY, out x, out ifail); // Console.WriteLine(""); if (ifail == 0) { Console.WriteLine(" {0}{1,12:f5}","Zero at x =",x); } else { Console.WriteLine(" {0}{1,5}"," ** c05ay returned with ifail = ",ifail); if ((ifail == 2) || (ifail == 3)) { Console.WriteLine(" {0}{1,12:f5}","Final point = ",x); } } // } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine("Exception Raised"); } Console.WriteLine(""); } // // public static double f (double x) { double fValue; fValue = Math.Exp( -x) - x; return fValue; } } }