# Khan/khan-exercises

Fetching contributors…
Cannot retrieve contributors at this time
202 lines (178 sloc) 9.86 KB
randRangeNonZero(-10, 10) randRangeNonZero(-10, 10) randRangeNonZero(-10, 10) B * B - 4 * A * C

EQUATION = 0

Solve for x.

• WRONGS[0]
• WRONGS[1]
• WRONGS[2]
• WRONGS[3]
• WRONGS[4]
shuffle([coefficient(A) + "x^2", coefficient(B) + "x", C]).join("+") coefficient(A) + "x^2+"+ coefficient(B) + "x+" + C

Get the equation into the form ax^2 + bx + c = 0:

shuffle([0, 1, 2]) [coefficient(A) + "x^2", coefficient(B) + "x", C] [coefficient(-A) + "x^2", coefficient(-B) + "x", -C] TERMS.join("+")

TERMS[N1] + TERMS[N2] = NEGTERMS[N3]

Solve for x.

Get the equation into the form ax^2 + bx + c = 0:

\qquadTERMS[N1] + TERMS[N2] + TERMS[N3] = 0

shuffle([0, 1, 2]) [coefficient(A) + "x^2", coefficient(B) + "x", C] [coefficient(-A) + "x^2", coefficient(-B) + "x", -C] TERMS.join("+")

TERMS[N1] = NEGTERMS[N2] + NEGTERMS[N3]

Solve for x.

Get the equation into the form ax^2 + bx + c = 0:

\qquad \begin{eqnarray} TERMS[N1] + TERMS[N2] &=& NEGTERMS[N3] \\ TERMS[N1] + TERMS[N2] + TERMS[N3] &=& 0 \\ F.text() &=& 0 \end{eqnarray}

randRangeExclude(-10, 10, [0, A]) B C A1 - A shuffle([0, 1, 2]) [coefficient(A1) + "x^2", coefficient(B) + "x", C] [coefficient(A) + "x^2", coefficient(B) + "x", C]

TERMS1[N1] + TERMS1[N2] + TERMS1[N3] = coefficient(A2) + "x^2"

Solve for x.

Get the equation into the form ax^2 + bx + c = 0:

\qquad \begin{eqnarray} TERMS2[N1] + TERMS2[N2] + TERMS2[N3] &=& 0 \\ F.text() &=& 0 \end{eqnarray}

randRangeExclude(-10, 10, [0, B]) B1 - B shuffle([0, 1, 2]) [coefficient(A) + "x^2", coefficient(B1) + "x", C] [coefficient(A) + "x^2", coefficient(B) + "x", C]

TERMS1[N1] + TERMS1[N2] + TERMS1[N3] = coefficient(B2) + "x"

Solve for x.

randRangeExclude(-10, 10, [0, C]) C1 - C shuffle([0, 1, 2]) [coefficient(A) + "x^2", coefficient(B) + "x", C1] [coefficient(A) + "x^2", coefficient(B) + "x", C]

TERMS1[N1] + TERMS1[N2] + TERMS1[N3] = C2

Solve for x.

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

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

\qquad a = A, b = B, c = C

\qquad x = \dfrac{-negParens(B) \pm \sqrt{expr(["^", B, 2]) - 4 \cdot A \cdot C}}{2 \cdot A}