sklose/NCalc2

Natural logarithms.

Closed this issue · 1 comments

Hi. I'm not able to figure out how to solve equations with natural logarithms.
Have not been able to find E ( Log(x, E) ) or find any Ln(x).
Any suggestions?

It depends if you evaluate your expressions in interpreted mode or whether you run them as compiled lambdas. For the latter there aren't any built in functions and you would have to define them yourself on your evaluation context object. In the former case there are a few functions build in like "log", "log10". You can also extend that by adding a custom function handler.

I am also happy to accept a PR for adding E and Ln to the set of default functions. You can find the list of functions supported out of the box here: https://github.com/sklose/NCalc2/blob/master/src/NCalc/Domain/EvaluationVisitor.cs#L292