FiniteDifferences framework: composition of L including S

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

FiniteDifferences framework: composition of L including S

Penschke, Walter
Hello QL-community,

I did have a look at the finite differences framework of QL. The sample code
provided in the documentation is based on a version of the BlackScholes
differential equation, which is defined for log(S). In this version the
differential operator L only depends on constants and on space-differentials
of the solution. As a consequence the grid for example is defined on the log
of the underlying.

I was now trying to perform similar calculations as in the example, however
now based on the BlackScholes differential equation for S. I.e.: the
differential equation looks like this:

        f = f(S, t)
        df/dt = rf - rS df/dS - 1/2 sigma^2 S^2 d^2/dS^2

(For the sake of simplicity I skipped the dividend yield in the above
formula.) As you can see the right hand side of the equation also contains
S. I now wonder, how I should set up the differential operator L with the
tools provided by QL. Especially it is not clear to me how I should
incorporate S in the definition of the differential operator L.

Any help, ideas or comments highly appreciated. Thanks,


wpe


Reply | Threaded
Open this post in threaded view
|

Re: FiniteDifferences framework: composition of L including S

Luigi Ballabio-2
On 2004.09.23 15:08, Penschke, Walter wrote:

> Hello QL-community,
>
> I did have a look at the finite differences framework of QL. The sample
> code provided in the documentation is based on a version of the  
> BlackScholes differential equation, which is defined for log(S).
>
> I was now trying to perform similar calculations as in the example,
> however now based on the BlackScholes differential equation for S. I.e.:  
> the differential equation looks like this:
>
> f = f(S, t)
> df/dt = rf - rS df/dS - 1/2 sigma^2 S^2 d^2/dS^2
>
> (For the sake of simplicity I skipped the dividend yield in the above
> formula.) I now wonder, how I should set up the differential operator L  
> with the tools provided by QL. Especially it is not clear to me how I  
> should incorporate S in the definition of the differential operator L.
Walter,
        sorry for the delay. As there's more math in the answer than plain  
e-mail can carry, I'm writing it in LaTeX and attaching it to this mail.

Later,
        Luigi



fd.pdf (46K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: FiniteDifferences framework: composition of L including S

cuchulainn
In reply to this post by Penschke, Walter
Do you know that this centred difference scheme gives terrible approximations to the delta and gamma at the strike price? See the references below.

Daniel J. Duffy
http://www.datasim-component.com/financial.asp?section=resources

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]]On Behalf Of Luigi
> Ballabio
> Sent: 11 October 2004 11:48
> To: Penschke, Walter
> Cc: [hidden email]
> Subject: Re: [Quantlib-users] FiniteDifferences framework: composition
> of L including S
>
>
> On 2004.09.23 15:08, Penschke, Walter wrote:
> > Hello QL-community,
> >
> > I did have a look at the finite differences framework of
> QL. The sample
> > code provided in the documentation is based on a version of the  
> > BlackScholes differential equation, which is defined for log(S).
> >
> > I was now trying to perform similar calculations as in the example,
> > however now based on the BlackScholes differential equation
> for S. I.e.:  
> > the differential equation looks like this:
> >
> > f = f(S, t)
> > df/dt = rf - rS df/dS - 1/2 sigma^2 S^2 d^2/dS^2
> >
> > (For the sake of simplicity I skipped the dividend yield in
> the above
> > formula.) I now wonder, how I should set up the
> differential operator L  
> > with the tools provided by QL. Especially it is not clear
> to me how I  
> > should incorporate S in the definition of the differential
> operator L.
>
> Walter,
> sorry for the delay. As there's more math in the answer
> than plain  
> e-mail can carry, I'm writing it in LaTeX and attaching it to
> this mail.
>
> Later,
> Luigi
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: FiniteDifferences framework: composition of L including S

Luigi Ballabio-2
On 2004.10.11 17:09, Daniel J. Duffy wrote:
> Do you know that this centred difference scheme gives terrible
> approximations to the delta and gamma at the strike price? See the
> references below.
>
> http://www.datasim-component.com/financial.asp?section=resources

Right--thanks for pointing out.

Cheers,
        Luigi




Reply | Threaded
Open this post in threaded view
|

RE: FiniteDifferences framework: composition of L including S

cuchulainn
In reply to this post by Penschke, Walter
You're welcome

Daniel

> -----Original Message-----
> From: Luigi Ballabio [mailto:[hidden email]]
> Sent: 12 October 2004 11:36
> To: Daniel J. Duffy
> Cc: [hidden email]
> Subject: Re: [Quantlib-users] FiniteDifferences framework: composition
> of L including S
>
>
> On 2004.10.11 17:09, Daniel J. Duffy wrote:
> > Do you know that this centred difference scheme gives terrible
> > approximations to the delta and gamma at the strike price? See the
> > references below.
> >
> > http://www.datasim-component.com/financial.asp?section=resources
>
> Right--thanks for pointing out.
>
> Cheers,
> Luigi
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: FiniteDifferences framework: composition of L including S

Luigi Ballabio-2
In reply to this post by cuchulainn
On 2004.10.11 17:09, Daniel J. Duffy wrote:
> Do you know that this centred difference scheme gives terrible
> approximations to the delta and gamma at the strike price? See the
> references below.

Oh, and Walter: just so that you're not left outside alone, the calculation  
I sketched can still be used as an example of how to discretize your  
equation--albeit with an unstable scheme. You can follow the same steps  
while using more stable differential operators instead of D0 and D+D-.

Later,
        Luigi




Reply | Threaded
Open this post in threaded view
|

RE: FiniteDifferences framework: composition of L including S

cuchulainn
In reply to this post by Penschke, Walter
Hi all,
Your schme is stable but in combination with Crank Nicolson in time it gives (bounded) spurious oscillations. This fact should be well known (see again my articles and the of others in FDM and finance).

The C++ code for the exponentially fitted scheme is on the CD of my book if you wish to use it.

Daniel

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]]On Behalf Of Luigi
> Ballabio
> Sent: 12 October 2004 14:29
> To: Penschke, Walter
> Cc: [hidden email]
> Subject: Re: [Quantlib-users] FiniteDifferences framework: composition
> of L including S
>
>
> On 2004.10.11 17:09, Daniel J. Duffy wrote:
> > Do you know that this centred difference scheme gives terrible
> > approximations to the delta and gamma at the strike price? See the
> > references below.
>
> Oh, and Walter: just so that you're not left outside alone,
> the calculation  
> I sketched can still be used as an example of how to discretize your  
> equation--albeit with an unstable scheme. You can follow the
> same steps  
> while using more stable differential operators instead of D0 and D+D-.
>
> Later,
> Luigi
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: IT Product Guide on
> ITManagersJournal
> Use IT products in your business? Tell us what you think of
> them. Give us
> Your Opinions, Get Free ThinkGeek Gift Certificates! Click to
> find out more
> http://productguide.itmanagersjournal.com/guidepromo.tmpl
> _______________________________________________
> Quantlib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>