Message Boards Message Boards

0
|
5974 Views
|
3 Replies
|
2 Total Likes
View groups...
Share
Share this post:

P. Derivative of function with embedded functions // Black Scholes Formula

Posted 10 years ago

Hi all,

I'm having a hard time computing the Delta of a European Put option using Mathematica. For those not in finance, i'm basically trying to computer a partial derivative of a function containing two other functions. I am setting the appropriate functions but once I try to compute it is not working.

Any help will be greatly appreciated!

I am trying to get this answer by calculating the partial derivative S from this function: enter image description here

From this function

enter image description here

Once again I need to calculate: enter image description here Here is my code

dplus[S_, [Sigma]_, q_, r_, t_, T_, 
  k_] := ((T - t) (r - q + [Sigma]^2/2) + Log[S/k])/(
 Sqrt[T - t] [Sigma])

dminus[S_, [Sigma]_, q_, r_, t_, T_, k_] := 
 dplus[S, [Sigma], q, r, t, T, k] - [Sigma] Sqrt[-t + T] 

D[dplus[S, [Sigma], q, r, t, T, k ], S]
D[dminus[S, [Sigma], q, r, t, T, k ], S]

funtime[S_] := ( 
   Se^(-q (T - t)) [CapitalPhi] (dplus[S, [Sigma], q, r, t, T, 
      k ])) - (Ke^(-r (T - t)) [CapitalPhi] (dminus[S, [Sigma], q, 
      r, t, T, k ]))


D[funtime[S], S]

But I am getting:

(Se^(-q (-t + T)) [CapitalPhi])/(S Sqrt[-t + T] [Sigma]) - 
 Ke^(-r (-t + T)) 
!(*SuperscriptBox[([CapitalPhi]dminus), 
TagBox[
RowBox[{"(", 
RowBox[{"1", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", 
       "0"}], ")"}],
Derivative],
MultilineFunction->None])[S, [Sigma], q, r, t, T, k]

Can anyone explain what is going on? I can successfully get partial derivatives from the first 2 parameters (Dplus and Dminus), but once I try to get the partial derivative from my function, "funtime", it's not coming together. Any help will be greatly appreciated! I have attached my mathematica file for anyone trying to help.

Thanks!

Attachments:
POSTED BY: Warren Durrett
3 Replies
Posted 10 years ago

Great! Thank you very much Bill!

POSTED BY: Warren Durrett
Posted 10 years ago
POSTED BY: Warren Durrett
Posted 10 years ago

Replace

funtime[S_]:= (Se^(-q(T-t))\[CapitalPhi](dplus[S,\[Sigma],q,r,t,T,k]))-(Ke^(-r(T-t))\[CapitalPhi](dminus[S,\[Sigma],q,r,t,T,k]))

with

funtime[S_]:= (S*E^(-q(T-t))\[CapitalPhi](dplus[S,\[Sigma],q,r,t,T,k]))-(K*E^(-r(T-t))\[CapitalPhi](dminus[S,\[Sigma],q,r,t,T,k]))

I am also seeing phi' in Mathematica's result, but there are no ' in your pasted image at the top of your post, but that may just be typesetting or my misunderstanding of their notation.

POSTED BY: Bill Simpson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract