The Quadratic object provides commonly used quadratic equations and utility methods related to them.
Attributes
- Companion
- class
- Graph
-
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
QuadraticEquation.type
Members list
Type members
Inherited and Abstract types
The names of the product elements.
The names of the product elements.
Attributes
- Inherited from:
- Mirror
The name of the type.
The name of the type.
Attributes
- Inherited from:
- Mirror
Value members
Concrete methods
Solves a quadratic equation to find its complex roots in Cartesian form. The method calculates the complex roots based on the given branch of the solution, the total number of branches, the real component (base) of the equation, and the square root value of a provided rational number.
Solves a quadratic equation to find its complex roots in Cartesian form. The method calculates the complex roots based on the given branch of the solution, the total number of branches, the real component (base) of the equation, and the square root value of a provided rational number.
Value parameters
- branch
-
the specific branch of the solution to compute (e.g., 0, 1, etc.).
- branches
-
the total number of branches in the solution space.
- equation
-
the quadratic equation for which to compute the complex roots (used only for error reporting).
- imagCoefficient
-
the coefficient of the imaginary part of the complex solution (this will be a positive square root).
- realCoefficient
-
the rational number representing the real component of the equation.
Attributes
- Returns
-
a
ComplexCartesianobject representing the complex root in Cartesian form.
Creates a quadratic equation whose solutions are plus or minus the square root of the given Rational number. The quadratic equation is defined as Quadratic(0, -r), where the first term is zero and the second term is the negation of the input parameter.
Creates a quadratic equation whose solutions are plus or minus the square root of the given Rational number. The quadratic equation is defined as Quadratic(0, -r), where the first term is zero and the second term is the negation of the input parameter.
Value parameters
- r
-
the
Rationalnumber used as the coefficient for the square root equation.
Attributes
- Returns
-
a
Quadraticinstance that represents the square root equation.
Concrete fields
A predefined quadratic equation relating to the golden ratio. The equation is represented as x² + x - 1 = 0. The roots of this equation are the golden ratio (phi) and its conjugate (psi).
A predefined quadratic equation relating to the golden ratio. The equation is represented as x² + x - 1 = 0. The roots of this equation are the golden ratio (phi) and its conjugate (psi).
Attributes
An approximation of the golden ratio (φ), which is an irrational number often encountered in mathematics, art, and nature. Its value is approximately 1.6180339887498948.
An approximation of the golden ratio (φ), which is an irrational number often encountered in mathematics, art, and nature. Its value is approximately 1.6180339887498948.
Attributes
Represents a quadratic equation whose solutions are plus or minus the square root of 3. The equation is generated by invoking the squareRootEquation method with Rational.three as the input parameter.
Represents a quadratic equation whose solutions are plus or minus the square root of 3. The equation is generated by invoking the squareRootEquation method with Rational.three as the input parameter.
The resulting equation defines a relationship where the solutions are derived by solving for the square root of the specified rational value.
Attributes
Represents the equation x² - 2 = 0, which defines the relationship for the square root of 2. This specific quadratic equation has the following form:
Represents the equation x² - 2 = 0, which defines the relationship for the square root of 2. This specific quadratic equation has the following form:
p = 0 (no linear term) and q = -2 (constant term).
Geometrically, this equation corresponds to a parabola, and its roots are at ±√2. The equation is a notable instance of a quadratic, useful in various mathematical contexts.