📄 defaultcvmeantest.java
字号:
/* WARANTY NOTICE AND COPYRIGHTThis program is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public Licenseas published by the Free Software Foundation; either version 2of the License, or (at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.Copyright (C) Michael J. Meyermatmjm@mindspring.comspyqqqdia@yahoo.com*//* * DefaultCVMeanTest.java * * Created on March 3, 2002, 10:00 PM */package Examples.ControlVariates;import Statistics.*;import Market.*;import Options.*;import java.lang.Math;/** <p>Console program testing wether our formula for the mean of the default * control variate (of an option) is correct. The analytic formula is compared * against the Monte Carlo mean. A very high dividend rate q=0.94 (94%) * is used to make sure dividends are accounted for properly.</p> * * <p>Note that the default control variate is independent of the option * which does not enter into the computation. A European call is used for * initialization.</p> * *<p>A fixed set of parameters (initial asset price S(0), volatility, ...) * is used. No interaction with the user. Change the parameters in the * source code and recompile if you must.</p> * * @author Michael J. Meyer */public class DefaultCVMeanTest{ public static void main(String[] args) { int T=50, nPaths=100000, nSignChange=5; double S_0=50, mu=0.24, sigma=0.31, q=0.94, r=0.07, K=55, dt=0.02; final ConstantVolatilityAsset asset=new ConstantVolatilityAsset(T,dt,nSignChange,S_0,r,q,mu,sigma); final Call call=new Call(K,asset); call.controlledDiscountedPayoff().controlVariateMeanTest(); }//end main }//end CallControlVariateTest
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -