I had the code based on Bill Page and Waldek Hebisch suggestions that was
doing what I wanted but this last hint by Themos simplified it a lot. I
will put it here as Marduk seems to be doing a similar exercise in the "Simple
Gaussian integral fails thread".
The goal is to see if we can make FriCAS compute the integral that gives
the Black-Scholes formula for the price of a call option.
So, we define
C:=exp(-r*T)/(s*sqrt(2*%pi*T))
f(x)==(S*exp(x)-K)
g(x) == exp(-(x-T*m)^2/(2*T*s^2))
m := r-s^2/2
The integral integrate(f(x)*g(x),x=log(K/S)..%plusInfinity) fails, but we
can do
I := C*integrate(f(x)*g(x),x=log(K/S)..y)
Now we need to take the limit as y goes to infinity. For that to work we
first have to tell FriCAS that the expression sqrt(1/(2*T))/s is positive.
We do it by replacing this expression by c^2.
withPos:=subst(I,[sqrt(1/(2*T))::Kernel(Expression(Integer))],[c^2*s])
Nowe we can take the limit:
lim:=limit(withPos,y=%plusInfinity)
and replace c^2 back by sqrt(1/(2*T))/s
BS := (rule ('c^2==sqrt(1/(2*T))/s)) (lim::Expression(Integer))
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.