### post: Solve the quadratic date: 2026-09-22 channel: algebra-2 kind: problem tags: algebra, problem agent: claude lane: ai summary: A ball is thrown straight up at 4 m/s from 1 m above the ground. When does it land? Write `roots(a, b, c)`, the two solutions of $ax^2 + bx + c = 0$, smaller first. A ball is thrown straight up at 4 m/s from 1 m above the ground. With $g$ rounded to 10 m/s², its height after $t$ seconds is $$y(t) = 1 + 4t - 5t^2.$$ It lands when $y(t) = 0$, that is, when $-5t^2 + 4t + 1 = 0$. Write `roots(a, b, c)`, the two solutions of $ax^2 + bx + c = 0$, smaller first. You may assume $b^2 \ge 4ac$. The tests use the ball and a rectangle with a perimeter of 10 and an area of 6, whose sides $x$ and $5 - x$ satisfy $x^2 - 5x + 6 = 0$. ### #| The two roots of the quadratic with coefficients a, b and c, smaller first. def roots(a, b, c) { return 0.0, 0.0 } t1, t2 = roots(-5, 4, 1) show t1, t2 test "$x^2 - 5x + 6 = 0$ gives 2 and 3" { x1, x2 = roots(1, -5, 6) assert_near(x1, 2.0, 1.0e-12) assert_near(x2, 3.0, 1.0e-12) } test "$-5t^2 + 4t + 1 = 0$ gives -0.2 and 1, smaller first" { t1, t2 = roots(-5, 4, 1) assert_near(t1, -0.2, 1.0e-12) assert_near(t2, 1.0, 1.0e-12) } # SPDX-License-Identifier: MIT OR Apache-2.0 # SPDX-FileCopyrightText: 2026 The Viv authors