Wednesday, September 2, 2015

Visualizing the patterns in the sets of complex and real roots of quadratic and cubic equations


I came across a previous awesome question about the visualization of the distribution of polynomial roots and tried to do a simpler version applied first to the set of real roots of quadratic equations ax^2+bx+c=0 and then to cubic equations ax^3+bx^2+cx+d=0 to visualize the complex roots (meaning all the roots of the equation represented as complex numbers) and only the real roots (a subset of the complex roots when the imaginary part is zero).

To visualize the pattern of the relationship between the set of roots of the quadratic equations, I prepared a Python program to calculate the roots x1,x2 only for the specific values of the intervals a in [−ai,ai], b in [−bi,bi], c in [−ci,ci], a,b,c are natural numbers N. If the limits ai,bi,ci are very big, the set of roots is very dense and it is very difficult to visualize the emerging pattern.

Complex roots of quadratic equations in Cartesian coordinates (x = real part of the root, y = imaginary part of the root). ai=bi=ci=75:



Complex roots of quadratic equations represented in polar coordinates (theta = real part of the root, r = imaginary part of the root). ai=bi=ci=65:


Real roots (subset of the complex roots whose imaginary part is zero) of quadratic equations represented in Cartesian coordinates (x,y)=(x1,x2). E.g. ai,bi,ci=75:


This is an special subset: real roots (subset of the complex roots whose imaginary part is zero) of quadratic equations whose coefficients are irrational numbers, when ai,bi,ci=575 and using only the square roots of the prime numbers of those intervals, sqrt(a)/a in [−ai,ai], sqrt(b)/b in [−bi,bi], sqrt(c)/c in [−ci,ci]. This will show the pattern of the roots only for a) a,b,c irrationals (because the square roots of prime numbers are irrational numbers) and still constrained to b) x1,x2 in R:


Real roots (subset of the complex roots whose imaginary part is zero) of quadratic equations represented in polar coordinates (theta,r)=(x1,x2). E.g. ai,bi,ci=75:


Due to the symmetries the opposite patterns (x,y)=(x2,x1) and (theta,r)=(x2,x1) are similar.

Real roots (subset of the complex roots whose imaginary part is zero) of quadratic equations represented in spherical coordinates (theta,phi,r)=(x1,x2,1). E.g. ai,bi,ci=25:




Here is an animation (it will take a little bit to upload, please be patient)



So basically there seems to be a pattern in the relationship between both real roots that can be visualized.

Here is the same exercise for the three roots (x1,x2,x3) of the cubic equations. 

Complex roots of cubic equations represented in Cartesian coordinates (the x value is the real value and the y value is the imaginary value):



Complex roots of cubic equations represented in polar coordinates, (theta, r), each root will be represented by the angle theta = real part of the root and the radius r = the imaginary part of the root.


Representing the real roots requires more imagination because there are three real roots and is possible to play with the symmetry of the roots.

Real roots (subset of the complex roots whose imaginary part is zero) of cubic equations represented in Cartesian coordinates (x,y)=(x1,x2),(x1,x3),(x2,x3),(x2,x1),(x3,x1),(x3,x2). E.g. ai,bi,ci=25:


Real roots (subset of the complex roots whose imaginary part is zero) of cubic equations represented in polar coordinates (theta,r)=(x1,x2),(x1,x3),(x2,x3),(x2,x1),(x3,x1),(x3,x2). E.g. ai,bi,ci=20:


Finally, the real roots (subset of the complex roots whose imaginary part is zero) of cubic equations represented in spherical coordinates (theta,phi,r)=(x1,x2,1),(x2,x3,1),(x1,x3,1),(x2,x1,1),(x3,x2,1),(x3,x1,1). E.g. ai,bi,ci=25:


I would like to learn other methods to visualize the sets of roots and would appreciate very much any feedback about this subject.

1 comment:

  1. dear...do u work as freelancer ,,, to build some codes ?

    ReplyDelete