Program to Plotting the logarithm of a function

Program to Plotting the logarithm of a function


Logarithmic in Python:


Python offers many inbuild logarithmic functions under the module “math” that allows how to compute logs using a single line. The Python LOG function is one of the Python Math functions that is used to calculate the logarithmic value of the given number with base E. 

In this section, we will show you, How to use LOG() function in Python Programming language with example and Program to Plotting the logarithm of a function.



Logarithms are used to solve equations in which the unknown amount is in the form of power. Since the derivative of the logarithmic function is a very simple function, it is used to extract the integral. Logarithms, exponentials, and radicals - all three are very closely interlinked. The value of b in the equation bn = x can be derived by radical; The value of n can be derived by logarithm and the value of x by power.



In mathematics, the logarithm is the inverse function of exponentiation. This means the logarithm of a given number x is that the exponent to another fixed number and therefore base b, must be raised then produce number x. 

The logarithm counts the variety of occurrences of the same element in repeated multiplication;

Now take a look at how to implement logarithm using numpy and matplotlib library. Program to Plotting the Logarithm of a function given below:

Python Code:

import numpy as np
from matplotlib import pyplot as plt
x = np.arange(
0,3.14,0.01)
a =
4
b = 5
y = np.log(a*x+b)
plt.plot(x,y)
plt.xlabel(
'x values')
plt.ylabel(
'y values')
plt.title(
'logarithm')
plt.grid(
True
)
plt.show()

Output:
Program to Plotting the logarithm of a function
Program to Plotting the logarithm of a function













Summary: In this, We discussed the logarithm of a function in Python. at the very first step take a look at what is the logarithm of a function definition of how it can be used in mathematics? In this section, we clearly defined How to plot LOG() function in Python Programming language with example. Implementation of code using numpy so used here np.log(), labeling of x values, y values plt.grid(true) to show grid in the graph, plt.show() to show the graph of the function and also give the title of the program.