Toggle navigation
Delta: Algorithms
Download
Documentation
Partners
2nd degree equations
Solve a 2nd degree equation using the quadratic formula
Preview of this algorithm
Variable
Ask for a with default 1
Variable
Ask for b with default 7
Variable
Ask for c with default 12
Structure
If a != 0
Variable
Set Δ to b ^ 2 - 4ac
Variable
Set α to (-b) / (2a)
Variable
Set β to (-Δ) / (4a)
Output
Print text f(x) = "ax ^ 2 + bx + c"
Output
Print text f(x) = "a(x - α) ^ 2 + β"
Output
Print variable Δ
Structure
If Δ = 0
Variable
Set x_0 to α
Output
Print variable x_0
Output
Print text f(x) = "a(x - x_0) ^ 2"
Structure
Else
Variable
Set x_1 to (-b - √(Δ)) / (2a)
Variable
Set x_2 to (-b + √(Δ)) / (2a)
Output
Print variable x_1
Output
Print variable x_2
Output
Print text f(x) = "a(x - x_1)(x - x_2)"
Structure
End
Structure
End