Determine polynomial coefficients so that it's roots lie on the unit circle

19 visualizaciones (últimos 30 días)
Given the quadratic function in , I want to know under what conditions for a and b, all polynomial roots lie on the circle center (0,0) radius 1.
I started off with
syms a b
p = [1 a b];
roots(p);
r = roots(p);
So that r(1) and r(2) are the roots of my polynomial (z_1, z_2).
Now, these solutions lie on the unit circle if and only if their distance to the origin (their modulus) is less than or equal to 1.
According to MATLAB Documentation, the abs() function returns "absolute value and complex magnitude", but when i try
abs(r(1))
MATLAB isn't really taking into consideration that this number can be a complex number and just returns a positive version of itself.
What am I doing wrong or not considering?
P.S. I know this is something which can be done off by hand, but I also want to learn MATLAB, not only solve my problem.
  4 comentarios
Basil C.
Basil C. el 13 de Mzo. de 2021
@Walter Roberson if a and b belong to complex set then problem gets a bit complicated, however i suppose the question indicates roots of f(z) are complex
Walter Roberson
Walter Roberson el 13 de Mzo. de 2021
A polynomial belongs to if at least one coefficient of expanded series is not real-valued. A polynomial is not said to belong to if it has real coefficients but variable happens to be complex.

Iniciar sesión para comentar.

Respuestas (3)

Bruno Luong
Bruno Luong el 16 de Mzo. de 2021
Editada: Bruno Luong el 16 de Mzo. de 2021
For
P(z) = a*z^2 + b*z + c;
I claim this is these two conditions are equivalent to the fact that P has two roots on unit circle (a/b/c coefficients can be complex or real, no restriction whatsoever):
  • |a| = |c|
  • b = rho*sqrt(a*c) for arbitrary rho, real such that |rho| <= 2
>> a = randn()+1i*randn();
>> c = a*exp(2i*pi*rand); % first condition
>> rho = 4*(rand()-0.5); b = rho*sqrt(a*c); % second condition
>> abs(roots([a b c]))
ans =
1.0000
1.0000
Another equivalent way to write these two conditions are:
  • |b| <= 2*|a|
  • rho := +/- |b|/|a|
  • c = (b/rho)^2/a
>> a = randn()+1i*randn();
>> rho = 4*(rand()-0.5); theta=rand()*2*pi; b = rho*exp(1i*theta)*a;
>> c = (b/rho)^2/a;
>> abs(roots([a b c]))
ans =
1.0000
1.0000
It is probably equivalent to other answers, I did not read them carefully.

Basil C.
Basil C. el 13 de Mzo. de 2021
For the equation always has roots in complex field C.
Let p and are its complex roots,
then product of roots is = b
Since you need roots lie on the circle |z|=1
Hence for any real value of a such that or the complex root will lie on circle
To prove via matlab
syms a b
p = [1 a b];
r = roots(p)
value_of_b = solve(r(1)*r(2)==1,b)
You can verify the above results using
r = roots([ 1 1.5 1]);
abs(r(1))
abs(r(2))
  1 comentario
Walter Roberson
Walter Roberson el 13 de Mzo. de 2021
Let the roots of the polynomial be 1+1i and 2-2i then the polynomial is
syms z
f(z) = expand((z-(1+1i)) * (z-(2-2i)))
f(z) = 
R = fliplr(coeffs(f(z), z))
R = 
roots(R)
ans = 
We have confirmed that the polynomial has the roots we choose.
However... the roots are not complex conjugates of each other.
If we let the roots be c+1i and d+i/2 real c d
syms c d real
f(z) = expand((z-(c+1i)) * (z-(d+i/2)))
f(z) = 
R = fliplr(coeffs(f(z), z))
R = 
a = R(2)
a = 
b = R(3)
b = 
roots([1 a b])
ans = 
confirming that we extract the roots correctly.
and we want abs() of them to be <= 1
syms d1 d2
assume(d1>=0 & d2>=0)
simplify(expand((c+i)*conj(c+i) + d1 == 1^2))
ans = 
sol = solve(simplify(expand((d+i/2)*conj(d+i/2) + d2 == 1^2)), d, 'returnconditions', true)
sol = struct with fields:
d: [2×1 sym] parameters: [1×0 sym] conditions: [2×1 sym]
sol.d
ans = 
sol.conditions
ans = 
So for example,
F(z) = expand((z-i)*(z-(1/4-i/2)))
F(z) = 
Fsol = solve(F)
Fsol = 
abs(Fsol)
ans = 
simplify(abs(Fsol) <= 1)
ans = 
Complex roots that are not complex conjugate, but are on or inside the unit circle.
R = fliplr(coeffs(F(z), z))
R = 
%is a^2 < 4*b ?
[R(2)^2, 4*R(3)]
ans = 
The two parts are complex; one is not less than or greater than the other.

Iniciar sesión para comentar.


John D'Errico
John D'Errico el 13 de Mzo. de 2021
Editada: John D'Errico el 14 de Mzo. de 2021
This seems simple enough, though the result may not seem terribly pretty. Brute force often has that result.
syms a b z
P = z^2 + a*z + b == 0;
zsol = solve(P,z)
zsol = 
No constraints on a and b so far here, these are the roots. But since a and b could be complex, we want to know if the roots lie in the unit circle. And that rquires they must have magnitude less than or equal to 1. We can get the square of the magnitudes as simply:
zmag = expand(diag(zsol*zsol'))
zmag = 
So zmag is always a vector of length 2. The requirement for the roots to lie in the unit circle in the complex plane is a simple one, only that both elements of zmag MUST be no larger than 1. (They will always be real and non-negative by construction, even for complex a and b.)
There is no need to take the sqrt there. All we need is for both elements of zmag to be <= 1, so we have a pair of simple inequality constraints. if zmag is <= 1, then sqrt(zmag) is also <= 1. This is a constraint purely on a and b, and both constraints must apply for both roots to lie inside the unit circle. The sigma terms in there are just to make it look a little neater. I could use matlabFunction to express it in the form of a function handle, if I wanted.
zmagfun = matlabFunction(zmag,a,b)
zmagfun = function_handle with value:
@(a,b)deal([(conj(sqrt(b.*-4.0+a.^2)).*sqrt(b.*-4.0+a.^2))./4.0+(a.*conj(sqrt(b.*-4.0+a.^2)))./4.0+(conj(a).*sqrt(b.*-4.0+a.^2))./4.0+(a.*conj(a))./4.0;(conj(sqrt(b.*-4.0+a.^2)).*sqrt(b.*-4.0+a.^2))./4.0-(a.*conj(sqrt(b.*-4.0+a.^2)))./4.0-(conj(a).*sqrt(b.*-4.0+a.^2))./4.0+(a.*conj(a))./4.0],a,b)
The only real question is if this can be simplified. I'm not sure that is necessary or if even easy to do. But it answers the question directly as a strict pair of constraints on a and b, such that the roots lie as needed.
We can try an example:
atest = rand() + i*rand()
atest = 0.9269 + 0.6164i
btest = rand() + i*rand()
btest = 0.5067 + 0.3926i
double(subs(subs(zmag,a,atest),b,btest))
ans = 2×1
0.4032 1.0192
Remember, they are the SQUARES of the root magnitudes. Since BOTH elements of zmag are <= 1, then I will predict the roots lie inside the unit circle in the complex plane.
Verify that, by computing the roots themselves.
zroots = roots([1,atest,btest])
zroots =
-0.3783 - 0.9360i -0.5486 + 0.3196i
abs(zroots).^2
ans = 2×1
1.0192 0.4032
The square of the root magnitudes is correct. As predicted, both roots lie inside the unit circle. Had I chosen atest and btest differently, the roots need not lie inside the unit circle. (In fact, I made several random attempts before I found a pair that yieled roots inside the unit circle. Most of my initial trials seemed to fall with one inside and the other outside.)
Finally, I might add that interesting variations on this problem could be to find the locus of solutions such that both roots lie EXACTLY on the perimeter of the unit circle, or to find the locus of solutions such that a and b are real numbers. But those were not the questions posed here.
For example, if a and b are real numbers, how does zmag simplify? We might do this:
assume(a,'real')
assume(b,'real')
simplify(zmag)
ans = 
That result is much simpler. Now a little effort would allow you to plot the region of interest.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by