Example 1: Minimum of a smooth function

The minimum of e^x - 5x is found using function evaluations only.
using System;
using Imsl.Math;

public class MinUnconEx1 : MinUncon.IFunction
{
	public double F(double x)
	{
		return Math.Exp(x) - 5.0 * x;
	}


	public static void  Main(String[] args)
	{
		MinUncon zf = new MinUncon();
		zf.Guess = 0.0;
		zf.Accuracy = 0.001;
		MinUncon.IFunction fcn = new MinUnconEx1();
		Console.Out.WriteLine("Minimum is " + zf.ComputeMin(fcn));
	}
}

Output

Minimum is 1.60941759992003

Link to C# source.