RV: Newton

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

RV: Newton

Gilbert Peffer
This reminds me to an interesting "bug" I was once looking for in
a simple programme that calculated yields from bond prices. The
usual thinking is that since it is a smooth monoton function, any
method to find the root should work. Not so! Since I used the
"real-world" price/yield calculation function hidden away in a
production library, I forgot about the fact that internally, the
function rounds prices (to the 32nd at the time). This means that
the P/Y function is not smooth at all but a step function!! So
much for having advanced degrees in maths :-)
Cheers, Gilbert

>
>Hi QuantLibers,
>I 've problems in using the Newton's method to evaluate a function.
>Any idea of how to  test it in c++?
>thanks in advance.
>Marcello
>
>
>
>Marcello Gambacorta
>Customer Desk Cofiri SIM S.p.A.
>Tel: 0039-(0)64733571
>Fax:0039-(0)64884322
>mail: [hidden email]
>    
>
>
>
>_______________________________________________
>Quantlib-users mailing list
>[hidden email]
>http://lists.sourceforge.net/lists/listinfo/quantlib-users



Reply | Threaded
Open this post in threaded view
|

Re: RV: Newton

Peter Schmitteckert-2
Salut,

> This reminds me to an interesting "bug" I was once looking for in
> a simple programme that calculated yields from bond prices. The

[...]
> the P/Y function is not smooth at all but a step function!! So
> much for having advanced degrees in maths :-)
> Cheers, Gilbert


if you want to be able to solve for nasty functions you should consider
using interval arithmetics. In that way you can guarantee to find all
solutions, proof the non-existence of solutions or point out that your
underlying arithmetic is too bad.

Best wishes,
Peter


Reply | Threaded
Open this post in threaded view
|

Re: RV: Newton [Mail virus free]

Luigi Ballabio-3
At 09:03 PM 7/10/01 +0200, Peter Schmitteckert wrote:

>Salut,
>
> > This reminds me to an interesting "bug" I was once looking for in
> > a simple programme that calculated yields from bond prices. The
>
>[...]
> > the P/Y function is not smooth at all but a step function!! So
> > much for having advanced degrees in maths :-)
> > Cheers, Gilbert
>
>if you want to be able to solve for nasty functions you should consider
>using interval arithmetics. In that way you can guarantee to find all
>solutions, proof the non-existence of solutions or point out that your
>underlying arithmetic is too bad.

Hi Peter,
         any reference on interval arithmetics?

Thanks,
         Luigi




-----------------------------------------------------
In case you found the label [Mail virus free] in the subject of this mail,
that is only because I forgot to remove it before replying.
The label was added by our new internet provider - they want to make the
point that they practice safe mailing. Of course we all know that there is
no such thing, therefore you can happily disregard it.



Reply | Threaded
Open this post in threaded view
|

Re: Interval arithmetics [was Newton ]

Peter Schmitteckert-2
Dear Luigi,

> Hi Peter,
>          any reference on interval arithmetics?
>

My experience with interval arithmetics is base on
Pascal-XSC of the university Karlsruhe, Germany.
(and by private conversation)

There is a preliminary interval package for C++ on boost.org,
and you can find more packages on the net.

The idea of a 1D interval solver for f is quite simple, you just bisection
the desired range and check, if zero is element of f( subrange ). If not,
then there is no solution, if yes you can continue to bisection until you
have found your solutions.

In case its unclear (or you're too lazy :) ) I could provide you with an
example using the boost interval package, since the boost license is
compatible with Quantlib. But you should give me one or two weeks, since I
currently have a high workload.

Best wishes
Peter