R-Language logarithm function (known base and power, exponential)

Source: Internet
Author: User
Tags natural logarithm

The R language is very powerful and can be used to calculate various types of exponential functions.

For example, suppose Y=a^x, seeking x.

Function:

Log (P1 [, p2])

Where P1 is the power, P2 is the base, if P2 does not exist, then the base is E, the result is exponential.

Note: Here the e is a mathematical constant, is the base of the natural logarithm, approximately equal to 2.718281828, also known as Euler number.


1. Natural logarithm (base e logarithm)

    • Example (1)

Input: x<-exp (1)

Log (x)

Or

    • Example (2)

Input: Log (exp (1))

Output: 1

    • Example (3)

Input: Log (10)

Output: 2.302585

Description: Calculates an e-base

2. Logarithm with 10 base

Input: Log (100^2,100)

Output: 2

The first argument is a power, and the 2nd argument is the base.

3. Logarithm with 2 base

Input: Log (2^10, 2)

Output: 10

4. Logarithm with 3 base

Input: Log (3^10, 3)

Output: 10

5. Logarithm with any real number as the base

Input: Log ((2.5) ^8,2.5)

Output: 8




R-Language logarithm function (known base and power, exponential)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.