Checkout finmath-experiments from git and run maven (`mvn`

or `mvnw`

) from
its directory. This will start a JShell.
See Getting Started for details.

JShell:

```
DoubleUnaryOperator value = strike -> net.finmath.functions.AnalyticFormulas.blackScholesOptionValue(100.0, 0.05, 0.20, 2.0, strike);
(new net.finmath.plots.Plot2D(0.0, 300.0, 100, value)).show();
```

In the following we plot the finite difference approximation of the second derivative of the value of the European option. It can be shown that the second derivative of \( V \) with respect to \( K \) is related to the probability density of \( S(T) \) under \( \mathbb{Q} \), that is \[ \frac{\partial V(T,K)}{\partial K} \ = \ \phi_{S(T)}(K) \ \frac{N(0)}{N(T)} \text{.} \]

JShell:

```
import net.finmath.functions.AnalyticFormulas;
import net.finmath.plots.Plot2D;
DoubleUnaryOperator value = strike -> AnalyticFormulas.blackScholesOptionValue(100.0, 0.05, 0.20, 2.0, strike);
double h = 1E-2;
DoubleUnaryOperator secondDerivative = strike -> (value.applyAsDouble(strike+h) - 2*value.applyAsDouble(strike) + value.applyAsDouble(strike-h))/(h*h);
Plot2D plot = new Plot2D(0.0, 300.0, 100, secondDerivative);
plot.setYAxisNumberFormat(new java.text.DecimalFormat("0.0E00"));
plot.setXAxisLabel("strike").setYAxisLabel("frequency");
plot.show();
```