Ideas for two new classes

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

Ideas for two new classes

Joseph Wang
math/SampledCurve - represents a curve which consists of n+1 arrays, one
for the independent values and n dependent values.  Methods of this
class will allow for interpolation and generating first and second
derivative curves.

PartialDifferentialEquation - represents a PDE

The idea behind these new classes will be to clean up the finite
differencing code a bit.  Instead of deal with raw arrays, the code will
deal with SampledCurve's which will have facilities to allow
interpolation, and the finite difference class will be able to pass the
SampleCurve back up to the instrument where things can be done with it
such as calculating delta curves and option curves.

The idea behind a PDE class is to separate the processes from the finite
differencing code.  For example the BlackScholes process will generate a
PDE object and the fd code will generate the finite difference operators
from the PDE object rather than the BlackScholes process itself.

The idea behind this is to improve code clarity as well as to allow for
PDE arithmetic.  Also, I suspect that there are some very clever things
that one can do with Feymann-Kac once we have this in place.






Reply | Threaded
Open this post in threaded view
|

RE: Ideas for two new classes

cuchulainn
[Quantlib-users] Ideas for two new classes
I use the Bridge pattern for PDE concept (a PDE has many implementations), and I use Template Method for FDM hierarchy. Betewen PDE and FDM I use standardised interfaces.
 
Do Quantlibbers use UML to communicate design ideas, or how does it work in this case?
 
Daniel


From: [hidden email] on behalf of Joseph Wang
Sent: Sat 01/10/2005 02:48
To: [hidden email]; [hidden email]
Subject: [Quantlib-users] Ideas for two new classes

math/SampledCurve - represents a curve which consists of n+1 arrays, one
for the independent values and n dependent values.  Methods of this
class will allow for interpolation and generating first and second
derivative curves.

PartialDifferentialEquation - represents a PDE

The idea behind these new classes will be to clean up the finite
differencing code a bit.  Instead of deal with raw arrays, the code will
deal with SampledCurve's which will have facilities to allow
interpolation, and the finite difference class will be able to pass the
SampleCurve back up to the instrument where things can be done with it
such as calculating delta curves and option curves.

The idea behind a PDE class is to separate the processes from the finite
differencing code.  For example the BlackScholes process will generate a
PDE object and the fd code will generate the finite difference operators
from the PDE object rather than the BlackScholes process itself.

The idea behind this is to improve code clarity as well as to allow for
PDE arithmetic.  Also, I suspect that there are some very clever things
that one can do with Feymann-Kac once we have this in place.






-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Quantlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

Reply | Threaded
Open this post in threaded view
|

Re: Ideas for two new classes

Joseph Wang
Daniel J. Duffy wrote:

> I use the Bridge pattern for PDE concept (a PDE has many
> implementations), and I use Template Method for FDM hierarchy. Betewen
> PDE and FDM I use standardised interfaces.
>  
> Do Quantlibbers use UML to communicate design ideas, or how does it
> work in this case?

There is a lot of UML in the quantlib web.  In this case, I wasn't
thinking in terms of any basic change to the basic class hierarchy or
structure.  Merely two fairly localized (but important changes).  One of
the purposes of these two changes is to decouple the FDM code from the
rest of the system more so and so that we can then think about more
fundamental changes to the way that the FDM engines work.

The FDM hierarchy already uses the template pattern.  The problem is the
that right now quantlib creates the FDM operators directly from the
black scholes process.  This couples the FDM far too closely to
Black-Scholes.

IMHO, the way that it should work is that the BS process creates a PDE
object and this PDE object is what get finite differenced.  The other
problem is that right now the FD pricing engines create a pricing curve
which can be used to create a delta and a gamma curve, but all of that
gets thrown away.  Having a sampled curve class will let the price curve
available as a class which you can then process.

One problem with the sampled curve class is that it is based on the
quantlib Array class and Array is hard coded to use Real's.

As far as what the PDE object should look like....

I hear that someone wrote a book on "Financial Instrument Pricing Using
C++" where he spends an several chapters on this topic.  Hmmmmm.... :-)
:-) :-) :-)

>  
> Daniel
>
> ------------------------------------------------------------------------
> *From:* [hidden email] on behalf of Joseph
> Wang
> *Sent:* Sat 01/10/2005 02:48
> *To:* [hidden email];
> [hidden email]
> *Subject:* [Quantlib-users] Ideas for two new classes
>
> math/SampledCurve - represents a curve which consists of n+1 arrays, one
> for the independent values and n dependent values.  Methods of this
> class will allow for interpolation and generating first and second
> derivative curves.
>
> PartialDifferentialEquation - represents a PDE
>
> The idea behind these new classes will be to clean up the finite
> differencing code a bit.  Instead of deal with raw arrays, the code will
> deal with SampledCurve's which will have facilities to allow
> interpolation, and the finite difference class will be able to pass the
> SampleCurve back up to the instrument where things can be done with it
> such as calculating delta curves and option curves.
>
> The idea behind a PDE class is to separate the processes from the finite
> differencing code.  For example the BlackScholes process will generate a
> PDE object and the fd code will generate the finite difference operators
> from the PDE object rather than the BlackScholes process itself.
>
> The idea behind this is to improve code clarity as well as to allow for
> PDE arithmetic.  Also, I suspect that there are some very clever things
> that one can do with Feymann-Kac once we have this in place.
>
>
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads, discussions,
> and more. http://solutions.newsforge.com/ibmarch.tmpl
> _______________________________________________
> Quantlib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>