The most trivial task in option pricing is to compute values through the Black-Scholes formula: type in the formula, feed Maple with data, done. The same in computational environments like C programs or Excel (assuming a good implementation of the cumulative normal function). Really? And the limiting cases? Or coming close to them? How about small volatility (say below 10% like in FX trading?) or short expiry times (say some weeks)? No problem to back-out volatility from prices to fit models?
First I give an example that using the common formula even Maple quickly runs into numerical errors. That can be avoided by decomposing calls and puts into their so-called intrinsic value (the discounted pay-off) and their premium (that's wht has to be payed beyond that, the actual 'speculation').
That premium writes in a simple way (for both puts and calls) after passing to a normed situation, variables now are 'logarithmic moneyness' and standard deviation = volatility * sqrt(time).
Starring long enough enough at that formula and playing even much longer with it the idea is to re-scale it in a similar way how Mills Ratio is related to the cumulative normal distribution. And - as the main motivation was small volatility - to try something like a Taylor series in volatility = 0. The result does not look that promising, it looks quite complicated.
But using the packages 'PDEtools' and 'gfun' one actually can work out a law to compute the Taylor coefficients through a 4-term recursion. After a while one sees that a simple coding is possible and testing shows it to be both stable and fast. And it is a bit better than the reformulation just mentioned.
An implementation as C-DLL shows that one can even get 1 more digit in decimal precison versus just using evalhf for simulating that.
The uploaded zip-file contains the worksheet and the DLL (without virus as my program says ...), a pdf would be too large due to graphics.
Comments
conversely: using it to compute implied volatility + source code
In two worksheets "Which vol was paid?" and "Black-Scholes prices for small volatility or times" it was shown, how to compute implied volatility and Black-Scholes prices in few steps and with reasonable exactness. Combining both gives solutions for both pricing and retrieving implied volatility, which work in double precision to almost machine precision if being compiled.
For computing option prices one can use a 'scaled' version of for (normed) option premia. That needs an exact computation of Mills Ratio. For small inputs this is done through Chebyshev-Pade approximations, for intermediate inputs a method of Marsaglia is used while for large values an asymptotic series works.
Conversely to get implied volatility from prices one can also use the scaled premium: it behaves good enough for 'almost flat' regions and has a simple form for its derivative. So one can apply the Newton-Raphson method - the initial value can be guessed quite accurately.
Additionally a feature is given trying to care for the numerical illposed question of implied volatility: refine through bisection, trying to find a 'maximal' solution for the equation.
Instead of re-writing all the stuff it is sketched, what has to be done (using Maple) and mainly test results are given, making use of a compiled version through a C DLL.
That zipped file contains the worksheet and the needed DLL:
Download 102_scaledPremium+Vol.zip (291 KB)
The C sources are provided as part of the sheet, but as separate files, consider this sheet as an explanation for the code.
Download 102_BS_exact.C-sources.zip (16 KB)
Since I make use of SUN's implementation of the error function and Wichura's inverse for it (not really needed in that form and certainly none of them, if working within Maple) I am unsure, which licence applies - for me the "3-clause BSD licence" is ok, which is compatible with the GNU GPL.