fsprojects / ExcelFinancialFunctions

.NET Standard library providing the full set of financial functions from Excel.
https://fsprojects.github.io/ExcelFinancialFunctions
Other
194 stars 66 forks source link

The interaction of Bisection and Newton algo in findRoot needs review #31

Open jcoliz opened 2 years ago

jcoliz commented 2 years ago

From todo.txt:

"The interaction of Bisection and Newton algo in findRoot needs review. It seems like it is working now, but it could use some love. Maybe I should switch to a better root finding algo (i.e. Rudder or Brent)"

Issues seems like a better place for this. Will remove todo.txt.

dsyme commented 2 years ago

BTW I tweeted about you becoming maintainer here: https://twitter.com/dsymetweets/status/1461670857806434308. We always do that when maintainers change in fsprojects :)

I think you're no longer using that twitter account though (assuming it is you)

jcoliz commented 2 years ago

Hah! It is me, though I've not used that account in some years. Windows dev platform organization went through a burst of twitter excitement back then, so I gave it a shot. Anyway. I actually left MS earlier this year, and neglected to update it before I lost access to my xbox,com email address.

luajalla commented 2 years ago

Not sure if I tried the other algos, i think some cases are tricky for all of them. It would probably make sense to make them more configurable (allow to choose an algo? number of iterations? how to expose this nicely in the api?), or possibly try more advanced solver(s) and see if they cover the cases that didn't work before. Another option I was thinking about is allowing to use a custom solver, then the lib stays lightweight and doesn't require external dependencies.

jcoliz commented 2 years ago

Thanks for the insight, Natallie. About the cases that didn't work before... Are those living somewhere? Would be good to have them as a "failing test case", which could be used to prove new approaches.

luajalla commented 2 years ago

I've tried to check the tests & docs but can't find any specific examples. Some differences are documented for Excel and OpenOffice, but these are not covering failing cases. I'd suggest to try generating inputs with FsCheck.