solve_quadratic: Solve for Real Root(s) to the Quadratic Equation

Description Usage Arguments Value Author(s) See Also Examples

View source: R/solve_quadratic.R

Description

Solves for real-valued roots to the quadratic equation ax^{2} + bx + c = 0.

Usage

1

Arguments

a, b, c

Coefficients in the quadratic equation ax^{2} + bx + c = 0.

Value

solve_quadratic returns a list, which includes the following two objects:

flag

Indicates the number of distinct real roots to the quadratic equation. It can be one of "infinite", "none", "one", or "two".

x

Real root(s) to the quadratic equation. If flag = "infinite", we simply write x = 0; If flag = "none", we write x = NA.

Author(s)

Qiansheng Zhu

See Also

quadratic.fit

Examples

1
2
3
solve_quadratic(1, 2, 1)
solve_quadratic(1, 2, 2)
solve_quadratic(0, 2, 1)

cta documentation built on Aug. 24, 2021, 1:06 a.m.