Documentation ¶
Index ¶
- Constants
- Variables
- type Angle
- type Boolean
- type Duration
- func (v Duration) AsBoolean() bool
- func (v Duration) AsDays() float64
- func (v Duration) AsHours() float64
- func (v Duration) AsInteger() int
- func (v Duration) AsMilliseconds() float64
- func (v Duration) AsMinutes() float64
- func (v Duration) AsMonths() float64
- func (v Duration) AsSeconds() float64
- func (v Duration) AsWeeks() float64
- func (v Duration) AsYears() float64
- func (v Duration) GetDays() int
- func (v Duration) GetHours() int
- func (v Duration) GetMilliseconds() int
- func (v Duration) GetMinutes() int
- func (v Duration) GetMonths() int
- func (v Duration) GetSeconds() int
- func (v Duration) GetWeeks() int
- func (v Duration) GetYears() int
- func (v Duration) IsNegative() bool
- func (v Duration) IsZero() bool
- type Moment
- func (v Moment) AsDays() float64
- func (v Moment) AsHours() float64
- func (v Moment) AsMilliseconds() float64
- func (v Moment) AsMinutes() float64
- func (v Moment) AsMonths() float64
- func (v Moment) AsSeconds() float64
- func (v Moment) AsWeeks() float64
- func (v Moment) AsYears() float64
- func (v Moment) GetDays() int
- func (v Moment) GetHours() int
- func (v Moment) GetMilliseconds() int
- func (v Moment) GetMinutes() int
- func (v Moment) GetMonths() int
- func (v Moment) GetSeconds() int
- func (v Moment) GetWeeks() int
- func (v Moment) GetYears() int
- type Number
- func (v Number) AsBoolean() bool
- func (v Number) AsInteger() int
- func (v Number) AsReal() float64
- func (v Number) GetImaginary() float64
- func (v Number) GetMagnitude() float64
- func (v Number) GetPhase() Angle
- func (v Number) GetReal() float64
- func (v Number) IsInfinite() bool
- func (v Number) IsNegative() bool
- func (v Number) IsUndefined() bool
- func (v Number) IsZero() bool
- type Pattern
- type Percentage
- type Probability
- type Resource
- type Symbol
- type Tag
Constants ¶
const DaysPerMonth float64 = float64(MillisecondsPerMonth) / float64(MillisecondsPerDay) // ~30.436875 days/month
const DaysPerYear float64 = float64(MillisecondsPerYear) / float64(MillisecondsPerDay) // ~365.2425 days/year
const MillisecondsPerDay int = MillisecondsPerHour * 24
const MillisecondsPerHour int = MillisecondsPerMinute * 60
const MillisecondsPerMinute int = MillisecondsPerSecond * 60
const MillisecondsPerMonth int = MillisecondsPerYear / 12 // An average but exact value.
const MillisecondsPerSecond int = 1000
const MillisecondsPerWeek int = MillisecondsPerDay * 7
const MillisecondsPerYear int = 31556952000
const WeeksPerMonth float64 = float64(MillisecondsPerMonth) / float64(MillisecondsPerWeek) // ~4.348125 weeks/month
Variables ¶
var Angles = &angles{}
This singleton creates a unique name space for the library functions for angle elements.
var Booleans = &booleans{}
This singleton creates a unique name space for the library functions for boolean elements.
var Durations = &durations{}
This singleton creates a unique name space for the library functions for duration elements.
var I = Number(complex(0.0, 1.0))
var Infinity = Number(infinity)
var Moments = &moments{}
This singleton creates a unique name space for the library functions for moment elements.
var Numbers = &numbers{}
This singleton creates a unique name space for the library functions for number elements.
var One = Number(complex(1.0, 0.0))
var Percentages = &percentages{}
This singleton creates a unique name space for the library functions for percentage elements.
var Phi = Number(complex(mat.Phi, 0.0))
var Pi = Angle(complex(mat.Pi, 0.0))
var Probabilities = &probabilities{}
This singleton creates a unique name space for the library functions for probability elements.
var Undefined = Number(undefined)
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 ¶
This constructor creates a new angle from the specified value and normalizes the value to be in the allowed range for angles [0..2π).
type Boolean ¶
type Boolean bool
This type defines the methods associated with boolean elements. It extends the native Go bool type.
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) AsMilliseconds ¶
This method returns the total number of milliseconds in this duration.
func (Duration) GetMilliseconds ¶
This method returns the milliseconds part of this duration.
func (Duration) GetMinutes ¶
This method returns the minutes part of this duration.
func (Duration) GetSeconds ¶
This method returns the seconds part of this duration.
func (Duration) IsNegative ¶
This method determines whether or not this polarized component is negative.
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) AsMilliseconds ¶
This method returns the total number of milliseconds since epoc in this moment.
func (Moment) AsMinutes ¶
This method returns the total number of minutes since epoc in this moment.
func (Moment) AsSeconds ¶
This method returns the total number of seconds since epoc in this moment.
func (Moment) GetMilliseconds ¶
This method returns the millisecond part of this moment.
func (Moment) GetMinutes ¶
This method returns the minute part of this moment.
func (Moment) GetSeconds ¶
This method returns the second 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 (Number) GetImaginary ¶
This method returns the imaginary part of this complex component.
func (Number) GetMagnitude ¶
This method returns the magnitude of this complex component.
func (Number) IsInfinite ¶
This method determines whether or not this number is infinite.
func (Number) IsNegative ¶
This method determines whether or not this polarized component is negative.
func (Number) IsUndefined ¶
This method determines whether or not this number is undefined.
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 ¶
This method returns an array of strings containing all matching strings and substrings found in the specified text.
func (Pattern) MatchesText ¶
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 ¶
This method returns the authority part of this resource element.
func (Resource) GetFragment ¶
This method returns the fragment 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 ¶
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 ¶
This constructor creates a new random tag identifier element with the specified number of bytes.
func (Tag) AsArray ¶
This method returns all the bytes in this tag. The bytes retrieved are in the same order as they are in the tag.