11 2013 档案

摘要:int* getPtrToFive(){ int* x = new int; *x = 5; return &x; }void main(){ int* p = getPtrToFive(); cout<<*p<<endl; delete p; }从MIT 公开课的一个课件看到的。 如果在 getPtrToFive里面不用指针,只是让 x = 5; return &x 那么在main函数里面将无法返回5这个值,因为变量定义域的问题。 阅读全文
posted @ 2013-11-26 23:57 LevyFan 阅读(100) 评论(0) 推荐(0) 编辑
摘要:@Echo ONSet Launcher="C:\xxx\xx.exe"set Config="C:\xxx\CLIP.cfg"set TargetPath=C:\temp\set LaunchFile=Calculator.xlsECHO hostnameHostname | find "Loc" >NULIf not errorlevel 1 GOTO Loc:Locset LaunchPath=\\xxx\GOTO CALLAPP:CALLAPPECHO F| xcopy "%LaunchPath%%Launch 阅读全文
posted @ 2013-11-26 17:58 LevyFan 阅读(323) 评论(0) 推荐(0) 编辑
摘要:Set wbCur = ActiveWorkbookSet objExcel = CreateObject("Excel.application")For i = 1 To nbDay today = Range("contribStart").Offset((i - 1) * nbCFPerDay + 1, 0) year = Application.WorksheetFunction.Text(today, "yyyy") monthAndDay = Application.WorksheetFunction.Text(today 阅读全文
posted @ 2013-11-26 17:05 LevyFan 阅读(688) 评论(0) 推荐(0) 编辑
摘要:二维数组内存定义// allocationint** array = new int *[iSizeY]for( int j = 0; j < iSizeY; j++){ array[j] = new int [iSizeX];}// deallocationfor( int j = 0; j < iSizeY; j++){ delete [] array[j];}delete []array二维数组作为函数参数http://www.cnblogs.com/Anker/archive/2013/03/09/2951878.html 阅读全文
posted @ 2013-11-12 12:00 LevyFan 阅读(169) 评论(0) 推荐(0) 编辑
摘要:1) 出现连续两次正面朝上的期望次数 假设期望次数为 x x = 2 * 1/4 + (2+x)* 1/4 + (x+1) * 1/2 => x = 6 解释: 如果前两次均是正面朝上, p = 1/4,次数= 2; 如果第一次为正, 第二次为反,概率为 1/4, 总需要的次数为 x+2; 如果第一次为反, 概率为1/2, 总需要的次数为 x+1.2) 出现连续三次正面朝上的期望次数 假设期望次数为 x x = 3 * 1/8 + (1+ x) *1/2 + (2+x) * 1/4 + (x + 3) * 1/8 => x = 14 阅读全文
posted @ 2013-11-10 16:09 LevyFan 阅读(1064) 评论(0) 推荐(0) 编辑
摘要:exchange value of a and ba = a + bb = a - ba = a - b 阅读全文
posted @ 2013-11-10 15:40 LevyFan 阅读(140) 评论(0) 推荐(0) 编辑
摘要:问题: 一个硬币, 出现正面的概率为p, 出现反面的概率为 1-p, p !=1/2. 如何制造一个公平的“硬币”。解答: 利用条件概率公式 => P(first coin is head | both coins are different) = p (1-p) / (2p(1-p)) = 1 / 2.同理可知 P(first coin is tail | both coins are different) = p (1-p) / (2p(1-p)) = 1 / 2.所以一个公平的硬币应该是:不停的反转直到连续两次是一正一反,然后看倒数第二次的面向reference: http://s 阅读全文
posted @ 2013-11-10 15:36 LevyFan 阅读(258) 评论(0) 推荐(0) 编辑
摘要:Denote g(St ) as the density function of St 看涨欧式期权的价值 C = exp(-r*T) ∫K∞(ST - K)g(ST )dST把上述等式对K求二阶导数, 可得 g(K ) = exp(r*T)∂2C/∂K2 (*)(*)式的一个意义就是butter fly 期权的价值为正 阅读全文
posted @ 2013-11-07 09:25 LevyFan 阅读(391) 评论(0) 推荐(0) 编辑
摘要:一些比较重要的定理公式1) If P and Q are equivalent measures, and Xt is an Ft-adapted process then the followingresults hold: EQ (Xt) = EP (Xt dQ/dP)2) Define dQ/dP = exp( - ∫Θdw-1/2∫Θ2du), denote WP is a BM under measure P, then WtQ = WtP +∫0tΘ du is a BM under measure Q 阅读全文
posted @ 2013-11-06 11:23 LevyFan 阅读(1250) 评论(0) 推荐(0) 编辑
摘要:找到贴吧一个证明 用夹逼定理http://tieba.baidu.com/p/1300488932# 阅读全文
posted @ 2013-11-04 16:13 LevyFan 阅读(2756) 评论(0) 推荐(0) 编辑