[Scilab-users] ”Too complex recursion”
fujimoto2005
fujimoto2005 at gmail.com
Tue May 19 11:22:42 CEST 2015
Hello,Serge Steer
My user function does't call 'intg'.
The following is a sample code for a demo.
But I have another error message.
************************
clear
function rt=payoffFunc(fxSpot,fxTriger,fxFixed)
if fxSpot<=10 then
fxSpot=10
end
rt=(fxFixed -fxSpot)
if fxSpot <= fxTriger then
rt=(fxSpot -(fxTriger^2)/fxSpot)*3
end
endfunction
function rt=payoffDenFunc(x,t,fxValDate,fxTriger,fxFixed,mu,vol)
f1=fxValDate*%e^x;
pl=payoffFunc(f1,fxTriger,fxFixed);
vrt=t^0.5*vol;
z=(x-mu)/vrt;
dens=1/(sqrt(2*%pi))*%e^(-0.5*z^2)/vrt;
rt=pl*dens;
endfunction
vol=0.09
fxTriger=95
fxFixed=150
fxValDate=100
payD_V=0.0602739726027397
discY_V=0.999747607575612
discD_V=0.996743237517026
mu=log(discD_V/discY_V)/payD_V;
xTrig_V=log(fxTriger./fxValDate)
xmin_V=(mu-0.5*vol^2)*payD_V-4*vol*sqrt(payD_V)
if xmin_V>xTrig_V then
xmin_V=xTrig_V-%eps
end
plCtrlEX1=intg(xmin_V,xTrig_V-%eps,list('payoffDenFunc',payD_V,fxValDate,fxTriger,fxFixed,mu,vol));
--
View this message in context: http://mailinglists.scilab.org/Too-complex-recursion-tp4032303p4032306.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
More information about the users
mailing list