Serving the Quantitative Finance Community

 
User avatar
Polter
Posts: 1
Joined: April 29th, 2008, 4:55 pm

help, symbolic math processing script

October 14th, 2011, 9:29 pm

Awesome!BTW,s/boost::math::constants::root_two_pi<T>/boost::math::constants::root_two_pi<RealType> :-)// and (that's very tiny, solely a matter of taste and absolutely up to you) perhaps define RealType ret before nu, functions bodies like { return_type return_value; /* blah, blah, blah */; return return_value;} are IMVHO easier to read when the code related to return_value is placed on entry-point-at-{ & exit-point-at-}, not in somewhere in the middle.
 
User avatar
Alan
Posts: 3050
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

help, symbolic math processing script

October 14th, 2011, 9:34 pm

QuoteOriginally posted by: PolterSurely we can do better! ;-)As for the integral, bad news: Mathematica 8 didn't succeed for A=B=T=1 :-(Alan?Played around a little. Looks solvable this way.MM can solve DSolve[{y'[t] == t^(-1/2) E^(-A t - 1/t), y[0] == 0}, y[t], t]which gives you an integral which is related. Letting t = t/A in that result gives you the soln toDSolve[{y'[t] == t^(-1/2) E^(-t - A/t), y[0] == 0}, y[t], t] Finally, differentiating that last soln w.r.t. A should give you what you asked about.
 
User avatar
AVt
Posts: 90
Joined: December 29th, 2001, 8:23 pm

help, symbolic math processing script

October 15th, 2011, 9:11 am

For positive variables I get
 
User avatar
AVt
Posts: 90
Joined: December 29th, 2001, 8:23 pm

help, symbolic math processing script

October 15th, 2011, 2:48 pm

I did the integral in a way similar to Alan's suggestion, to verify itconsider the limiting case T=0 (from the right) to see it is actually 0,differentiating w.r.t. T then shows it is correct.The last can be reduced to the first integral:task:=abs(B-S)/'sqrt'(2*Pi)*Int(exp(-(S-B-mu*t)^2/2/t)/t^(3/2), t=0 .. T);Then task = abs(b)/sqrt(2*Pi)*exp(b*mu)* task3, where beta=b^2/2, alpha=mu^2/2, b=S-B and