# [Maxima] Beginner really needs help with Maxima's basic concepts

Leo Butler l.butler at ed.ac.uk
Sat Nov 14 03:06:18 CST 2009

```
On Sat, 14 Nov 2009, reyssat wrote:

< Julien Martin a écrit :
< > Thanks a lot to you too Eric!
< >
< > I am also experiencing difficulties with the syntax of your:
< > *s:solve([F-f,P-p],[F,u,d]);
< > ss:s[2][1];
< >
< > *Can you please describe in English what the above two line mean - if
< > and when you have the time to do so of course :-)
< >
< You want to find the value of f in terms of other quantities except u
< and d. So the idea is to solve a system of equations whose unknowns are
< f,u,d.
<
< But you defined f already, it is no more an indeterminate, so this
< symbol cannot be used as an indeterminate of the system of equations.
< You need another symbol, I used  F  but you may use  'f  as well or
< anything new.
< For the same reason, since you want to express f in terms of p (not only
< the components of p but the whole expression p) you need asymbol for p
< which is not already assigned. I used P.
<
< So I want to find the value of F,u,d (in terms of fu,fd,S0,P, exp(r*T))
< knowing that F-f  and P-p are zero.
< Hence our equations are F-f=0, P-p=0 and the unknowns are F,u,d. This is
< the meaning of *s:solve([F-f,P-p],[F,u,d]);*

NB. There is no need to solve for u, you could have solved for F and d,
alone.

(%i21) solve([F=f,P=p],[F,d]);

(%o21) [[F = ((fu-fd)*P+fd)*%e^-(r*T),d = -(%e^(r*T)-u*P)/(P-1)]]

Leo

<
< xmaxima answers [ sol1,sol2 ] where the first solution corresponds to
< u=d (not interesting) and the real solution is sol2. This second
< solution is a triplet [F=..., u=..., d=...] and the first term of this
< triplet is the equality F = ((fu-fd)*P+fd)*%e^-(r*T) you're looking for.
< This is the meaning of ss:s[2][1]    : take the first term of the second
< solution.
<
< HTH
<
< Eric
<
<
< >
< > Julien.
< >
< > 2009/11/11 reyssat <eric.reyssat at math.unicaen.fr
< > <mailto:eric.reyssat at math.unicaen.fr>>
< >
< >     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)*
< >
< >
< >         Julien.
< >         ------------------------------------------------------------------------
< >
< >         _______________________________________________
< >         Maxima mailing list
< >         Maxima at math.utexas.edu <mailto: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
< >
< >
<
< _______________________________________________
< Maxima mailing list
< Maxima at math.utexas.edu
< http://www.math.utexas.edu/mailman/listinfo/maxima
<
<
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

```