 Linear Algebra
Optimization
Differential Equations

## Simplex Method. The banana function.

The Simplex class is used to minimizes a function of several variables by using the Nelder-Mead (Simplex) method. This class can be used for unconstrained and bounded constrained minimization.

In this example the Simplex class is used to solve the banana function problem:

```            f(a,b)=100*(b-a^2)^2+(1-a)^2
The minimum is at (1,1) and the  function value is 0.
```

#### C# Code

` `
` using DotNumerics.Optimization;`
` `
`public void OptimizationSimplex()`
`{`
` `
`    Simplex simplex = new Simplex();`
`    double[] initialGuess = new double;`
`    initialGuess = 0.1;`
`    initialGuess = 2;`
`    double[] minimum = simplex.ComputeMin(BananaFunction, initialGuess);`
` `
`}`
` `
`//f(a,b) = 100*(b-a^2)^2 + (1-a)^2`
`private double BananaFunction(double[] x)`
`{`
`    double f = 0;`
`    f = 100 * Math.Pow((x - x * x), 2) + Math.Pow((1 - x), 2);`
`    return f;`
`}`

#### Solution

```
Simplex Method.
a = 0.999999997960522,   b = 0.999999995617332
```