rationalNumberIsField

com.phasmidsoftware.number.algebra.eager.RationalNumber.rationalNumberIsField
object rationalNumberIsField extends Field[RationalNumber]

Provides an implicit implementation of the Field type class for the RationalNumber type.

This object defines the standard operations required for RationalNumber to function as a field, including addition, multiplication, division, and their respective identity and inverse operations. By extending the Field type class, it ensures compliance with field axioms.

Attributes

Graph
Supertypes
trait Field[RationalNumber]
trait CommutativeSemifield[RationalNumber]
trait MultiplicativeCommutativeGroup[RationalNumber]
trait DivisionRing[RationalNumber]
trait Semifield[RationalNumber]
trait MultiplicativeGroup[RationalNumber]
trait EuclideanRing[RationalNumber]
trait GCDRing[RationalNumber]
trait CommutativeRing[RationalNumber]
trait CommutativeRng[RationalNumber]
trait CommutativeRig[RationalNumber]
trait MultiplicativeCommutativeMonoid[RationalNumber]
trait CommutativeSemiring[RationalNumber]
trait MultiplicativeCommutativeSemigroup[RationalNumber]
trait Ring[RationalNumber]
trait Rng[RationalNumber]
trait AdditiveCommutativeGroup[RationalNumber]
trait AdditiveGroup[RationalNumber]
trait Rig[RationalNumber]
trait MultiplicativeMonoid[RationalNumber]
trait Semiring[RationalNumber]
trait MultiplicativeSemigroup[RationalNumber]
trait AdditiveCommutativeMonoid[RationalNumber]
trait AdditiveCommutativeSemigroup[RationalNumber]
trait AdditiveMonoid[RationalNumber]
trait AdditiveSemigroup[RationalNumber]
trait Serializable
class Object
trait Matchable
class Any
Show all
Self type

Members list

Value members

Concrete methods

Divides one rational number by another.

Divides one rational number by another.

Value parameters

x

the numerator rational number

y

the denominator rational number

Attributes

Returns

a new RationalNumber representing the result of the division

Returns the additive inverse of the given rational number.

Returns the additive inverse of the given rational number.

Value parameters

x

the rational number to negate

Attributes

Returns

a rational number representing the additive inverse of the input

Adds two rational numbers and returns their sum.

Adds two rational numbers and returns their sum.

Value parameters

x

the first rational number

y

the second rational number

Attributes

Returns

the sum of the two rational numbers

Multiplies two rational numbers.

Multiplies two rational numbers.

Value parameters

x

the first rational number

y

the second rational number

Attributes

Returns

the product of the two rational numbers

Inherited methods

override def additive: CommutativeGroup[RationalNumber]

Attributes

Definition Classes
AdditiveCommutativeGroup -> AdditiveCommutativeMonoid -> AdditiveCommutativeSemigroup -> AdditiveGroup -> AdditiveMonoid -> AdditiveSemigroup
Inherited from:
AdditiveCommutativeGroup

Attributes

Inherited from:
Field

Attributes

Inherited from:
Field

Attributes

Definition Classes
Field -> EuclideanRing
Inherited from:
Field

Attributes

Inherited from:
Field
def fromBigInt(n: BigInt): RationalNumber

Convert the given BigInt to an instance of A.

Convert the given BigInt to an instance of A.

This is equivalent to n repeated summations of this ring's one, or -n summations of -one if n is negative.

Most type class instances should consider overriding this method for performance reasons.

Attributes

Inherited from:
Ring
override def fromDouble(a: Double): RationalNumber

This is implemented in terms of basic Ring ops. However, this is probably significantly less efficient than can be done with a specific type. So, it is recommended that this method be overriden.

This is implemented in terms of basic Ring ops. However, this is probably significantly less efficient than can be done with a specific type. So, it is recommended that this method be overriden.

This is possible because a Double is a rational number.

Attributes

Definition Classes
Field -> DivisionRing
Inherited from:
Field
def fromInt(n: Int): RationalNumber

Convert the given integer to an instance of A.

Convert the given integer to an instance of A.

Defined to be equivalent to sumN(one, n).

That is, n repeated summations of this ring's one, or -n summations of -one if n is negative.

Most type class instances should consider overriding this method for performance reasons.

Attributes

Inherited from:
Ring
override def gcd(a: RationalNumber, b: RationalNumber)(implicit eqA: Eq[RationalNumber]): RationalNumber

Attributes

Definition Classes
Field -> EuclideanRing -> GCDRing
Inherited from:
Field
def isOne(a: RationalNumber)(implicit ev: Eq[RationalNumber]): Boolean

Tests if a is one.

Tests if a is one.

Attributes

Inherited from:
MultiplicativeMonoid
def isZero(a: RationalNumber)(implicit ev: Eq[RationalNumber]): Boolean

Tests if a is zero.

Tests if a is zero.

Attributes

Inherited from:
AdditiveMonoid
override def lcm(a: RationalNumber, b: RationalNumber)(implicit eqA: Eq[RationalNumber]): RationalNumber

Attributes

Definition Classes
Field -> EuclideanRing -> GCDRing
Inherited from:
Field

Attributes

Inherited from:
AdditiveGroup
override def multiplicative: CommutativeGroup[RationalNumber]

Attributes

Definition Classes
MultiplicativeCommutativeGroup -> MultiplicativeCommutativeMonoid -> MultiplicativeCommutativeSemigroup -> MultiplicativeGroup -> MultiplicativeMonoid -> MultiplicativeSemigroup
Inherited from:
MultiplicativeCommutativeGroup
override def pow(a: RationalNumber, n: Int): RationalNumber

Attributes

Definition Classes
MultiplicativeGroup -> MultiplicativeMonoid -> MultiplicativeSemigroup
Inherited from:
MultiplicativeGroup
def product(as: IterableOnce[RationalNumber]): RationalNumber

Given a sequence of as, compute the product.

Given a sequence of as, compute the product.

Attributes

Inherited from:
MultiplicativeMonoid

Attributes

Inherited from:
MultiplicativeGroup
def sum(as: IterableOnce[RationalNumber]): RationalNumber

Given a sequence of as, compute the sum.

Given a sequence of as, compute the sum.

Attributes

Inherited from:
AdditiveMonoid
override def sumN(a: RationalNumber, n: Int): RationalNumber

Attributes

Definition Classes
AdditiveGroup -> AdditiveMonoid -> AdditiveSemigroup
Inherited from:
AdditiveGroup
override def tryProduct(as: IterableOnce[RationalNumber]): Option[RationalNumber]

Given a sequence of as, combine them and return the total.

Given a sequence of as, combine them and return the total.

If the sequence is empty, returns None. Otherwise, returns Some(total).

Attributes

Definition Classes
MultiplicativeMonoid -> MultiplicativeSemigroup
Inherited from:
MultiplicativeMonoid
override def trySum(as: IterableOnce[RationalNumber]): Option[RationalNumber]

Given a sequence of as, combine them and return the total.

Given a sequence of as, combine them and return the total.

If the sequence is empty, returns None. Otherwise, returns Some(total).

Attributes

Definition Classes
AdditiveMonoid -> AdditiveSemigroup
Inherited from:
AdditiveMonoid

Concrete fields

Retrieves the constant rational number representing one.

Retrieves the constant rational number representing one.

Attributes

Returns

A RationalNumber instance equal to one.

Returns the zero value of a RationalNumber.

Returns the zero value of a RationalNumber.

Attributes

Returns

the zero value of the RationalNumber type