randRangeNonZero(-10, 10) randRangeNonZero(-10, 10) randRangeNonZero(-10, 10) splitRadical(B*B - 4*A*C)[0] splitRadical(B*B - 4*A*C)[1] new Polynomial( 0, 2, [C, B, A], "x" ) F.text() splitRadical(B*B - 4*A*C) getGCD( B, 2 * A, Math.sqrt( DISC_FACTOR[0] ) ) (function() { var wrongs = []; for ( var i = 0; i < 5; i++ ) { var bad_a = randRangeNonZero(-10, 10); var bad_b = randRangeNonZero(-10, 10); var bad_c = randRangeNonZero(-10, 10); var good_gcd = getGCD( A, B, C ); var bad_gcd = getGCD( bad_a, bad_b, bad_c ); while (( abs(A*bad_gcd) === abs(bad_a*good_gcd) && abs(B*bad_gcd) === abs(bad_b*good_gcd) && abs(C*bad_gcd) === abs(bad_c*good_gcd) ) || (( (bad_b * bad_b) - (4 * bad_a * bad_c) ) < 0)) { bad_a = randRangeNonZero(-10, 10); bad_b = randRangeNonZero(-10, 10); bad_c = randRangeNonZero(-10, 10); good_gcd = getGCD( A, B, C ); bad_gcd = getGCD( bad_a, bad_b, bad_c ); } wrongs.push(quadraticRoots(bad_a, bad_b, bad_c)); } return wrongs; })()

Let f(x) = F_TEXT.

Where does this function intersect the x-axis (i.e. what are the roots or zeroes of f(x))?

quadraticRoots(A, B, C)

  • WRONGS[0]
  • WRONGS[1]
  • WRONGS[2]
  • WRONGS[3]
  • WRONGS[4]

The function intersects the x-axis when f(x) = 0, so you need to solve the equation:

F_TEXT = 0

Use the quadratic formula to solve ax^2 + bx + c = 0:

x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}

a = A, b = B, c = C

x = \frac{-B \pm \sqrt{B^2 - 4 \cdot A \cdot C}}{2 \cdot A}

x = \frac{-1*B \pm \sqrt{B*B - 4*A*C}}{2*A}

x = \frac{-1*B \pm formattedSquareRootOf(B*B-4*A*C)}{2*A}

quadraticRoots(A, B, C)