Avoid problems with a triple integration? (Pricing of exotic options)

GROUPS:
 Hi,I'm a new user of Mathematica and I'm writing a thesis on financial models to price options. I'm currently trying to calculate a triple integral in order to price an exotic call european option (basket option) on a basket of 3 financial assets (S1,S2 and S3) with weights of w1, w2 and w3. So my basket is w1.S1+w2.S2+w3.S3. Here is the formula :And this is the code that I tried (attached), but it finds a price that makes no sense... (with Rf the risk free rate, dt the maturity, n the number of assets, Sigma1 the volatility of the 1st asset, K the strike of my option, ΩT.Ω = VCV the variance-covariance 3x3 matrix of the assets)Thank you for your help ! Best regards, Nicolas Attachments:
1 year ago
7 Replies
 I'm not able to run that notebook (n access to the xlsx files).
1 year ago
1 year ago
 Hi, sorry about the rules, here is my code (i hope the format is okay now). Please find also attached the two excel files I used in the code (Omega and InvOmegaTOmega) Rf = 0.0092 0.0092 dt = 0.25 0.25 n = 3 3 w1 = 1/3 1/3 w2 = 1/3 1/3 w3 = 1/3 1/3 S1 = 5101.11 5101.11 S2 = 2343.06 2343.06 S3 = 18552.61 18552.6 Sigma1 = 5.05615635/100 0.0505616 Sigma2 = 18.18926835/100 0.181893 Sigma3 = 15.25262228/100 0.152526 s1 = Import[ "/Users/nicolasbaduel/Documents/Wolfram Mathematica/Omega.xlsx"] {{{0.0506, 0.130786, 0.06893}, {0., 0.126422, 0.0671455}, {0., 0., 0.118306}}} s1 = Import[ "/Users/nicolasbaduel/Documents/Wolfram Mathematica/Omega.xlsx", \ {"Data", 1, {1, 2, 3}}] {{0.0506, 0.130786, 0.06893}, {0., 0.126422, 0.0671455}, {0., 0., 0.118306}} s2 = Import[ "/Users/nicolasbaduel/Documents/Wolfram \ Mathematica/InvOmegaTOmega.xlsx", {"Data", 1, {1, 2, 3}}] {{808.576, -162.12, 0.752924}, {-162.12, 82.7225, -37.947}, {0.752924, -37.947, 71.447}} Omega = s1 {{0.0506, 0.130786, 0.06893}, {0., 0.126422, 0.0671455}, {0., 0., 0.118306}} InvOmegaTOmega = s2 {{808.576, -162.12, 0.752924}, {-162.12, 82.7225, -37.947}, {0.752924, -37.947, 71.447}} Omega {{0.0506, 0.130786, 0.06893}, {0., 0.126422, 0.0671455}, {0., 0., 0.118306}} Zeta1 = Log[x1/(w1*S1)] - (Rf - ((Sigma1)^2)/2)*dt -0.00198044 + Log[0.000588107 x1] Zeta2 = Log[x2/(w2*S2)] - (Rf - ((Sigma2)^2)/2)*dt 0.00183562 + Log[0.00128038 x2] Zeta3 = Log[x3/(w3*S3)] - (Rf - ((Sigma3)^2)/2)*dt 0.000608031 + Log[0.000161702 x3] VectZeta = {{Zeta1}, {Zeta2}, {Zeta3}}; K = 8665.59 8665.59 Transpose[VectZeta].InvOmegaTOmega.VectZeta {{(0.00183562 + Log[0.00128038 x2]) (-162.12 (-0.00198044 + Log[0.000588107 x1]) + 82.7225 (0.00183562 + Log[0.00128038 x2]) - 37.947 (0.000608031 + Log[0.000161702 x3])) + (-0.00198044 + Log[0.000588107 x1]) (808.576 (-0.00198044 + Log[0.000588107 x1]) - 162.12 (0.00183562 + Log[0.00128038 x2]) + 0.752924 (0.000608031 + Log[0.000161702 x3])) + (0.000608031 + Log[ 0.000161702 x3]) (0.752924 (-0.00198044 + Log[0.000588107 x1]) - 37.947 (0.00183562 + Log[0.00128038 x2]) + 71.447 (0.000608031 + Log[0.000161702 x3]))}} g := Function[{x1, x2, x3}, Max[x1 + x2 + x3 - K, 0]*((Exp[(-0.5/dt)*(0.00183562 + Log[0.00128038 x2]) (-162.12 (-0.00198044 + Log[0.000588107 x1]) + 82.7225 (0.00183562 + Log[0.00128038 x2]) - 37.947 (0.000608031 + Log[0.000161702 x3])) + (-0.00198044 + Log[0.000588107 x1]) (808.576 (-0.00198044 + Log[0.000588107 x1]) - 162.12 (0.00183562 + Log[0.00128038 x2]) + 0.752924 (0.000608031 + Log[0.000161702 x3])) + (0.000608031 + Log[0.000161702 x3]) (0.752924 (-0.00198044 + Log[0.000588107 x1]) - 37.947 (0.00183562 + Log[0.00128038 x2]) + 71.447 (0.000608031 + Log[0.000161702 x3]))])/(Omega[[1, 1]] Omega[[2, 2]] Omega[[3, 3]]*x1*x2*x3*((2*Pi*dt)^(n/2))))] NIntegrate[ g[x1, x2, x3], {x1, 0, Infinity}, {x2, 0, Infinity}, {x3, 0, Infinity}] 3.570889416597262*10^300946  Attachments:
1 year ago
 Daniel Lichtblau 2 Votes As best I can tell this reduces to the computation below. NIntegrate[(671.1784345137916*E^(-2.*(0.00183562 + Log[0.00128038*x2])* (-162.12*(-0.00198044 + Log[0.000588107*x1]) + 82.7225*(0.00183562 + Log[0.00128038*x2]) - 37.947*(0.000608031 + Log[0.000161702*x3])) + (-0.00198044 + Log[0.000588107*x1])* (808.576*(-0.00198044 + Log[0.000588107*x1]) - 162.12*(0.00183562 + Log[0.00128038*x2]) + 0.752924*(0.000608031 + Log[0.000161702*x3])) + (0.000608031 + Log[0.000161702*x3])* (0.752924*(-0.00198044 + Log[0.000588107*x1]) - 37.947*(0.00183562 + Log[0.00128038*x2]) + 71.447*(0.000608031 + Log[0.000161702*x3])))*Max[0, -8665.59 + x1 + x2 + x3])/ (x1*x2*x3), {x1, 0, Infinity}, {x2, 0, Infinity}, {x3, 0, Infinity}] Creating a table of values in the ranges of 0 to 10000 in steps of 2000 for each variable will show that the result is not implausible. So either there are bad evaluations e.g. from cancellation error in machine arithmetic, or else the underlying integral is not what was wanted. Changing the values from machine numbers to exact nearby rationals, and evaluating at high precision, I get results consistent with the machine precision results. This makes me suspect numeric error is not the issue.