Google Classroom
GeoGebraGeoGebra Classroom

Complex roots of ax^2+bx+c

Scripting

n = Slider(0, 10, 1, 1, 170, false, true, false, false) N = Sequence(k, k, 0, (2*n+1)^3-1) A = Zip(Mod(m, 2*n+1)-n, m, N) B = Zip(Mod(floor(m/(2*n+1)), 2*n+1)-n, m, N) C = Zip(Mod(floor(m/(2*n+1)^2), 2*n+1)-n, m, N) LP = RemoveUndefined( Zip( If( b^2-4*a*c < 0 , 1/(2*(a + ί * 0))*(-(b + ί * 0) + ( (b + ί * 0)^2-4*(a + ί * 0)*(c + ί * 0) )^(1/2) ) ) , a, A, b, B, c, C) ) LN = RemoveUndefined( Zip( If( b^2-4*a*c < 0 , 1/(2*(a + ί * 0))*(-(b + ί * 0) - ( (b + ί * 0)^2-4*(a + ί * 0)*(c + ί * 0) )^(1/2) ) ) , a, A, b, B, c, C) ) Execute(Sequence("A"+k+" = Element(LP, "+k+")", k, 1, Length(LP))) Execute(Sequence("B"+k+" = Element(LN, "+k+")", k, 1, Length(LN))) Execute(Sequence("ShowLabel(A"+k+", false)", k, 1, Length(LP))) Execute(Sequence("ShowLabel(B"+k+", false)", k, 1, Length(LN))) Execute(Sequence("SetPointSize(A"+k+", 2)", k, 1, Length(LP))) Execute(Sequence("SetPointSize(B"+k+", 2)", k, 1, Length(LN))) Execute(Sequence("SetPointStyle(A"+k+", 10)", k, 1, Length(LP))) Execute(Sequence("SetPointStyle(B"+k+", 10)", k, 1, Length(LN))) H(x, y) = (π -atan2(y,-x)) / (2π) Execute(Sequence("SetDynamicColor(A"+k+", H(x(A"+k+"), y(A"+k+")), 1, 1)", k, 1, Length(LP))) Execute(Sequence("SetDynamicColor(B"+k+", H(x(B"+k+"), y(B"+k+")), 1, 1)", k, 1, Length(LN))) ShowGrid( false ) ShowAxes( false ) CenterView((0,0))