Search Results for

    Show / Hide Table of Contents

    Class ExMMod

    See ExM. This class contains functions related to mod (remainder) operations.

    Inheritance
    System.Object
    ExMMod
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Danmokou.DMath.Functions
    Assembly: cs.temp.dll.dll
    Syntax
    public static class ExMMod

    Methods

    FlipXMod(tfloat, tfloat)

    Returns v if x is even, and 180-v if x is odd.

    Declaration
    public static tfloat FlipXMod(tfloat x, tfloat v)
    Parameters
    Type Name Description
    tfloat x
    tfloat v
    Returns
    Type Description
    tfloat

    FlipXPMMod(tfloat, tfloat)

    Returns v if x is 1, and 180-v if x is -1.

    Declaration
    public static tfloat FlipXPMMod(tfloat x, tfloat v)
    Parameters
    Type Name Description
    tfloat x
    tfloat v
    Returns
    Type Description
    tfloat

    HMod(tfloat, tfloat)

    Use this to draw "wings" where both go in the same direction.
    Odd by: 0 is the center, [1,by/2-0.5] are one wing, and [by/2+0.5,by) are the other.
    Even by: [0, by/2) are one wing, [by/2, by) are the other.

    Declaration
    public static tfloat HMod(tfloat by, tfloat x)
    Parameters
    Type Name Description
    tfloat by

    Period (note all values are in the range [0, by/2-0.5]

    tfloat x

    Value

    Returns
    Type Description
    tfloat
    Examples

    HMod(X(), 9)(0) = HMod(X(), 9)(9) = 0 HMod(X(), 9)(1) = 1 HMod(X(), 9)(5) = 1 HMod(X(), 9)(8) = 4 HMod(X(), 8)(0) = HMod(X(), 8)(8) = HMod(X(), 8)(4) = 0 HMod(X(), 8)(2) = 2 HMod(X(), 8)(6) = 2

    HNMod(tfloat, tfloat)

    Use this to draw "wings" where both go in opposite directions.
    Odd by: 0 is the center, [1,by/2-0.5] are one wing, and [by/2+0.5,by) are the other.
    Even by: [0, by/2) are one wing, [by/2, by) are the other.

    Declaration
    public static tfloat HNMod(tfloat by, tfloat x)
    Parameters
    Type Name Description
    tfloat by

    Period

    tfloat x

    Target function

    Returns
    Type Description
    tfloat
    Examples

    HNMod(X(), 9)(0) = HNMod(X(), 9)(9) = 0 HNMod(X(), 9)(1) = 1 HNMod(X(), 9)(5) = -1 HNMod(X(), 9)(8) = -4 HNMod(X(), 8)(0) = HNMod(X(), 8)(8) = 0.5 HNMod(X(), 8)(3) = 3.5 HNMod(X(), 8)(4) = -0.5

    Mod(tfloat, tfloat)

    Get the modulo (nonnegative) of one number by another.

    Declaration
    public static tfloat Mod(tfloat by, tfloat x)
    Parameters
    Type Name Description
    tfloat by

    Modulo value

    tfloat x

    Target value

    Returns
    Type Description
    tfloat

    Modh(tfloat)

    = Mod(1, 1/phi * x)

    Declaration
    public static tfloat Modh(tfloat x)
    Parameters
    Type Name Description
    tfloat x
    Returns
    Type Description
    tfloat

    ModWithPause(tfloat, tfloat, tfloat, tfloat)

    Periodize the return value of the target function with a "pause" at the value pauseAt for pauseLen units. The true period of this function is by + pauseLen, however the output only varies [0, by]. During the pause time, the return value will be stuck at pauseAt.

    Declaration
    public static tfloat ModWithPause(tfloat by, tfloat pauseAt, tfloat pauseLen, tfloat x)
    Parameters
    Type Name Description
    tfloat by

    Naive period

    tfloat pauseAt

    Time at which to pause

    tfloat pauseLen

    Length for which to pause

    tfloat x

    Target function

    Returns
    Type Description
    tfloat

    MP1Mod(tfloat)

    Returns -1 if the value is even, and 1 if the value is odd.

    Declaration
    public static tfloat MP1Mod(tfloat x)
    Parameters
    Type Name Description
    tfloat x
    Returns
    Type Description
    tfloat

    PM1Mod(tfloat)

    Returns 1 if the value is even, and -1 if the value is odd.

    Declaration
    public static tfloat PM1Mod(tfloat x)
    Parameters
    Type Name Description
    tfloat x
    Returns
    Type Description
    tfloat

    PMZ1(tfloat)

    Convert a value 1,-1 to 1,0.

    Declaration
    public static tfloat PMZ1(tfloat x)
    Parameters
    Type Name Description
    tfloat x
    Returns
    Type Description
    tfloat

    RangeMod(tfloat, tfloat)

    Periodize a value around a positive and negative endpoint.

    Declaration
    public static tfloat RangeMod(tfloat by, tfloat x)
    Parameters
    Type Name Description
    tfloat by
    tfloat x
    Returns
    Type Description
    tfloat
    Examples

    FSoftMod(X(), 4)(3.95) = 3.95 FSoftMod(X(), 4)(4.05) = -3.95 FSoftMod(X(), 4)(11) = 3 FSoftMod(X(), 4)(12.05) = -3.95

    RangeModh(tfloat)

    = RangeMod(1, 2/phi * x)

    Declaration
    public static tfloat RangeModh(tfloat x)
    Parameters
    Type Name Description
    tfloat x
    Returns
    Type Description
    tfloat

    RangeSoftMod(tfloat, tfloat)

    Periodize a value, bouncing it off a positive and negative endpoint.

    Declaration
    public static tfloat RangeSoftMod(tfloat by, tfloat x)
    Parameters
    Type Name Description
    tfloat by
    tfloat x
    Returns
    Type Description
    tfloat
    Examples

    FSoftMod(X(), 4)(3.95) = 3.95 FSoftMod(X(), 4)(4.05) = 3.95 FSoftMod(X(), 4)(11) = -3 FSoftMod(X(), 4)(12.05) = -3.95

    RemapIndex(tfloat, tfloat)

    Use Fermat's Little Theorem to reindex integers around a prime number mod.

    Declaration
    public static tfloat RemapIndex(tfloat mod, tfloat index)
    Parameters
    Type Name Description
    tfloat mod
    tfloat index
    Returns
    Type Description
    tfloat

    RemapIndexLoop(tfloat, tfloat)

    Use Fermat's Little Theorem to reindex integers around a prime number mod, localized to the region [mod*floor(index/mod), mod+mod*floor(index/mod)].

    Declaration
    public static tfloat RemapIndexLoop(tfloat mod, tfloat index)
    Parameters
    Type Name Description
    tfloat mod
    tfloat index
    Returns
    Type Description
    tfloat

    SoftMod(tfloat, tfloat)

    Periodize a value, "bouncing off" the endpoint instead of wrapping around.

    Declaration
    public static tfloat SoftMod(tfloat by, tfloat x)
    Parameters
    Type Name Description
    tfloat by

    Period

    tfloat x

    Value

    Returns
    Type Description
    tfloat
    Examples

    FSoftMod(X(), 4)(3.95) = 3.95 FSoftMod(X(), 4)(4.05) = 3.95 FSoftMod(X(), 4)(4.15) = 3.85

    z1Mod(tfloat)

    Returns 0 if the value is even, and 1 if the value is odd.

    Declaration
    public static tfloat z1Mod(tfloat x)
    Parameters
    Type Name Description
    tfloat x
    Returns
    Type Description
    tfloat

    Z1PM(tfloat)

    Convert a value 1,0 to 1,-1.

    Declaration
    public static tfloat Z1PM(tfloat x)
    Parameters
    Type Name Description
    tfloat x
    Returns
    Type Description
    tfloat
    In This Article
    Back to top Generated by DocFX