Menu

#17 Financial: Ir% solve bug

closed-fixed
None
5
2009-06-11
2009-05-25
Anonymous
No

Using Calc v4.51. Earlier versions behaved the same. Solving for ir% yields 'nan' unpredictably. I attached excel file with some samples.

Thanx for a great app!

Discussion

  • Nobody/Anonymous

    calc v4.51 ir% samples.xls

     
  • Roar Lauritzsen

    Roar Lauritzsen - 2009-05-27
    • assigned_to: nobody --> roarl
    • status: open --> open-accepted
     
  • Roar Lauritzsen

    Roar Lauritzsen - 2009-05-27

    It is the "np=120" that makes it difficult. This introduces something like "x^120" in the equation, which yields a function that has a very sharp bend. This is a case for which the current root-finding algorithm is not well suited.

    I have now modified the root-finding algorithm to do "alternating interpolation and bisection", along the lines of the general root-finding algorithm used for programs. It might be a bit slower, but it finds the solution to your "trouble" cases. However, I think it might still be possible to screw it up by setting "np=120000" or something. The new algorithm will be available in the next release.

     
  • Roar Lauritzsen

    Roar Lauritzsen - 2009-06-11

    Will be fixed in next version

     
  • Roar Lauritzsen

    Roar Lauritzsen - 2009-06-11
    • status: open-accepted --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB