我想我可能已经在这个问题上瞎了一把。它不应该那么难。VBA中的概率函数和括号
我已经使方程的所有组成部分独立工作,但有些不起作用 - 是我的变量声明或函数本身?
现在,我只是试图得到它的输出数量:/
此功能工作正常
Function d(K, a1, b1)
d = (-Log(K) + a1 + b1 * b1)/b1
End Function
这一个没有(这两个功能都包含在同一模块中):
Function LN_Call(r As Double, t As Double, K As Double, w As Double, a1 As Double, b1 As Double, a2 As Double, b2 As Double) As Double
Dim d1 As Double
Dim d2 As Double
Dim d3 As Double
Dim d4 As Double
Dim temp1 As Double
Dim temp2 As Double
Dim result As Double
d1 = d(K, a1, b1)
d2 = d1 - b1
d3 = d(K, a1, b1)
d4 = d3 - b2
temp1 = Exp(a1 + b1 * b1/2)
temp2 = Exp(a2 + b2 * b2/2)
LN_Call = Exp(-r * t) * (w * (temp1 * Application.WorksheetFunction.NormSDist(d1) - K * Application.WorksheetFunction.NormSDist(d2)) + (1 - w) * (temp2 * Application.WorksheetFunction.NormSDist(d3) - K * Application.WorksheetFunction.NormSDist(d4)))
End Function
你能告诉我什么是错的吗?
它究竟如何不工作? –