Time Grid

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

Time Grid

John Maiden
I'm trying to implement a program that uses a time grid, and getting a weird
message. If I use a time grid of 100 steps, then my program runs fine. When I
try to increase the number of time steps in the time grid, I get a message like
"using inadequate time grid: the nodes closest to the required time t =
3.77413150685 are t1 = 3.77413150685 and t2 = 3.7791369863" (I'm using a time
grid that goes from time 0.0 to time 5.0, and the program steps backward from
the final time). It looks to me that the time grid should be fine, since one of
the points matches the number within accuracy (or so it seems). Why would
increasing the accuracy create a message like this?


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Time Grid

John Maiden
It seems that my problem comes from the precision required by the
close_enough(Real,Real) function that is used in the TimeGrid class. The error
message in the TimeGrid::index function shows to the 12th decimal place, but
close_enough is more precise than that (more than I need). Is there a way to
change the precision in the TimeGrid, or should I just rely on
TimeGrid::closestIndex?


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Time Grid

Luigi Ballabio

On Jun 21, 2007, at 9:29 PM, John Maiden wrote:
> It seems that my problem comes from the precision required by the
> close_enough(Real,Real) function that is used in the TimeGrid class.
> The error
> message in the TimeGrid::index function shows to the 12th decimal
> place, but
> close_enough is more precise than that (more than I need). Is there a
> way to
> change the precision in the TimeGrid, or should I just rely on
> TimeGrid::closestIndex?

John,
        you could edit the call to close_enough, but I think it's less trouble
to use closestIndex(t) instead of t if you can. I'll try and relax the
accuracy requirements for next release.

Luigi


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users