Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'option pricing' topicStudent Support Forum > General > "option pricing"

< Previous CommentHelp | Reply To Comment | Reply To Topic
Author Comment/Response
jf
08/30/12 11:49am

Did you notice the warning message,
SetDelayed::write: "Tag Norm in Norm[x_] is Protected."

Norm is a built-in function. When the N is changed to lower-case, the code works.
====
norm[x_]:=CDF[NormalDistribution[0,1],x];

d1[k_,T_,r_,sigma_,deta_,s_,t_]:={Log[s/k]+(r-deta+0.5*sigma^2)*(T-t)}/sigma/Sqrt[T-t];

d2[k_,T_,r_,sigma_,deta_,s_,t_]:={Log[s/k]+(r-deta-0.5*sigma^2)*(T-t)}/sigma/Sqrt[T-t];

c[k_,T_,r_,sigma_,deta_,s_,t_]:=s*Exp[-deta*(T-t)]*norm[d1[k,T,r,sigma,deta,s,t]]-k*Exp[-r*(T-t)]*norm[d2[k,T,r,sigma,deta,s,t]];

Manipulate[Plot[c[40,1,0.08,0.3,0,s,t],{s,1,70},PlotRange->{{0,70},{0,50}}],{t,1/12,11/12}]
====



URL: ,

Subject (listing for 'option pricing')
Author Date Posted
option pricing Tony 08/29/12 08:24am
Re: option pricing jf 08/30/12 11:49am
< Previous CommentHelp | Reply To Comment | Reply To Topic