Beginner really needs help with Maxima's basic concepts
Subject: Beginner really needs help with Maxima's basic concepts
From: reyssat
Date: Wed, 11 Nov 2009 12:19:45 +0100
Julien Martin a ?crit :
> Hello,
>
> I am working on the binomial model and my example is based on that but
> really my question relates to Maxima's basic concepts.
>
> Here is my example:
>
> I have %Delta and p defined as follows:
>
> *%Delta:(fu-fd)/(S0*u-S0*d); (1)*
>
> *p:(exp(r*T)-d)/(u-d); (2)*
>
> I need to have the following expression (3) simplified by replacing
> the %Delta with the expression given above in (1) and expressed in
> terms of p as defined above in (2)...
>
> *f:S0*%Delta*(1-u*exp(-r*T))+fu*exp(-r*T); (3)*
>
> ...so that I would ideally get this:
>
> *f:exp(-r*T)*(p*fu + (1-p) * fd); (4)*
>
> Is this possible? Can someone please help?
>
> Julien.
> ------------------------------------------------------------------------
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
Hello,
since you want to eliminate u and d in f, and express it in terms of the
other parameters only, you can solve in terms of f,u,d :
(%i2) %Delta:(fu-fd)/(S0*u-S0*d);
(%o2) (fu-fd)/(u*S0-d*S0)
(%i3) p:(exp(r*T)-d)/(u-d);
(%o3) (%e^(r*T)-d)/(u-d)
(%i4) f:S0*%Delta*(1-u*exp(-r*T))+fu*exp(-r*T);
(%o4) (fu-fd)*S0*(1-u*%e^-(r*T))/(u*S0-d*S0)+fu*%e^-(r*T)
(%i5) s:solve([F-f,P-p],[F,u,d]); ss:s[2][1];
(%o5) [[F = %r1,u = %e^(r*T),d = %e^(r*T)],
[F = ((fu-fd)*P+fd)*%e^-(r*T),u = %r2,d = -(%e^(r*T)-%r2*P)/(P-1)]]
(%o6) F = ((fu-fd)*P+fd)*%e^-(r*T)
which is almost your expected answer (need to collect coefficient of fd).
Eric