Introduction to 'e', 'log', and 'ln'
What is ‘e’: In a simple definition, when
you want to express that something is rising rapidly by a significant quantity,
use 'exponentially'. The 'e' means 'exponential'. In mathematics, the letter
'e' is employed to represent a specific quantity known as the exponential
constant. The number e, often known as Euler's number, is a mathematical
constant with a value of about 2.71828.
What is ‘log’: The logarithm (means 'log') is the inverse
function of exponential (means 'e' or 'exp') in mathematics. We can say that by
an example, the logarithm of a given number 'a' is the exponent to which
another fixed number, the base 'b', must be increased in order to get that
number 'a'. The equation can be written as,
logb(ba) = a , here ‘b’
is the base of the logarithm.
What is ‘ln’: The 'ln' is called the
natural logarithm. The ln's is the
logarithm to the base of the mathematical constant e, which is an irrational
and transcendental integer roughly equal to 2.718281828459. The equation for
the natural logarithm ‘ln’ is,
eln x = x
Where ‘ln’ is ‘natural logarithm’, ‘e’ is the ‘natural exponent’, and ‘x’ represents ‘a real number’.
How to write ‘e’, ‘log’, and ‘ln’ in Matlab?
It is so easy to write the ‘e’, ‘log’, and
‘ln’ in Matlab. We have to know the built-in function defined for the ‘e’, ‘log’,
and ‘ln’ variables. The implementation function is,
‘e’ in Matlab is ‘exp()’
‘log’ in Matlab is ‘log()’
And for ‘ln’ in Matlab is ‘log()’ (In matlab , log(x)
means ln(x))
Examples of ‘e’, ‘log’, and ‘ln’ in Matlab
How to write ‘log e 10’ in Matlab?
Ans: log(exp(10))
How to write ‘log10 2’ in Matlab?
Ans: log10(2)
How to write ‘log2 5’ in Matlab?
Ans: log2(5)
Implementation of an equation in Matlab?
We just learn to write ‘log’, ‘e’, and ‘ln’
variables in Matlab. Now, it will be more clear if we implement an equation
related to those variables. An equation has been given below and it is needed
to implement in the Matlab language. The equation is,
(100 e2xy log(cos(2xy)3))
- 100
I know this is looking tough. But, it is too
easy to implement in Matlab. We have to be more careful when we put the parentheses
for the equation in Matlab.
We can write the ‘ e-2xy ‘
to ‘exp(2*x*y)’ in Matlab.
From ‘ cos(2xy)3 ‘ to ‘ cos(2*x*y).^3) ’ in Matlab.
Then, ‘ log(cos(2xy)3) ‘ to ‘ log(cos(2*x*y).^3) ‘ in Matlab.
Now, time to merge all of them in one and it will be look like below.
(100*exp(2*x*y)*log(cos(2*x*y).^3))-100;
Now, you are thinking that how will I print it. Simply, put the variable's value in a variable ‘a’. And then print it and also give values for the ‘x’ and ‘y’ variables.
x=4;
y=3;
a =
(100*exp(2*x*y)*log(cos(2*x*y).^3))-100;
fprintf('ans: %.2f',a)