Tutorial 001: Analytic BlackScholes option pricer with a GUI.
Task

Implement the BlackScholes formula, which calculates the price of a European option under the BlackScholes model, given the model parameters
spot,
risk free rate,
volatility,
and the product parameters
maturity
strike

Implement an inverse of the BlackScholes formula, which calculates the (implied) volatility of the BlackScholes model, given the model parameters
spot
risk free rate
and the product parameters of a European option
maturity
strike
price

Create a GUI
Hints

Create a class
AnalyticFormulas
whose purpose it will be to provide a collection of analytic formulas as class methods (static).

Implement the analytic BlackScholes formula as a class method
blackScholesOptionPrice
.

For the cumulative normal distribution function use a library function, e.g.,
cern.jet.stat.Probability.normal()
or org.apache.commons.math.distribution.NormalDistributionImpl.cumulativeNormalDistribution()
.

Implement the inverse of the BlackScholes formula as a class method
blackScholesOptionImpliedVolatility
.

Use
AnalyticFormulas.blackScholesOptionPrice()
from above in connection with a root finder, e.g., net.finmath.rootFinder.BisectionSearch
.

Create a GUI using your favored GUI builder (this is not a tutorial on how to use a GUI builder). Add gui elements for the model and product parameters. Implement the following behaviour:

If any field except the price is changed, calculate the price and show it.

If the price is changed, calculate the implied volatility and show it.
Note: You have to account for the case where an invalid volatility is entered!
Solution / Example
See net.finmath.experiments.blackScholes.BlackScholesOptionCaclulator.java.