NumPy Logs - WTMatter

NumPy Logs - WTMatter

NumPy Logs – NumPy uFuncs (Python Tutorial): This is a detailed tutorial of the NumPy Logs Universal Functions. Learn the usage of these functions with the help of examples.

NumPy Logs

These are the mathematical function which is helpful in calculating the natural logarithm of x where x is the input we give in the form of arrays. It is the inverse of the exponential function and also of the element-wise natural algorithm.

In NumPy, we can perform log at three bases which are at base 2, base e and base 10. These log function will place -inf or inf in the element if the log can’t be computed.

Log at Base 2

In order to get this log, we need to use log2() the function which will give us the log at base 2.

Let us take an example to understand it better

Output:

[ 0\. 1\. 1.5849625 2\. 2.32192809 2.5849625 2.80735492 3\. 3.169925 ]

Here in this example, it is returning us the log for integers starting at 1 to 9 where nine is not included.

Log to Base 10

In order to get the log for base 10, we will use log10() function.

Let us take an example to understand it better

Output:

[ 0\. 0.30103 0.47712125 0.60205999 0.69897 0.77815125
0.84509804 0.90308999 0.95424251]

So in this example, we get all the terms with log to base 10 in the array.

Log at Base e

This is also known as Natural log. And in order to find this natural log, we will use log() function.

Let us take an example:

programming python numpy numpy universal functions ufuncs function

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Products - NumPy uFuncs (Python Tutorial) - WTMatter

Products - NumPy uFuncs (Python Tutorial): This is a detailed tutorial of the NumPy Products Universal Functions. Learn the usage of these functions with the help of examples.

Difference - NumPy uFuncs (Python Tutorial)

This is a detailed tutorial of the NumPy Difference Universal Functions. Learn the usage of these functions with the help of examples.

Simple Arithmetic - NumPy uFuncs (Python Tutorial) - WTMatter

This is a detailed tutorial of the NumPy Simple Arithmetic Universal Functions. Learn the usage of these functions with the help of examples.

Rounding Decimals - NumPy uFuncs (Python Tutorial) - WTMatter

This is a detailed tutorial of the NumPy Rounding Decimals Universal Functions. Learn the usage of these functions with the help of examples.

LCM - NumPy uFuncs - WTMatter

LCM - NumPy uFuncs - WTMatter: This is a detailed tutorial of the NumPy LCM Universal Functions. Learn the usage of these functions with the help of examples.