Tuesday, 4 July 2017

HOW TO SOLVE LOGARITHMIC EQUATION ON PAPER AND MATLAB

Let us learn how to solve logarithmic equations using the simple laws of logarithm.
 first, lets review these simple laws of logarithm

log(ab)= log(a) + log(b)................ multiplication law

log(a/b)= log(a) - log(b)................division

log(x^y)= ylog(a)........................power law (the symbol, ^ stands for 'raised to power')

Also, there is a relationship between logarithm and indices which states that:

if,

n=  m^p, then

logm(n) = p


Now, lets solve an example using these laws

Solve this logarithmic equation:  2logb(5) + 1/2logb(9) - logb(3) = logb(x)............eqn(a)

please note that the log is in base b which could any base, say 10, 2, 5...

Eqn(a) above can be simplified using the power law, breaking it down to

logb(5^2) +logb(9^0.5) - logb(3) = logb(x).............eqn(b)

please note that I changed 1/2 to 0.5 just for clarity sake, it does not change anything, so you can choose to write it as 1/2 on paper.

 since all the logarithm above are of the same base, we  can write the equation above as

logb(25 + 3 - 3)= logb(x)
which is the same as

logb(25) = logb(x)...............eqn(c)

since the log on both sides of the equation are of the same base it therefore implies that

   x = 25



HOW TO SOLVE IT WITH MATLAB

Here's how to solve the above logarithmic equation with matlab. All expressions starting with % are my own comments, they are not part of the program

>> % solving logarithmic equations on matlab.
%lets first define the variables
m=2.*log(5);
n=1/2.*log(9);
p=log(3);
% I didint add any base because it does not matter which base is used since all the log are all in the same base.
k=m+n-p

k =

    3.2189

>> % lets use symbolic command to connect both sides of the equation. this is how to do it.
>> sym 3.2189=log(x)

ans =

3.2189 == log(x)

>> solve(ans)

ans =

25.000604385600502609379852928404

>> %matlab gave the answer as a floating point number which is correct to 16 decimal places

No comments:

Post a Comment

RELATED POSTS

HOW TO SOLVE LOGARITHMIC EQUATION ON PAPER AND MATLAB