com.phasmidsoftware.number.expression.algebraic

Members list

Type members

Classlikes

The Equation trait represents a mathematical equation that may have multiple solutions or branches. It provides methods for determining the number of branches and for solving the equation on a specified branch. This type of equation is typically of the form P(x) = 0 where P(x) is a monic polynomial in x and where the coefficients Pi (i.e., the ith coefficient of P) are Rational numbers.

The Equation trait represents a mathematical equation that may have multiple solutions or branches. It provides methods for determining the number of branches and for solving the equation on a specified branch. This type of equation is typically of the form P(x) = 0 where P(x) is a monic polynomial in x and where the coefficients Pi (i.e., the ith coefficient of P) are Rational numbers.

Attributes

Supertypes
trait Renderable
class Object
trait Matchable
class Any
Show all
Known subtypes
case class LinearEquation(r: Rational) extends Equation

Represents a linear equation of the form x + r = 0 where r is a rational number. The slope of the line representing the equation is one, therefore the intercepts are: x = -r when y = 0 (the solution/root); and y = r when x = 0. This class provides various operations and transformations specific to linear equations.

Represents a linear equation of the form x + r = 0 where r is a rational number. The slope of the line representing the equation is one, therefore the intercepts are: x = -r when y = 0 (the solution/root); and y = r when x = 0. This class provides various operations and transformations specific to linear equations.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Equation
trait Renderable
class Object
trait Matchable
class Any
Show all

The Quadratic object provides commonly used quadratic equations and utility methods related to them.

The Quadratic object provides commonly used quadratic equations and utility methods related to them.

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
case class QuadraticEquation(p: Rational, q: Rational) extends Equation

Represents a (monic) equation of the form x² + p*x + q = 0, where p and q are rational coefficients. A graph of this equation appears as follows: an upright parabola (where p and q are both positive and (½p)⋏2 > q):

Represents a (monic) equation of the form x² + p*x + q = 0, where p and q are rational coefficients. A graph of this equation appears as follows: an upright parabola (where p and q are both positive and (½p)⋏2 > q):

        x                        |              x
         x                       |             x
           x                     |            x
              x              > ½p <         x
     -------------x----------+---|-------x------------------ v
                       x         |  x                        q
     - - - - - - - - - - - - x - + - - - - - - - - - - - - - ⋏
                                 |

The roots of the equation (if such exist) are at -w ± √(w∧2-q) where w = ½p For more information regarding quadratic equations, see: https://en.wikipedia.org/wiki/Quadratic_equation

Value parameters

p

the coefficient of the linear term (x).

q

the constant term of the equation.

Attributes

Constructor

Creates an instance of the equation with coefficients p and q.

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait Equation
trait Renderable
class Object
trait Matchable
class Any
Show all