I'm writing a simple Mathematica implementation of the black-scholes model and using Plot3D to plot the pricing surface. However, when I run this code, no plot is produced. My call and put functions to produce correct values when run separately, but no plot is produced. Code:
Clear[d1, d2, call, put, stockPrice, strikePrice, riskFreeRate, timeToExp, volatility]
d1[stockPrice_, strikePrice_, riskFreeRate_, timeToExp_, volatility_] := (Log[stockPrice / strikePrice] + (riskFreeRate + 0.5*volatility^2)*timeToExp) / (volatility * Sqrt[timeToExp])
d2[stockPrice_, strikePrice_, riskFreeRate_, timeToExp_, volatility_] := d1[stockPrice, strikePrice, riskFreeRate, timeToExp, volatility] - volatility*Sqrt[timeToExp]
call[stockPrice_, strikePrice_, riskFreeRate_, timeToExp_,
volatility_] := stockPrice * CDF[NormalDistribution[0, 1], d1[stockPrice, strikePrice, riskFreeRate, timeToExp, volatility]] - strikePrice * Exp[-riskFreeRate*timeToExp] *CDF[NormalDistribution[0, 1], d2[stockPrice, strikePrice, riskFreeRate, timeToExp, volatility]]
Plot3D[call[stockPrice, 500, 0.0030, timeToExp, 0.39], {stockPrice,
10, 1000}, {timetoExp, 0.0833333, 5}]
Other plots, like this sample from the reference, do work.
Plot3D[{x^2 + y^2, -x^2 - y^2}, {x, -2, 2}, {y, -2, 2},
RegionFunction -> Function[{x, y, z}, x^2 + y^2 <= 4],
BoxRatios -> Automatic]