// Example Volatility_Implied.cpp
// Calcul the implied volatility of IBM call option for
// Expiry= 4 months: T=4/12
// Current price=S
// Dividend = D0
// Interest rate = r
// sigma_i = initial sigma for iteration
// Price = prices of the options as function of the Strike
#include "LOPOR.hpp"
using namespace LOPOR;
int main( )
{
try
{
double S=63.92;
double T=4./12.;
double t=0;
double r =0.0492;
double D0=0.018;
double sigma_i=0.6;
// Price as function of the strike {35,40,...,155,160}
std::vector Strike=vec_create2(35.,160.,5.);
std::vector Price;
Price=c2v(30.5,25.3,20.5,16.80,12.6,9.3,6.4,4.1,2.60,1.5,0.9
,0.5,0.3,0.2,0.15,0.10,0.15,0.15,0.1,0.1,0.1
,0.1,0.1,0.05,0.05,0.05);
// Calcul implied volatility
std::vector sigma;
for(int i=0; i