[Maxima] Twofold problem with Maxima: derivative of cdf_normal and expressing result as an expression of a var...

Raymond Toy raymond.toy at stericsson.com
Thu Oct 29 12:07:20 CDT 2009

```Julien Martin wrote:
> Hello,
>
> I am trying to use Maxima in order to compute a partial derivative of
> the C(S,t) function below
>
> d1:(log(S/K)+(r+sigma^2/2)*(T-t))/(sigma*sqrt(T-t))
> d2:d1-(sigma*sqrt(T-t))
>
> C(S,t):=S*cdf_normal(d1,0,1) - K*exp(-r*(T-t))*cdf_normal(d2,0,1)
>
> -diff(C(S,t),t)
>
> For you information I am in reference to the Black and Scholes
> formula: http://en.wikipedia.org/wiki/Black%E2%80%93Scholes#Greeks and
> I am trying to compute the Theta.
>
> The problem is that this does not give me the expected result because
> I would like for the result be expressed as an expression of d1, d2.
> How can I achieve that??
>
> Morevoer, I should get  a pdf_distrib (derivative of cdf_distrib)
> somewhere in the result.
Why do you think you should get a pdf_distrib in the result?  The
derivative of the cdf_normal is easily expressed as an exponential
function, and that's what maxima does.

Perhaps, you want something like:

C(S,t):=S*cdf_normal(nd1,0,1) - K*exp(-r*(T-t))*cdf_normal(nd2,0,1)
depends(nd1, t, nd2, t)

diff(C(S,t),t)

This will give you an expression in term of nd1, nd2, and the
derivatives of nd1 and nd2.

Ray

```