### Welcome to our site!

#### Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Status
Not open for further replies.

#### j.friend

##### New Member
Ok so we all presumably know that you annot take the log of a negative number, however what happens if you had a log such as:

2log(-1)

Straight away this would seem that it is undefined as you connot take the log of a negative number, however this can also be written as log[(-1)^2],
and (-1)^2 = 1.
using this the expression 2log(-1) could be calculated to = 0

Any thoughts as to the validity of this?

#### MrAl

##### Well-Known Member
Hello,

Yes. The problem you are running into is that when you have an equation
that would have arisen from some physical phenomenon like:

2*log(-1)

assuming it is valid of course, and then to go ahead and transform it into:

log((-1)^2)

would be killing any possibility of finding the true value of the original equation.
Thus, you get 0 instead of the true answer which could be zero AND another
number (two solutions).

If that original equation did arise from some real physical phenomenon, then
the chances are that it should be solved just as is. The thing to remember
when solving it is that although log(x) is not defined for -x over the reals,
that is not the only way to define it. It could also be defined over the
complex numbers, in which case we have a solution:
2*ln(-1)=2*j*pi
or in complex notation:
2*ln(-1)=(0,2*pi)

Note i assumed that your "log" was really the natural log above.
If you really meant "log10" then divide the above answers by ln(10).

BTW, the way to calculate ln(x) for negative real x is to take the natural log
of the absolute value of x and make that the real part of the answer, then
simply make the imaginary part of the answer equal to pi.
Thus, for ln(-2) the solution would be (ln(2),pi), or ln(2)+j*pi

(Note j here is the imaginary operator, sometimes denoted instead by i).

Last edited:

#### j.friend

##### New Member
wow thankyou.
It was supposed to be log10, but it is not a question or anything, just something we thought up of in class one day which is quite interesting.

Just interested to see what people thought. I was unaware that complex numbers could be applied to logarithmic functions also, however now that i think of it it seems logical.

#### j.friend

##### New Member
Hello,

Yes. The problem you are running into is that when you have an equation
that would have arisen from some physical phenomenon like:

2*log(-1)

assuming it is valid of course, and then to go ahead and transform it into:

log((-1)^2)

would be killing any possibility of finding the true value of the original equation.
Thus, you get 0 instead of the true answer which could be zero AND another
number (two solutions).

If that original equation did arise from some real physical phenomenon, then
the chances are that it should be solved just as is. The thing to remember
when solving it is that although log(x) is not defined for -x over the reals,
that is not the only way to define it. It could also be defined over the
complex numbers, in which case we have a solution:
2*ln(-1)=2*j*pi
or in complex notation:
2*ln(-1)=(0,2*pi)

Note i assumed that your "log" was really the natural log above.
If you really meant "log10" then divide the above answers by ln(10).

BTW, the way to calculate ln(x) for negative real x is to take the natural log
of the absolute value of x and make that the real part of the answer, then
simply make the imaginary part of the answer equal to pi.
Thus, for ln(-2) the solution would be (ln(2),pi), or ln(2)+j*pi

(Note j here is the imaginary operator, sometimes denoted instead by i).

when you say that you can calculate by making the the imaginary part equal pi, why is this so?
Wouldn't it be like other complex calculations where you have to transform it to polar form.

i.e. ln(-1) = ln(cis(pi))

I would not be surprised however if some special rules apply to logarithmic functions for complex numbers

#### MrAl

##### Well-Known Member
Hi again,

Making the imaginary part equal to pi is a shortcut that works when
the real part of the argument is a negative number like -2.
For any given negative number -n, ln(-n)=ln(n)+j*pi, and of course
when -n=-1 the natural log of 1 is 0 so we end up with just j*pi.

This works because the real number -1 is just like the complex
number (-1,0) where the imaginary part is zero.

The more general definition covers all the complex numbers with
both real and imaginary parts...

For a complex number (r,i) where r is the real part and i is the
imaginary part:

ln((r,i))=ln(norm(r,i),angle(r,i))
so the real part of the answer is:
norm(r,i)
and the imaginary part is:
angle(r,i).

In the above, norm(r,i) is the same as the abs(r,i) or |(r,i)|,
and angle(r,i) is the same as the two argument atan(r,i).
abs(r,i) is simply equal to sqrt(r^2+i^2) and
atan(r,i) is the full circle two argument version of atan(y).
(sqrt(r^2+i^2),atan(r,i)) or
sqrt(r^2+i^2)+j*atan(r,i)
depending on how you want to write it.

Note that for atan(r,i) we MUST use the two argument version and
can not use the single argument form atan(r/i) because it will not
always produce the correct angle.

Also, to get a better feel for what we are doing here it helps a little
to look at the complex plane and plot the number you want to take
the log of. For the real number -1 that we have been looking at,
-1 appears to the left of the y axis (imag axis) and directly on
the x axis, so it's angle is 180 degrees or pi radians. This is how
we can understand what happens when the imaginary part i is zero,
and also for some other special cases.

Last edited:

#### j.friend

##### New Member
wow thankyou very much. Much easier to use the shortcut i would say.

One thing however, when you are saying that for the imagniary part of the log is j*pi, does j stand for the integer i.e. the absolute value of the number which the log is being taken.

e.g. ln(-1) = ln(1) + 1*pi

so ln(-2) = ln(2) + 2*pi

is this right?

Last edited:

#### MrAl

##### Well-Known Member
wow thankyou very much. Much easier to use the shortcut i would say.

One thing however, when you are saying that for the imagniary part of the log is j*pi, does j stand for the integer i.e. the absolute value of the number which the log is being taken.

e.g. ln(-1) = ln(1) + 1*pi

so ln(-2) = ln(2) + 2*pi

is this right?

Hi again,

Well, no. Lower case 'j' is used to represent what is called the
"imaginary operator", and it is used to represent the imaginary part
of complex numbers like this:
a+b*j
where
a is the real part and
b is the imaginary part.

In other words, the complex number has two distinct parts unlike an 'ordinary' number like 1, 2, 3, etc.
It's like a vector with two elements.

Sometimes lower case 'i' is used instead like this:
a+b*i
however the lower case i is often used to represent current in electrical

The numerical equivalent of j is the square root of minus 1, or:
j=sqrt(-1)

If you were to write this out in the form (real, imag) as complex numbers
sometimes are, the equivalent would be:
j=(0,1)
but the algebraic form a+b*j is still:
0+j
which of course equals j because the real part a=0 and the imaginary
part b=1. Thus, a+b*j=0+1*j.

I might add that you can never simply drop the j however, as it shows
what the imaginary part is. You can find the magnitude however by
using:
mag=sqrt(real^2+imag^2)
which is also called the amplitude sometimes.

For an example, sometimes there are two solutions to a quadratic equation that are both complex.
That is, the only solutions to the equation are complex because when inserted back into the
equation they are the only solutions that lead to a true zero result.

Last edited:

#### j.friend

##### New Member
I do know bout complex numbers I was just unaware that "j" was used in place of "i" sometimes, and i missed the bit at the end of your previous post.

thank you very much for explaining it, it has managed to confuse my maths teacher

Status
Not open for further replies.

Replies
4
Views
4K
Replies
6
Views
2K
Replies
23
Views
3K
Replies
5
Views
1K
Replies
19
Views
6K