# Logarithmic Scale

Get a brief introduction to the logarithmic scale and take a look at some examples.

We'll cover the following

## Introduction

Let’s dive into another important scale, the logarithmic scale. It is similar to the linear scale, except that a logarithmic transformation is applied to the input when it is mapped into the output. The logarithmic scale maps continuous input to continuous output through the following function:

$y= mlog(x) + b$

where x is the input and y is the output.

As log(0) is equal to negative infinity, the domain of the logarithmic function should include zero. It will show NAN if we pass a negative value as the domain consists of only positive values.

## Example

Let’s see how the logarithmic scale works through an example. As we know, logarithmic behavior is shown by algorithms in computer science that divide problems into subproblems and join the solutions of subproblems.

For example, the binary search requires $log_2(N)$ steps to find a number in an array of size N. Let’s code this logarithmic function to see it’s working.

Get hands-on with 1200+ tech skills courses.