Re: FdAmericanOption problem and Tracing

Posted by Joseph Wang on
URL: http://quantlib.414.s1.nabble.com/FdAmericanOption-problem-and-Tracing-tp3483p3485.html

There are three different but related issues.....

1) Basically if you run FdAmericanOption with a fixed number of time
steps and increase the number of space steps, the PDE calculation starts
getting unstable.  Graham Miller posted some test code that nicely
illustrates the problem.  E-mail me if you can't find it in the list
archives at www.quantlib.org

2) There also seems to be some error if you have an even number of grid
steps.

3) Also there has been some discussion on adding a trace statement.

As far as 1) and 2) my current opinion is that the problem is a deep
issue and that the best way of dealing with it is to put in checks that
stop the simulation if the number of space steps are too large or if
there is an even number.  The big problem with 1) and 2) is that the
simulation behaves counter-inituitively.  More grids usually gives a
better result.

Some of the projects I can think of are:

1) write unit tests that compare the output of FdAmericanOption with
some known good results

2) see how bad the problem is.  I suspect that anything that calculates
option prices via PDE will run into this problem.

3) see if this sort of issue is in the literature.

4) once we have agreed to a format for putting in trace statements,
there is a lot of work to do adding trace statements to the code.  My
own experience has been that it is practically impossible to debug
highly numerical code without some tracing mechanism.  Also, my
experience has also been that keeping trace code in the production code
is usually a good thing.  (i.e. if you have to add some print debug
statements to track down a problem, it is really nice to have a
mechanism to keep those debug statements in the production code).

5) Also it would be nice to setup cppdoc