Twofold problem with Maxima: derivative of cdf_normal and expressing result as an expression of a var...
Subject: Twofold problem with Maxima: derivative of cdf_normal and expressing result as an expression of a var...
From: Julien Martin
Date: Thu, 29 Oct 2009 18:40:46 +0100
Hello again,
No luck with "depends".
Since I have defined d1 and d2 above, when I input:
depends(d1, t, d2, t)
it tells me "the arguments to depends must be a symbolic name".
Here is all that I input in the same order:
load(distrib)
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)
depends(d1, t, d2, t)
J.
2009/10/29 Julien Martin <balteo at gmail.com>
> Hello Raymond,
>
> Thanks for your reply.
>
> I assume I should get pdf_normal in the result because I understand the pdf
> is the derivative of cdf and also because it appears in the result of the
> theta in the following table (click on the link and see the theta for a
> call):
>
> http://en.wikipedia.org/wiki/Black%E2%80%93Scholes#Greeks
>
> As far as d1 and d2 are concerned I am going to have a look at the depends
> function you pointed out in order to understand it properly.
>
> Please keep me posted about the cdf/pdf. I'll let you know about if the
> depends helped.
>
> Thanks again!!
>
> Julien.
>
>
> 2009/10/29 Raymond Toy <raymond.toy at stericsson.com>
>
> 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
>>
>>
>