elements

package
v0.0.0-...-1318f34 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DaysPerMonth float64 = float64(MillisecondsPerMonth) / float64(MillisecondsPerDay) // ~30.436875 days/month
View Source
const DaysPerYear float64 = float64(MillisecondsPerYear) / float64(MillisecondsPerDay) // ~365.2425 days/year
View Source
const MillisecondsPerDay int = MillisecondsPerHour * 24
View Source
const MillisecondsPerHour int = MillisecondsPerMinute * 60
View Source
const MillisecondsPerMinute int = MillisecondsPerSecond * 60
View Source
const MillisecondsPerMonth int = MillisecondsPerYear / 12 // An average but exact value.
View Source
const MillisecondsPerSecond int = 1000
View Source
const MillisecondsPerWeek int = MillisecondsPerDay * 7
View Source
const MillisecondsPerYear int = 31556952000
View Source
const WeeksPerMonth float64 = float64(MillisecondsPerMonth) / float64(MillisecondsPerWeek) // ~4.348125 weeks/month

Variables

View Source
var Angles = &angles{}

This singleton creates a unique name space for the library functions for angle elements.

View Source
var Booleans = &booleans{}

This singleton creates a unique name space for the library functions for boolean elements.

View Source
var Durations = &durations{}

This singleton creates a unique name space for the library functions for duration elements.

View Source
var I = Number(complex(0.0, 1.0))
View Source
var Infinity = Number(infinity)
View Source
var Moments = &moments{}

This singleton creates a unique name space for the library functions for moment elements.

View Source
var Numbers = &numbers{}

This singleton creates a unique name space for the library functions for number elements.

View Source
var One = Number(complex(1.0, 0.0))
View Source
var Percentages = &percentages{}

This singleton creates a unique name space for the library functions for percentage elements.

View Source
var Phi = Number(complex(mat.Phi, 0.0))
View Source
var Pi = Angle(complex(mat.Pi, 0.0))
View Source
var Probabilities = &probabilities{}

This singleton creates a unique name space for the library functions for probability elements.

View Source
var Undefined = Number(undefined)
View Source
var Zero = Number(zero)

Functions

This section is empty.

Types

type Angle

type Angle float64

This type defines the methods associated with angle elements. It extends the native Go float64 type and represents a radian based angle in the range [0..2π).

func AngleFromFloat

func AngleFromFloat(v float64) Angle

This constructor creates a new angle from the specified value and normalizes the value to be in the allowed range for angles [0..2π).

func (Angle) AsReal

func (v Angle) AsReal() float64

This method returns a real value for this continuous component.

func (Angle) IsZero

func (v Angle) IsZero() bool

This method determines whether or not this angle is zero.

type Boolean

type Boolean bool

This type defines the methods associated with boolean elements. It extends the native Go bool type.

func (Boolean) AsBoolean

func (v Boolean) AsBoolean() bool

This method returns a boolean value for this discrete element.

func (Boolean) AsInteger

func (v Boolean) AsInteger() int

This method returns an integer value for this discrete element.

type Duration

type Duration int

This type defines the methods associated with time duration elements. It extends the native Go `int` type and its value represents the number of milliseconds for the entire duration of time. Durations can be negative.

func (Duration) AsBoolean

func (v Duration) AsBoolean() bool

This method returns a boolean value for this discrete element.

func (Duration) AsDays

func (v Duration) AsDays() float64

This method returns the total number of days in this duration.

func (Duration) AsHours

func (v Duration) AsHours() float64

This method returns the total number of hours in this duration.

func (Duration) AsInteger

func (v Duration) AsInteger() int

This method returns an integer value for this discrete element.

func (Duration) AsMilliseconds

func (v Duration) AsMilliseconds() float64

This method returns the total number of milliseconds in this duration.

func (Duration) AsMinutes

func (v Duration) AsMinutes() float64

This method returns the total number of minutes in this duration.

func (Duration) AsMonths

func (v Duration) AsMonths() float64

This method returns the total number of months in this duration.

func (Duration) AsSeconds

func (v Duration) AsSeconds() float64

This method returns the total number of seconds in this duration.

func (Duration) AsWeeks

func (v Duration) AsWeeks() float64

This method returns the total number of weeks in this duration.

func (Duration) AsYears

func (v Duration) AsYears() float64

This method returns the total number of years in this duration.

func (Duration) GetDays

func (v Duration) GetDays() int

This method returns the days part of this duration.

func (Duration) GetHours

func (v Duration) GetHours() int

This method returns the hours part of this duration.

func (Duration) GetMilliseconds

func (v Duration) GetMilliseconds() int

This method returns the milliseconds part of this duration.

func (Duration) GetMinutes

func (v Duration) GetMinutes() int

This method returns the minutes part of this duration.

func (Duration) GetMonths

func (v Duration) GetMonths() int

This method returns the months part of this duration.

func (Duration) GetSeconds

func (v Duration) GetSeconds() int

This method returns the seconds part of this duration.

func (Duration) GetWeeks

func (v Duration) GetWeeks() int

This method returns the weeks part of this duration.

func (Duration) GetYears

func (v Duration) GetYears() int

This method returns the years part of this duration.

func (Duration) IsNegative

func (v Duration) IsNegative() bool

This method determines whether or not this polarized component is negative.

func (Duration) IsZero

func (v Duration) IsZero() bool

This method determines whether or not this duration is zero.

type Moment

type Moment int

This type defines the methods associated with moment in time elements. It extends the native Go int type and represents the number of milliseconds after the UNIX epoc (Midnight, January 1, 1970 UTC) for a moment of tim. All moments are based on UTC.

func Now

func Now() Moment

This constructor creates a new moment in time element for the current time in the UTC timezone.

func (Moment) AsDays

func (v Moment) AsDays() float64

This method returns the total number of days since epoc in this moment.

func (Moment) AsHours

func (v Moment) AsHours() float64

This method returns the total number of hours since epoc in this moment.

func (Moment) AsMilliseconds

func (v Moment) AsMilliseconds() float64

This method returns the total number of milliseconds since epoc in this moment.

func (Moment) AsMinutes

func (v Moment) AsMinutes() float64

This method returns the total number of minutes since epoc in this moment.

func (Moment) AsMonths

func (v Moment) AsMonths() float64

This method returns the total number of months since epoc in this moment.

func (Moment) AsSeconds

func (v Moment) AsSeconds() float64

This method returns the total number of seconds since epoc in this moment.

func (Moment) AsWeeks

func (v Moment) AsWeeks() float64

This method returns the total number of weeks since epoc in this moment.

func (Moment) AsYears

func (v Moment) AsYears() float64

This method returns the total number of years since epoc in this moment.

func (Moment) GetDays

func (v Moment) GetDays() int

This method returns the day part of this moment.

func (Moment) GetHours

func (v Moment) GetHours() int

This method returns the hour part of this moment.

func (Moment) GetMilliseconds

func (v Moment) GetMilliseconds() int

This method returns the millisecond part of this moment.

func (Moment) GetMinutes

func (v Moment) GetMinutes() int

This method returns the minute part of this moment.

func (Moment) GetMonths

func (v Moment) GetMonths() int

This method returns the month part of this moment.

func (Moment) GetSeconds

func (v Moment) GetSeconds() int

This method returns the second part of this moment.

func (Moment) GetWeeks

func (v Moment) GetWeeks() int

This method returns the week part of this moment.

func (Moment) GetYears

func (v Moment) GetYears() int

This method returns the year part of this moment.

type Number

type Number complex128

This type defines the methods associated with number elements. It extends the native Go complex128 type and may represent an integer, real, or complex number.

func NumberFromComplex

func NumberFromComplex(v complex128) Number

This constructor creates a new number that is mapped to the Riemann Sphere.

This mapping removes many of the idiosyncrasies associated with the normal complex plane. There is only one value for zero and one value for infinity. This simplifies a lot of the mathematical operations:

z + zero => z
z + infinity => infinity

z - infinity => infinity     {z != infinity}
infinity - z => infinity     {z != infinity}

z * zero => zero             {z != infinity}
z * infinity => infinity     {z != zero}

z / zero => infinity         {z != zero}
zero / z => zero             {z != zero}

z / infinity => zero         {z != infinity}
infinity / z => infinity     {z != infinity}

z ^ zero => one              {by definition}
zero ^ z => zero             {z != zero}

z ^ infinity => zero         {|z| < one}
z ^ infinity => one          {|z| = one}
z ^ infinity => infinity     {|z| > one}
infinity ^ z => infinity     {z != zero}

log(z, zero) => infinity     {zero < z < infinity}
log(zero, z) => zero         {zero < z < infinity}

log(z, one) => zero          {zero < z}
log(one, z) => zero          {zero < z}

log(z, infinity) => infinity {zero < z < infinity}
log(infinity, z) => zero     {zero < z < infinity}

This leaves only the following operations undefined:

infinity - infinity => undefined
zero * infinity => undefined
zero / zero => undefined
infinity / infinity => undefined
log(zero, zero) => undefined
log(zero, infinity) => undefined
log(infinity, zero) => undefined
log(infinity, infinity) => undefined

The resulting number system is easier to use for most applications. For numerical analysis the ANSI plus and minus zero values are often used as a crutch that leads to misleading convergence information for oscillating functions. In the case of numerical analysis it is probably better to track the course of the function as it converges than to look at the final value.

func NumberFromPolar

func NumberFromPolar(m float64, p Angle) Number

func (Number) AsBoolean

func (v Number) AsBoolean() bool

This method returns a boolean value for this discrete element.

func (Number) AsInteger

func (v Number) AsInteger() int

This method returns an integer value for this discrete element.

func (Number) AsReal

func (v Number) AsReal() float64

This method returns a real value for this continuous component.

func (Number) GetImaginary

func (v Number) GetImaginary() float64

This method returns the imaginary part of this complex component.

func (Number) GetMagnitude

func (v Number) GetMagnitude() float64

This method returns the magnitude of this complex component.

func (Number) GetPhase

func (v Number) GetPhase() Angle

This method returns the phase angle of this complex component.

func (Number) GetReal

func (v Number) GetReal() float64

This method returns the real part of this complex component.

func (Number) IsInfinite

func (v Number) IsInfinite() bool

This method determines whether or not this number is infinite.

func (Number) IsNegative

func (v Number) IsNegative() bool

This method determines whether or not this polarized component is negative.

func (Number) IsUndefined

func (v Number) IsUndefined() bool

This method determines whether or not this number is undefined.

func (Number) IsZero

func (v Number) IsZero() bool

This method determines whether or not this number is zero.

type Pattern

type Pattern string

This type defines the methods associated with a character pattern that extends the native Go string type and represents the regular expression corresponding to that pattern.

func (Pattern) GetMatches

func (v Pattern) GetMatches(text string) []string

This method returns an array of strings containing all matching strings and substrings found in the specified text.

func (Pattern) MatchesText

func (v Pattern) MatchesText(text string) bool

This method determines whether or not this pattern matches the specified text string.

type Percentage

type Percentage float64

This type defines the methods associated with percentage elements. It extends the native Go float64 type and represents a percentage. Percentages can be negative.

func (Percentage) AsBoolean

func (v Percentage) AsBoolean() bool

This method returns a boolean value for this discrete element.

func (Percentage) AsInteger

func (v Percentage) AsInteger() int

This method returns an integer value for this discrete element.

func (Percentage) AsReal

func (v Percentage) AsReal() float64

This method returns a real value for this continuous component.

func (Percentage) IsNegative

func (v Percentage) IsNegative() bool

This method determines whether or not this polarized component is negative.

func (Percentage) IsZero

func (v Percentage) IsZero() bool

This method determines whether or not this percentage is zero.

type Probability

type Probability float64

This type defines the methods associated with probability elements. It extends the native Go float64 type and represents a probability in the range [0..1].

func ProbabilityFromBoolean

func ProbabilityFromBoolean(v bool) Probability

This constructor creates a new probability from the specified boolean value.

func ProbabilityFromFloat

func ProbabilityFromFloat(v float64) Probability

This constructor creates a new probability and constrains the value to be in the allowed range for probabilities [0..1].

func (Probability) AsBoolean

func (v Probability) AsBoolean() bool

This method returns a boolean value for this discrete element.

func (Probability) AsInteger

func (v Probability) AsInteger() int

This method returns an integer value for this discrete element.

func (Probability) AsReal

func (v Probability) AsReal() float64

This method returns a real value for this continuous component.

func (Probability) IsZero

func (v Probability) IsZero() bool

This method determines whether or not this probability is zero.

type Resource

type Resource string

This type defines the methods associated with a web resource element that extends the native Go string type and represents the URI corresponding to that web resource.

func (Resource) GetAuthority

func (v Resource) GetAuthority() string

This method returns the authority part of this resource element.

func (Resource) GetFragment

func (v Resource) GetFragment() string

This method returns the fragment part of this resource element.

func (Resource) GetPath

func (v Resource) GetPath() string

This method returns the path part of this resource element.

func (Resource) GetQuery

func (v Resource) GetQuery() string

This method returns the query part of this resource element.

func (Resource) GetScheme

func (v Resource) GetScheme() string

This method returns the scheme part of this resource element.

type Symbol

type Symbol string

This type defines the methods associated with a symbol element that extends the native Go string type and represents the runes that make up the symbol.

func (Symbol) GetIdentifier

func (v Symbol) GetIdentifier() string

This method returns the identifier for this symbol.

type Tag

type Tag string

This type defines the methods associated with a tag identifier that extends the native Go string type.

func TagOfSize

func TagOfSize(size int) Tag

This constructor creates a new random tag identifier element with the specified number of bytes.

func (Tag) AsArray

func (v Tag) AsArray() []byte

This method returns all the bytes in this tag. The bytes retrieved are in the same order as they are in the tag.

func (Tag) GetSize

func (v Tag) GetSize() int

This method returns the number of bytes contained in this tag.

func (Tag) IsEmpty

func (v Tag) IsEmpty() bool

This method determines whether or not this tag is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL