4
$\begingroup$

I'm developing a software with a tool unable to "recognize" the ln(), so is there a way to get the equivalen to ln() using someones of functions below?

• sin1(a)
• cos1(a)
• tan1(a)
• log10(a) Logarithm (base 10) of a
• pow(x,y) x raised to the power y
• exp(a) e (the constant) raised to the power a
• sqrt(a) Square root of a
• sign(a) The sign of a (-1 if negative, 1 if positive)
• abs(a) The absolute value of a
• max(a,b)
• min(a,b)

2 Answers 2

3

We have

$\ln x=(\log_{10} x)(\ln 10).$

The $\ln 10\,$ can be stored as a constant. For example, you could store it as $2.302585093$.

Remark: Let $w=(\log_{10} x)(\ln 10)$. Then $e^y=e^{(\ln 10)(\log_{10}x)}=(e^{\ln 10})^{\log_{10} x}=10^{\log_{10}x}=x,$ so indeed $y=\ln x$.

  • 2
    @Manix: You can calculate $\ln 10$ to as many decimal places as you feel like using Wolfram Alpha. Then store it in the program as a constant to whatever precision you are working at. Possibly you might want to store it as several constants, which can be used depending on whether you are working in single precision, double, whatever.2012-10-02
4

André Nicolas' answer is good, but you can also express it with those functions only and no hand-wired constants:

$\ln(x) = \frac{\log_{10}(x)}{\log_{10}(\exp(1))}$.

It's probably more efficient to store the constant, however (though I'm not sure that matters in your application). Note also that $\frac{1}{\log_{10}(\exp(1))} = \ln(10)$, so the two answers are in fact equivalent.

  • 0
    Thank you, the function works as expected. Thank you2012-10-02