For Programmers: Free Programming Magazines  


Home > Archive > Matlab > December 2005 > Why is this evaluation is not giving me the same solution









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Why is this evaluation is not giving me the same solution
Koang

2005-12-16, 7:10 pm

I have been struggling with the evaluation of imaginary numbers and I
think what am experiencing is getting me nowhere. Here is the
problem. I am trying to find the quotient of imaginary numbers.

a=i*sqrt(i);
b=sqrt(-i);
c=a/a = 1;
d=a/b = -1;

I thought that sqrt(-i)=sqrt(i^3)=i*sqrt(i);

My question is why am I not getting the same answer? I thought I
should get the same answer no matter what since
sqrt(-i)=sqrt(i^3)=i*sqrt(i). I try all math software (mathlab,
mathcad, maple) and not surprisingly enough the answer to c and d are
different. Is there any explaination?

I would highly welcome any feedback

Koang
Roger Stafford

2005-12-16, 7:10 pm

In article <ef2009e.-1@webx.raydaftYaTP>, Koang <kthich@hotmail.com> wrote:

> I have been struggling with the evaluation of imaginary numbers and I
> think what am experiencing is getting me nowhere. Here is the
> problem. I am trying to find the quotient of imaginary numbers.
>
> a=i*sqrt(i);
> b=sqrt(-i);
> c=a/a = 1;
> d=a/b = -1;
>
> I thought that sqrt(-i)=sqrt(i^3)=i*sqrt(i);
>
> My question is why am I not getting the same answer? I thought I
> should get the same answer no matter what since
> sqrt(-i)=sqrt(i^3)=i*sqrt(i). I try all math software (mathlab,
> mathcad, maple) and not surprisingly enough the answer to c and d are
> different. Is there any explaination?
>
> I would highly welcome any feedback
>
> Koang

----------------------
Hello Koang,

Your mistake comes at the step, sqrt(i^3) = i*sqrt(i), in trying to
remove the i^2 factor from inside the square root. There is a similar
anomaly with the following reasoning:

2 = sqrt(4) = sqrt((-1)^2*4) = (-1)*sqrt(4) = -2

For numbers that are real and positive, it is easy to decide that all
square roots will be chosen positive, and to avoid taking the square root
of negative numbers. In the complex plane it is somewhat more difficult
to decide which of two possible values to give as square root. If you
commence at the real value z = 1, starting with a sqrt(z) value of 1, and
then travel around the origin counterclockwise in a circle through 360
degrees, always making sure that the square root remains a continuous
function, you will be forced to arrive back at z = 1 with a square root
value of -1! If you travel around the circle once again, you will return
to a square root value of +1. This gives you a hint of what is meant by
the statement that the analytic function, square root, has two
"branches". This gives rise to all sorts of anomalies such as the one you
have produced.

Matlab gives only a "principal" value for the 'sqrt' function, which
always chooses the square root that has the a non-negative value for its
real part. Hence,

sqrt(i^3) = sqrt(-i) = 0.7071 - 0.7071i
i * sqrt(i) = i * (0.7071 + 0.7071i) = -0.7071 + 0.7071i

There is no way out of this dilemma, once you have chosen that convention
for a principal value. Furthermore any other convention would be bound to
run into similar paradoxes. It is important to recognize the presence of
two values on the two branches for every square root even if only one of
them is produced as a principal value.

(Remove "xyzzy" and ".invalid" to send me email.)
Roger Stafford
Koang

2005-12-16, 9:59 pm

Roger Stafford wrote:
>
>
> In article <ef2009e.-1@webx.raydaftYaTP>, Koang
> <kthich@hotmail.com> wrote:
>
> and I
I[color=darkred]
d[color=darkred]
> are
> ----------------------
> Hello Koang,
>
> Your mistake comes at the step, sqrt(i^3) = i*sqrt(i), in trying
> to
> remove the i^2 factor from inside the square root. There is a
> similar
> anomaly with the following reasoning:
>
> 2 = sqrt(4) = sqrt((-1)^2*4) = (-1)*sqrt(4) = -2
>
> For numbers that are real and positive, it is easy to decide that
> all
> square roots will be chosen positive, and to avoid taking the
> square root
> of negative numbers. In the complex plane it is somewhat more
> difficult
> to decide which of two possible values to give as square root. If
> you
> commence at the real value z = 1, starting with a sqrt(z) value of
> 1, and
> then travel around the origin counterclockwise in a circle through
> 360
> degrees, always making sure that the square root remains a
> continuous
> function, you will be forced to arrive back at z = 1 with a square
> root
> value of -1! If you travel around the circle once again, you will
> return
> to a square root value of +1. This gives you a hint of what is
> meant by
> the statement that the analytic function, square root, has two
> "branches". This gives rise to all sorts of anomalies such as the
> one you
> have produced.
>
> Matlab gives only a "principal" value for the 'sqrt' function,
> which
> always chooses the square root that has the a non-negative value
> for its
> real part. Hence,
>
> sqrt(i^3) = sqrt(-i) = 0.7071 - 0.7071i
> i * sqrt(i) = i * (0.7071 + 0.7071i) = -0.7071 + 0.7071i
>
> There is no way out of this dilemma, once you have chosen that
> convention
> for a principal value. Furthermore any other convention would be
> bound to
> run into similar paradoxes. It is important to recognize the
> presence of
> two values on the two branches for every square root even if only
> one of
> them is produced as a principal value.
>
> (Remove "xyzzy" and ".invalid" to send me email.)
> Roger Stafford
>


Roger Stafford,

That make alot of sense. So, I shouldn't simplify sqrt(-i) in order
to get a correct answer right? Thank you.

Koang
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com