Equation

com.phasmidsoftware.number.expression.algebraic.Equation

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

Graph
Supertypes
trait Renderable
class Object
trait Matchable
class Any
Show all
Known subtypes

Members list

Value members

Abstract methods

Evaluates this equation where the variable (x) is provided by s, the Solution.

Evaluates this equation where the variable (x) is provided by s, the Solution.

If s is a solution of this equation, then the expected value is zero.

Value parameters

s

the solution to be evaluated; encapsulates the details of the computation and the associated branch-specific information.

Attributes

Returns

an eagerly computed result derived from the evaluation of the provided solution.

Produces an inverted version of the current equation. The inversion process involves switching or rearranging key components of the equation, depending on its mathematical structure.

Produces an inverted version of the current equation. The inversion process involves switching or rearranging key components of the equation, depending on its mathematical structure.

Attributes

Returns

a new Equation instance representing the inverted form of the current equation.

Shifts the origin of the given equation by the specified rational value. This method adjusts the equation's reference point, effectively translating it to a new position in its domain.

Shifts the origin of the given equation by the specified rational value. This method adjusts the equation's reference point, effectively translating it to a new position in its domain.

Given this equation P(x) = 0, such that z is a solution, this method returns the equation P(y) = 0 such that z + c is a solution.

CONSIDER a better name for this.

Value parameters

c

the rational value by which to shift the origin of the equation.

Attributes

Returns

a new Equation instance with its origin shifted by the specified value.

def solve(branch: Int): Solution

Attempts to find a solution for a mathematical equation corresponding to the given branch. Solutions are represented as an instance of the Algebraic or of Complex class.

Attempts to find a solution for a mathematical equation corresponding to the given branch. Solutions are represented as an instance of the Algebraic or of Complex class.

Value parameters

branch

the branch index for which the solution is being sought. The branch index identifies specific solutions for equations that may have multiple solutions.

Attributes

Returns

a Field, which is either a Algebraic (real-valued) or a Complex.

Transforms the current equation by applying the provided functions to its components.

Transforms the current equation by applying the provided functions to its components.

Value parameters

fP

a function that takes two Rational parameters and produces a Rational result. It is applied to the first component of the equation.

fQ

a function that takes two Rational parameters and produces a Rational result. It is applied to the second component of the equation.

Attributes

Returns

a new Equation instance that is the result of applying the specified transformations to the components of the current equation.

Inherited methods

infix def *(factor: Int): Equation

Multiplies the current instance by the specified integer factor.

Multiplies the current instance by the specified integer factor.

Value parameters

factor

the integer value to multiply with the current instance

Attributes

Returns

a new instance of type T representing the result of the multiplication

Inherited from:
Scalable

Inherited and Abstract methods

infix def *(factor: Rational): Equation

Scales the current instance by the given factor.

Scales the current instance by the given factor.

This method applies a scaling operation on the instance using the provided rational factor and returns the resulting scaled instance.

The result is not guaranteed to be normalized.

Value parameters

factor

the rational number representing the scale factor

Attributes

Returns

the scaled instance of type T

Inherited from:
Scalable
def branched(index: Int): Expression

Retrieves the branch at the specified index.

Retrieves the branch at the specified index.

Value parameters

index

the index of the branch to retrieve, where the index starts from 0.

Attributes

Returns

the element of type T at the specified branch index. If the index is out of range, the behavior is implementation-specific.

Inherited from:
Branched
def branches: Int

Returns the number of branches in this.

Returns the number of branches in this.

branches corresponds to the number of possible solutions to some equation.

Attributes

Returns

the number of branches as an integer.

Inherited from:
Branched
def render: String

Method to render this Valuable for presentation to the user. NOTE to implementors: never ever invoke this.toString in your implementation lest you get a StackOverflow.

Method to render this Valuable for presentation to the user. NOTE to implementors: never ever invoke this.toString in your implementation lest you get a StackOverflow.

Attributes

Returns

a String

Inherited from:
Renderable