Question: why i can not get the picture?

CEV_calloption.mw

NULL

K := 'K'; sigma := .2; tau := .25; s := 1; r := 0

1

 

.2

 

.25

 

1

 

0

(1)

d1 := proc (sigma) options operator, arrow; (ln(s/K)+(r+(1/2)*sigma^2)*tau)/(sigma*sqrt(tau)) end proc;

proc (sigma) options operator, arrow; (ln(s/K)+(r+(1/2)*sigma^2)*tau)/(sigma*sqrt(tau)) end proc

(2)

d1(.2);

0.5000000000e-1

(3)

d2 := proc (sigma) options operator, arrow; d1(sigma)-sigma*sqrt(tau) end proc;

proc (sigma) options operator, arrow; d1(sigma)-sigma*sqrt(tau) end proc

(4)

d2(.2);

-0.5000000000e-1

(5)

Phi := proc (x) options operator, arrow; (int(exp(-(1/2)*t^2), t = -infinity .. x))/sqrt(2*Pi) end proc;

proc (x) options operator, arrow; (int(exp(-(1/2)*t^2), t = -infinity .. x))/sqrt(2*Pi) end proc

(6)

f := proc (sigma) options operator, arrow; s*Phi(d1(sigma))-K*exp(-r*tau)*Phi(d2(sigma)) end proc;

proc (sigma) options operator, arrow; s*Phi(d1(sigma))-K*exp(-r*tau)*Phi(d2(sigma)) end proc

(7)

upsilon := proc (sigma) options operator, arrow; s*sqrt(tau)*exp(-(1/2)*d1(sigma)^2)/sqrt(2*Pi) end proc

proc (sigma) options operator, arrow; s*sqrt(tau)*exp(-(1/2)*d1(sigma^2))/sqrt(2*Pi) end proc

(8)

evalf(f(.2));

0.3987761168e-1

(9)

y := 1;

1

(10)

tau1 := sigma^2*tau/(2*y^2);

0.5000000000e-2

(11)

c := 1/tau1;

200.0000000

 

200.0000000

(12)

``

CEVfunc := proc (x, a, y, n) options operator, arrow; evalf(int(exp(-(1/4)*z^2/x)*z^n*BesselI(y, z), z = a .. infinity)) end proc;

proc (x, a, y, n) options operator, arrow; evalf(int(exp(-(1/4)*z^2/x)*z^n*BesselI(y, z), z = a .. infinity)) end proc

(13)

``

``

V := exp(-r*t-x)*(CEVfunc(x, 2*sqrt(c*x*K^(1/y)), y, y+1)/(x*c^y*2^(y+1))-K*(2*x)^(y-1)*CEVfunc(x, 2*sqrt(c*x*K^(1/y)), y, 1-y));

0.3988175536e-1

(14)

``

NULL

newton := proc (sigma) options operator, arrow; sigma-(f(sigma)-V)/upsilon(sigma) end proc;

proc (sigma) options operator, arrow; sigma-(f(sigma)-V)/upsilon(sigma) end proc

(15)

``

``

evalf((newton@@5)(.2));

.2000207955

(16)

plot((newton@@5)(.2), K = .7 .. 2)

Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct

 

 

``

 

Download CEV_calloption.mw

Please Wait...