Azzera filtri
Azzera filtri

I need help with imaginary numbers!

4 visualizzazioni (ultimi 30 giorni)
How can I count the amount of numbers for which and imaginary number is less than lets say 1000.
For example display the number of negative integers for which i^(1.7) is less than 1000. I know this may not be much to go off of but that's all I have and I have no idea how to approach this problem. I'd appreciate any help

Risposta accettata

Roger Stafford
Roger Stafford il 25 Giu 2016
Modificato: Roger Stafford il 25 Giu 2016
You should understand that matlab’s “<“ operator only tests the real part of a complex number. For a pure imaginary number it would be treated as if it were zero, since the real part would be zero in this case.
Think of complex numbers as points in the infinite two-dimensional plane, with the real numbers along the x-axis and the pure imaginary numbers along the y-axis. Adding complex numbers is the same as adding the two vectors by the parallelogram law that point from the origin to the two points. Multiplying them is multiplying their magnitudes (lengths) and then adding their angles measured counterclockwise from the real line (x-axis.) That means that you have:
(a+b*i) + (c+d*i) = (a+c) + (b+d)*i
(a+b*i) * (c+d*i) = (a*c-b*d) + (a*d+b*c)*i
You can see that the concept of less than is somewhat vague as applied to complex numbers since you are asking which of two points in the plane is less than the other. Does it mean closer to the origin, further to the left, or below? All of these would be possible meanings. You have to decide which you mean and then apply matlab accordingly.
The concept of taking a complex number to an integer power is that of multiplying its angle with respect to the real line by the factor of that power and expanding its magnitude by a factor of this same power. Taking its n-th root is a matter of finding a complex number which can be taken to the n-th power and achieving the given complex number. You will find that this latter is not unique, since there will always be n different way of accomplishing that.
As far as i^(1.7) is concerned you can think of it as (i^10)^(1/17), and accordingly it has seventeen different possible results. Matlab will give you only one of these.
That’s enough about complex number theory. It’s a very large topic in mathematics.

Più risposte (1)

Walter Roberson
Walter Roberson il 24 Giu 2016
small_imag_count = sum(imag(YourArray(:)) < 1000);
  1 Commento
Walter Roberson
Walter Roberson il 25 Giu 2016
You can convert x^y to exponential form. In the particular case of y > 0 and x < 0, it becomes
exp(y*ln(-x))*cos(y*Pi) + 1i * exp(y*ln(-x))*sin(y*Pi)
you can then take the real or imaginary portions, which would be
exp(y*ln(-x))*cos(y*Pi)
or
exp(y*ln(-x))*sin(y*Pi)
for the imaginary part.
You can substitute in the 1.7 for y, and then solve what comes out for equality to 1000. Though if you do that for the imaginary part you will find no solutions -- for negative x, the imaginary part of x^1.7 is negative.

Accedi per commentare.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by