19BII Program ---> need help!
01-04-2015, 06:51 PM
Post: #1
 Aconzio Junior Member Posts: 7 Joined: Jan 2015
19BII Program ---> need help!
Dear all

in searching for a program to make my HP19Bii able to calculate Calls ans Puts (plain vanilla Black&Scholes) I came to this little program (i.e. 3 different formulas) for Warrants, Calls and Puts calculation.
Now, I get an error message by the second largest and longest formula (for Warrants and simple Calls) at the point where the expressions reads"...2+.5:.5+(1+SQRT(PI))..."
Now I do not understand the logic at all and I'm not a programmer...can anyone of you help me in interpreting why 19Bii doesn't accept the expression (while having no problem with the iteration of the same string some passages later?
Many thanks!!
Aconzio[/quote]

Attached File(s)
HP19Bii.pdf (Size: 63.93 KB / Downloads: 25)
01-04-2015, 06:59 PM
Post: #2
 Luiz C. Vieira Junior Member Posts: 8 Joined: Jan 2015
RE: 19BII Program ---> need help!
Hi.

Can you specify what error message?

Cheers.
Luiz
01-04-2015, 07:00 PM
Post: #3
 Gene Moderator Posts: 992 Joined: Dec 2013
RE: 19BII Program ---> need help!
That is at the point in the formula where the "else" is computed in the IF(ABS(... part of that formula.

I have to suspect some sort of missing ( or ) or , or : someplace in the formula before that point.

Is there any chance you could post pictures of the formula as you have it typed in the 19BII from the beginning to that point? That might help.
01-04-2015, 07:03 PM
Post: #4
 Gerson W. Barbosa Senior Member Posts: 1,289 Joined: Dec 2013
RE: 19BII Program ---> need help!
Have you changed radix to "," after editing the formula?
01-04-2015, 07:05 PM
Post: #5
 Aconzio Junior Member Posts: 7 Joined: Jan 2015
RE: 19BII Program ---> need help!
(01-04-2015 06:59 PM)Luiz C. Vieira Wrote:  Hi.

Can you specify what error message?

Cheers.
Luiz

Wow! that was quick!
Good morning Luiz! (I imagine you are at the other side of the Atlantic whil I'm in Switzerland...
The message comes from having the famous "beep" when the Solver cannot
process a formula and stacks as he cannot read further...
The calculator points to the semicolon...(this expressions appears a second time a bit later in the formula and for that it seems to beno problem..I substituted the semicolon with a division sign and the formula runs but I'm afraid wrongly....)...
Many thanks!!
Aconzio
01-04-2015, 07:18 PM (This post was last modified: 01-04-2015 07:21 PM by Luiz C. Vieira.)
Post: #6
 Luiz C. Vieira Junior Member Posts: 8 Joined: Jan 2015
RE: 19BII Program ---> need help!
HI. (yep, I'm in Brazil; cheers!)

I guess in Brazil we think alike... I'd go for Gerson's (a countrymate, Hi, Gerson!), I thought the same as him. Just would like to know if the message would corroborate or not.

(I see now Gene's message, would go for his, too)

Success!
01-04-2015, 07:36 PM (This post was last modified: 01-04-2015 07:40 PM by Gerson W. Barbosa.)
Post: #7
 Gerson W. Barbosa Senior Member Posts: 1,289 Joined: Dec 2013
RE: 19BII Program ---> need help!
(01-04-2015 07:18 PM)Luiz C. Vieira Wrote:  HI. (yep, I'm in Brazil; cheers!)

I guess in Brazil we think alike... I'd go for Gerson's (a countrymate, Hi, Gerson!), I thought the same as him. Just would like to know if the message would corroborate or not.

Success!

Olá, Luiz!

Welcome back!

I remember I had a similar problem on my HP-17B II. After switching to comma I started receiving error messages exactly at that same constant. It turns out the 17B II doesn't convert dots to commas in this case. Then I simply changed .5 to INV(2). I don't know if this also happens on the 19B though.

Gerson.

P.S.: Please keep that board if you still have it :-)
01-04-2015, 08:00 PM
Post: #8
 Aconzio Junior Member Posts: 7 Joined: Jan 2015
RE: 19BII Program ---> need help!
Hallo everybody!

This is amazing...thank you so much for your support..
Still be patient with me as as said I'm not a programmer ..
I only know that all values should be entered without spaces!! That's all!
..and ...I'm using a forum for the very first time!...;-))

For Gene:
I cannot value where the "if, then" logic syntax starts or ends...I'v tried to
catch a photo...hopefully you can see even the cursor blinking on the semicolon!!

For Gerson

so you suggest to change all ".5" into "INV(2)"?--I'll try...

REgards and thanks!!

Attached File(s) Thumbnail(s)

01-04-2015, 08:55 PM (This post was last modified: 01-04-2015 08:58 PM by Gerson W. Barbosa.)
Post: #9
 Gerson W. Barbosa Senior Member Posts: 1,289 Joined: Dec 2013
RE: 19BII Program ---> need help!
(01-04-2015 08:00 PM)Aconzio Wrote:  For Gerson

so you suggest to change all ".5" into "INV(2)"?--I'll try...

That might be needed, or the change to ,5, only if you had edited the equation then left the solver editor and then switched radix to comma. It doesn't appear to be the case. It might be simply a typo, has Gene has suggested. I tried the equation in the HP-200LX and got a blinking cursor exactly at the same point.

Here is the equation (not checked) in text format, in case someone wants to try fixing it on the HP-200LX:

Code:
 ((P+M/N*W)*IF(ABS(D)>3.5:0:SGN(D)/2+.5:.5+(1/SQRT(PI))*SIGMA( I:1:15:1:-(D/SQRT(2))^(2*I-1)*(-1)^I/(FACT(I-1)*(2*I-1))))-X* EXP*(-R*T)*IF(ABS(D-SD*SQRT(T))>3.5:SGN(D-SD*SQRT(T))/2+.5:.5 +(1/SQRT(PI))*SIGMA(I:1:15:1:-((D-SD*SQRT(T))/SQRT(2))^(2*I-1) *(-1)^I/(FACT(I-1)*(2*I-1)))))/(1+M/N)=WARR

Regards,

Gerson.
01-04-2015, 09:19 PM
Post: #10
 Aconzio Junior Member Posts: 7 Joined: Jan 2015
RE: 19BII Program ---> need help!
(01-04-2015 08:55 PM)Gerson W. Barbosa Wrote:
(01-04-2015 08:00 PM)Aconzio Wrote:  For Gerson

so you suggest to change all ".5" into "INV(2)"?--I'll try...

That might be needed, or the change to ,5, only if you had edited the equation then left the solver editor and then switched radix to comma. It doesn't appear to be the case. It might be simply a typo, has Gene has suggested. I tried the equation in the HP-200LX and got a blinking cursor exactly at the same point.

Here is the equation (not checked) in text format, in case someone wants to try fixing it on the HP-200LX:

Code:
 ((P+M/N*W)*IF(ABS(D)>3.5:0:SGN(D)/2+.5:.5+(1/SQRT(PI))*SIGMA( I:1:15:1:-(D/SQRT(2))^(2*I-1)*(-1)^I/(FACT(I-1)*(2*I-1))))-X* EXP*(-R*T)*IF(ABS(D-SD*SQRT(T))>3.5:SGN(D-SD*SQRT(T))/2+.5:.5 +(1/SQRT(PI))*SIGMA(I:1:15:1:-((D-SD*SQRT(T))/SQRT(2))^(2*I-1) *(-1)^I/(FACT(I-1)*(2*I-1)))))/(1+M/N)=WARR

Regards,

Gerson.

Hy Gerson

Thank you for having re-written the code ..
As you said, substituting the INV(2) or changing radix doesn’t change the problem..the calculator points to the colon to be a point…
Regards!
Aconzio
01-04-2015, 09:30 PM (This post was last modified: 01-04-2015 09:44 PM by Gerson W. Barbosa.)
Post: #11
 Gerson W. Barbosa Senior Member Posts: 1,289 Joined: Dec 2013
RE: 19BII Program ---> need help!
(01-04-2015 09:19 PM)Aconzio Wrote:
(01-04-2015 08:55 PM)Gerson W. Barbosa Wrote:  That might be needed, or the change to ,5, only if you had edited the equation then left the solver editor and then switched radix to comma. It doesn't appear to be the case. It might be simply a typo, has Gene has suggested. I tried the equation in the HP-200LX and got a blinking cursor exactly at the same point.

Here is the equation (not checked) in text format, in case someone wants to try fixing it on the HP-200LX:

Code:
 ((P+M/N*W)*IF(ABS(D)>3.5:0:SGN(D)/2+.5:.5+(1/SQRT(PI))*SIGMA( I:1:15:1:-(D/SQRT(2))^(2*I-1)*(-1)^I/(FACT(I-1)*(2*I-1))))-X* EXP*(-R*T)*IF(ABS(D-SD*SQRT(T))>3.5:SGN(D-SD*SQRT(T))/2+.5:.5 +(1/SQRT(PI))*SIGMA(I:1:15:1:-((D-SD*SQRT(T))/SQRT(2))^(2*I-1) *(-1)^I/(FACT(I-1)*(2*I-1)))))/(1+M/N)=WARR

Regards,

Gerson.

Hy Gerson

Thank you for having re-written the code ..
As you said, substituting the INV(2) or changing radix doesn’t change the problem..the calculator points to the colon to be a point…
Regards!
Aconzio

The following returns no error, but has yet to be checked:

Code:
 ((P+M/N*W)*IF(ABS(D)>3.5:SGN(D)/2+.5:.5+(1/SQRT(PI))*SIGMA(I: 1:15:1:-(D/SQRT(2))^(2*I-1)*(-1)^I/(FACT(I-1)*(2*I-1))))-X* EXP*(-R*T)*IF(ABS(D-SD*SQRT(T))>3.5:SGN(D-SD*SQRT(T))/2+.5:.5 +(1/SQRT(PI))*SIGMA(I:1:15:1:-((D-SD*SQRT(T))/SQRT(2))^(2*I-1 )*(-1)^I/(FACT(I-1)*(2*I-1)))))/(1+M/N)=WARR

I have assumed :0 after the first 3.5 shouldn't be there, but I may of course be wrong.

Regards,

Gerson.
01-04-2015, 09:42 PM
Post: #12
 Bill (Smithville NJ) Senior Member Posts: 410 Joined: Dec 2013
RE: 19BII Program ---> need help!
IF(ABS(D)>3.5:0:SGN(D)/2+.5:.5+(1/SQRT(PI))*

When I look at the IF statement above, there are too many parts to it.

IF should be of the form:

IF (condition expression : algebraic expression : algebraic expression)

Your equation has a third colon in the IF statement.

Bill
01-04-2015, 09:48 PM (This post was last modified: 01-04-2015 09:48 PM by Don Shepherd.)
Post: #13
 Don Shepherd Senior Member Posts: 713 Joined: Dec 2013
RE: 19BII Program ---> need help!
(01-04-2015 09:19 PM)Aconzio Wrote:
(01-04-2015 08:55 PM)Gerson W. Barbosa Wrote:  That might be needed, or the change to ,5, only if you had edited the equation then left the solver editor and then switched radix to comma. It doesn't appear to be the case. It might be simply a typo, has Gene has suggested. I tried the equation in the HP-200LX and got a blinking cursor exactly at the same point.

Here is the equation (not checked) in text format, in case someone wants to try fixing it on the HP-200LX:

Code:
 ((P+M/N*W)*IF(ABS(D)>3.5:0:SGN(D)/2+.5:.5+(1/SQRT(PI))*SIGMA( I:1:15:1:-(D/SQRT(2))^(2*I-1)*(-1)^I/(FACT(I-1)*(2*I-1))))-X* EXP*(-R*T)*IF(ABS(D-SD*SQRT(T))>3.5:SGN(D-SD*SQRT(T))/2+.5:.5 +(1/SQRT(PI))*SIGMA(I:1:15:1:-((D-SD*SQRT(T))/SQRT(2))^(2*I-1) *(-1)^I/(FACT(I-1)*(2*I-1)))))/(1+M/N)=WARR

Regards,

Gerson.

Hy Gerson

Thank you for having re-written the code ..
As you said, substituting the INV(2) or changing radix doesn’t change the problem..the calculator points to the colon to be a point…
Regards!
Aconzio

That colon where the error occurs is invalid there. It occurs while the solver is evaluating the else portion of the IF statement. The equation as listed in the source document is in error, it's nothing you did.

It's like this: IF(condition:0: else other stuff it needs a ) to terminate the IF, a third colon in an IF statement is invalid.

See if you can contact whomever wrote the original equation, I think they copied it wrongly.

Bill beat me to it!
01-04-2015, 10:18 PM
Post: #14
 Aconzio Junior Member Posts: 7 Joined: Jan 2015
RE: 19BII Program ---> need help!
Hallo everybody!

You are absolutely right!
I eliminated the redundant “:0” from the formula that now works delivering correct results!!

What can I say?
You all are geniuses!! I’m impressed!

Someone should write an email to Wiley as their published
Arzac, Enrique R, “Valuation for Mergers, Buyouts, and Restructuring”, Second Edition, (2007) ISBN: 9780470128893 contains this error in the Appendix A.

Once again thank you to all of you!

Regards!!

Aconzio
01-04-2015, 11:18 PM
Post: #15
 Don Shepherd Senior Member Posts: 713 Joined: Dec 2013
RE: 19BII Program ---> need help!
(01-04-2015 10:18 PM)Aconzio Wrote:  Hallo everybody!

You are absolutely right!
I eliminated the redundant “:0” from the formula that now works delivering correct results!!

What can I say?
You all are geniuses!! I’m impressed!

Someone should write an email to Wiley as their published
Arzac, Enrique R, “Valuation for Mergers, Buyouts, and Restructuring”, Second Edition, (2007) ISBN: 9780470128893 contains this error in the Appendix A.

Once again thank you to all of you!

Regards!!

Aconzio

Aconzio, you should write them so others won't experience this problem.
01-05-2015, 08:40 PM
Post: #16
 Aconzio Junior Member Posts: 7 Joined: Jan 2015
RE: 19BII Program ---> need help!
Hallo Don
Yes, I'll do it..
Thank you once again to you all and
Regards!!

Aconzio
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)