Black-Scholes on 17bII+, accurate to 5th decimal place



#2

Thanks to Tony Hutchins for the idea of using an intermediate variable and nesting divisions.

This Black-Scholes formula relies on a 5th order polynomial approximation. The worst case scenario, given below, is till accurate to 5 decimal places.

Enter PS, PE, RF%, S, T, then "MORE", then "SOLVE", then "CALLV", and if needed, "PUTV"

I had stopped working on this, waiting for the new 17bII+ ROM. But now that we know L() and G() don't work, I decided I should post this for anyone who wants a relatively accurate and fast Black-Scholes.

I'll post another VERY accurate version using Taylor series, as suggested by Tizedes Csaba. But that version is VERY VERY SLOW. Takes over a minute to execute.

PS=68
PE=29
Rf%=.5
T=6
S=.2054
Exact Call = 40.2016616074
Formula = 40.2016671122
Exact Put = .344582080329
Formula = .3445875851

Abramowitz and Stegun 7.1.26 HP17BII+
Character Count: 679
BLK.SCHLS.5TH.SOLVE:
0×(PS+PE+RF%+T+S)
+IF(S(SOLVE):(LN(PS÷PE)+(RF%÷100+S^2÷2)×T)÷S÷SQRT(T)-SOLVE:
IF(S(CALLV):
PS×ABS(
IF(SOLVE<0:0:-1)
+((((1.061405429
÷(1+.2316419×ABS(SOLVE))-1.453152027)
÷(1+.2316419×ABS(SOLVE))+1.421413741)
÷(1+.2316419×ABS(SOLVE))-.284496736)
÷(1+.2316419×ABS(SOLVE))+.254829592)
÷(1+.2316419×ABS(SOLVE))
×EXP(-(SOLVE^2)÷2)÷2)
–PE×EXP(-RF%×T÷100)×ABS(
IF(SOLVE-S×SQRT(T)<0:0:-1)
+((((1.061405429
÷(1+.2316419×ABS(SOLVE-S×SQRT(T)))-1.453152027)
÷(1+.2316419×ABS(SOLVE-S×SQRT(T)))+1.421413741)
÷(1+.2316419×ABS(SOLVE-S×SQRT(T)))-.284496736)
÷(1+.2316419×ABS(SOLVE-S×SQRT(T)))+.254829592)
÷(1+.2316419×ABS(SOLVE-S×SQRT(T)))
×EXP(-((SOLVE-S×SQRT(T))^2)÷2)÷2)
-CALLV:
-PS+PE×EXP(-RF%×T÷100)+CALLV-PUTV))


#3

Thanks, Bob.

I wonder if HP let out L and G, in the first 17 batch so maybe to "match" the solver in the 49 series?

#4

Let me be a bit of an iconoclast:

I'm no expert on Black-Scholes (or any other formulae which purport to calculate the future value of investments), but it seems to me that no matter what you calculate, the actual results of an investment depend on the true-life variability of the market - which can not be modelled all that accurately! I therefore doubt that even 5-digit precision is necessary in such calculations.

It's like my physics students who continually provide 10 digit "answers" (because that's what the calculator reports) to problems with only one or two significant figures!


#5

Quote:
It's like my physics students who continually provide 10 digit "answers" (because that's what the calculator reports) to problems with only one or two significant figures!

That's one of the nice things about slide rules; it's pretty hard to learn to use one properly without also learning the importance of significant digits, and the difference between precision and accuracy. It's also pretty hard to come up with a 10-digit answer! (Well, at least without "cheating" and using a book of log tables. :-)

I remember my own physics teacher, back in 1973, giving us the "precision vs. accuracy" lecture when one of those new-fangled calculators had the temerity to show up in her classroom...

#6

Dave:

These formulae are not intended for real world use. Think of them as "proof of concept" exercises. Just as I am amazed by Hutchins, Derenzo and Carr, I hope SOMEBODY, besides myself, finds these formulae interesting ;-)

Bob

P.S. *IF* HP financial calculators had UTPN, Black-Scholes could be implemented to the limit of machine accuracy. However, such an exercise would also be trivial and uninteresting.


Possibly Related Threads…
Thread Author Replies Views Last Post
  17BII & 17BII+ Discounted Payback Period Revisited Tom Neudorfl 8 3,008 11-25-2013, 10:28 AM
Last Post: Don Shepherd
  HP PRIME - Bode and Black plots - first attempt dg1969 0 1,080 10-20-2013, 01:32 PM
Last Post: dg1969
  A place for Prime programs steindid 3 1,389 10-01-2013, 05:01 PM
Last Post: Guenter Schink
  wp34s (Why it's so accurate) Barry Mead 22 5,623 08-05-2013, 08:51 AM
Last Post: fhub
  Binary versus Decimal prefixes bill platt 22 5,423 04-27-2013, 11:22 AM
Last Post: Walter B
  Creeping black pattern on HP-11C screen Larry Gagnon 6 2,185 04-12-2013, 10:09 AM
Last Post: Peter Murphy (Livermore)
  Decimal/Binary Conversions for the HP 39gii - 3/16/2013 Eddie W. Shore 0 962 03-16-2013, 04:30 PM
Last Post: Eddie W. Shore
  HP 48GX with Black LCD - S/N ID Jeff Kearns 4 1,885 12-15-2012, 03:55 PM
Last Post: aurelio
  33s Decimal Point Matt Agajanian 4 1,894 11-06-2012, 09:20 PM
Last Post: Matt Agajanian
  Obtaining More Decimal Digits (50g) Eddie W. Shore 3 1,592 09-13-2012, 05:38 PM
Last Post: Gilles Carpentier

Forum Jump: