Black-Scholes for 17BII+ with 12 Digit Accuracy


Black-Scholes for 17BII+ with 12 Digit Accuracy

Tony Hutchins has an article in DataFile V24N2pp13-21 Wronski's Lex Suprema on the HP-12C that presents a Black-Scholes program accurate to 12 digits. Tony has graciously given me permission to post the HP 17BII+ version here. The INIT.VARS equation is to initialize all one-letter variables to allow L() and G() to work properly. I also included run-times for this version; as strike prices become less probable, times increase to around 9 minutes.

PS=52, PE=47, RF%=0.5, T=6, S=0.2054



                    Exact Call        Calculated Call   Error           Execution Time
PE=47, d1=.6957 13.208118745061 13.208118745100 -3.92344E-11 39 sec
PE=37, d1=.9876 18.961966848997 18.961966849000 -3.1477E-12 58 sec
PE=22, d1=2.0209 30.902477228531 30.902477228600 -6.94556E-11 1 min 34 sec
PE=13, d1=3.0666 39.393284752365 39.393284752200 1.64839E-10 2 min 50 sec
PE=02, d1=6.7869 50.059108932926 50.059108932900 2.57856E-11 8 min 55 sec
PE=01, d1=8.1645 51.029554466452 51.029554466500 -4.85088E-11 7 sec

An alternative is to use a 5th order polynomial approximation that always executes in 13 seconds, but only has 7.4 digits of accuracy:


                   Exact Call        Calculated Call   Error           Execution Time
PE=47, d1=.6957 13.208118745061 13.208118448700 2.96361E-07 13 sec
PE=37, d1=.9876 18.961966848997 18.961966877200 -2.82031E-08 13 sec
PE=22, d1=2.0209 30.902477228531 30.902481308000 -4.07947E-06 13 sec
PE=13, d1=3.0666 39.393284752365 39.393281519000 3.23336E-06 13 sec
PE=02, d1=6.7869 50.059108932926 50.059108932900 2.57856E-11 11 sec
PE=01, d1=8.1645 51.029554466452 51.029554466500 -4.85088E-11 11 sec



Gidday Bob! This really seems to highlight yet another issue with the 17BII+. I don't dispute your results, but on the 19BII execution time is not really an issue. Your excellently chosen worst case for the algorithm with d1 & d2 up there just under 7 executes in 30 seconds on the 19BII - about 18 times faster than on the 17BII+. The case for d1 near 3 executes in 13 seconds and the rest in 10 seconds or less.
The program takes about 15 seconds to "verify" on the 19BII so is fairly cumbersome to start, but exceutes well. In practice d1 and d2 will be under 3 so the execution time will be under about 10 seconds. Anything taking longer is probably a theoretical case :-) Cheers, and thanks for your contributions and ability to make the 17BII+ work! Tony


Bob, me again, only a day or two late :-)

This may work on the 17BII+, as it uses L() only, not G() and
does not use IF(S(..., so we limit the things that can go awry
:-).It works on a 19BII.

It uses the same 5th degree polynomial approximation as your
BLK.SCHLS,7.4, just evaluated differently.


The first page of Solver shows, here on the 19BII:

PS  PE  RF%  S     T MORE
These are the five *inputs*.

The second page shows:


These are the 4 *outputs*. They are all calculated
simultaneously, by pressing CALLV. Then RCL PUTV shows PUTV
and likewise for D1 and D2. It is often useful to have D1 and
D2 available.**Only CALLV is "solved for"as such**. This is
the main difference - we don't first solve for CALLV and then
for PUTV, we just do the one solve.

NORM is a 5 element SUM List:

1      0.127414796
2 -0.142248368
3 0.710706871
4 -0.726576013
5 0.530702714
Total 0.500000000

SUM Lists are quite handy - here it reduces the typing required for the
equation quite a bit (by about a third) - maybe the nearest thing we have
to subroutines :-)

For the inputs: PS=52, RF%=.5, S=.2054 and T=6, and the various
PE you tabulate, this produces basically the same results you
list. RCL PUTV shows zero for the last 2 examples (PE=2 and
PE=1). Even for PE=13, RCL PUTV shows only 1 cent. For PE=47
D1 is .5121. PE=45 specifies the same example used on the HP
web site for the 17BII Black Scholes equation. The above
equation is similar to one given in my "Wronski" article in
DataFile. It does slow down Solver slightly as it is
calculating more than one output at once, and I don't know if
this is possible on the 17BII+ :-)


Possibly Related Threads…
Thread Author Replies Views Last Post
  17BII & 17BII+ Discounted Payback Period Revisited Tom Neudorfl 8 2,870 11-25-2013, 10:28 AM
Last Post: Don Shepherd
  HP PRIME - Bode and Black plots - first attempt dg1969 0 1,051 10-20-2013, 01:32 PM
Last Post: dg1969
  How much accuracy does one actually need? Matt Agajanian 23 5,743 08-26-2013, 12:46 PM
Last Post: Kimberly Thompson
  Creeping black pattern on HP-11C screen Larry Gagnon 6 2,098 04-12-2013, 10:09 AM
Last Post: Peter Murphy (Livermore)
  Estimating accuracy in finite precision computations mpi 17 4,350 02-22-2013, 09:44 AM
Last Post: mpi
  HP 12 C simple interest calcuation sam 6 2,018 01-16-2013, 10:22 AM
Last Post: fhub
  SpeedUI: Version 12.05 Holiday Edition released:-) Raymond Del Tondo 3 1,650 12-30-2012, 02:18 AM
Last Post: Han
  What are the most popular functions? (Poll until 18.12.) Walter B 62 12,525 12-18-2012, 08:18 AM
Last Post: Walter B
  HP 48GX with Black LCD - S/N ID Jeff Kearns 4 1,825 12-15-2012, 03:55 PM
Last Post: aurelio
  Happy 12/12/12 Day! Eddie W. Shore 6 1,968 12-15-2012, 11:18 AM
Last Post: Marcus von Cube, Germany

Forum Jump: