How to use the mathematical function library to calculate logarithmic functions such as ln and log in c#

tags: C#

You can use the general calculation function of the logarithmic function: Math.Log(),But there are many mistakes about the use of this function on the Internet. The first parameter is the value you want to find, and the second parameter is the bottom.

To this end, I did the following experiment and verified it againThe second parameter is the bottom! In addition, if only one parameter is entered, the default is to base E.

Test code:

double test = Math.Log(1, Math.E);//0
double test1 = Math.Log(Math.E);//1

 

Intelligent Recommendation

Luo Gu P4725 [template] polynomial logarithmic function (polynomial ln)

The meaning of problems Topic Link Sol This not back XD Pre-knowledge: \(f(x) = ln(x), f'(x) = \frac{1}{x}\) \(f(g(x)) = f'(g(x)) g'(x)\) All we ask is\(G(x) = F(A(x)), F(x) = ln(x)\) Directly on both...

Custom logarithmic function in C++

When I participated in the Blue Bridge Cup provincial competition this year, I needed a logarithmic function based on the base 2 to solve the problem. That is, which depth and maximum is the balance o...

C++ calculates logarithmic function

Review C++ calculates the logarithmic function and simply records it. Code...

Introduction to mathematical logarithms log lg ln

Table of contents Introduction algorithm the difference Introduction log: represents logarithm, which is the opposite of exponential. We read log₈2 as log base 8, the logarithm of 2. The specific calc...

More Recommendation

C custom Exp, log, ln function source code record

1. For some reasons, if you use the custom, the code you write without your own is copied. Version 1: exp: log: ln: Because it is directly used in embedded assembly, it cannot be used correctly in 64 ...

C ++ is directly looking for library functions from <cmath> - mathematical standard library function

As the title, directly from <cmath> out of the following three segments, where the first paragraph is the statement of all USING :: starting: first part: using ::acos; using ::asin; using ::atan...

Do not use a C / C ++ string library function, how to write strcpy () functions

Do not use a C / C ++ string library function, how to write strcpy () functions Title: The protrcpy () function prototype is known as follows: 1, do not call the library function, implement the strcpy...

[Ln] function use skills

Excel's LN function is mainly used to calculate the logarithm of the specified "number" with natural logarithm, which is natural .. This article describes the formula syntax and usage of the...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top