Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Modulo Equation

  1. Jun 4, 2012 #1

    I'm trying to write out a set of equations I was using in an excel worksheet and am unsure how to represent a modulo function.

    For example, is there a proper way to write out the following excel formula in mathematical terms?

    =MOD(280.4+X*(36000.7 + X*0.0003032),360) *Where X is a cell containing the variable

    Sorry if my question is a bit confusing. I am unsure of how to write this out because typically I wouldn't expect to write a comma in a mathematical equation. Maybe this is a bad assumption.

    Thanks for any help.
  2. jcsd
  3. Jun 4, 2012 #2
    So I took a stab at it. I think that the two vertical bars around a variable or expression means the floor integer. Is this correct?

    Z = 280.4+X*(36000.7 + X*0.0003032)

    = z - (|z/360| * 360)

    or all in one equation:

    = z - (|(280.4+X*(36000.7 + X*0.0003032))/360| * 360)
  4. Jun 4, 2012 #3
    I believe the conventions is to write the expression and then put '(mod n)' after it, eg
    280.4+X*(36000.7 + X*0.0003032) (mod 360)

    It depends where and how, but commas are typically used to separate arguments in multi-parameter functions or indices in matrix subscripts.
  5. Jun 4, 2012 #4


    Staff: Mentor

    No, | | means absolute value. What you want is the greatest integer function, AKA "floor" function, written in LaTeX like this:

    \lfloor 512.3 \rfloor

    ##\lfloor 512.3\rfloor##, which evaluates to 512.

    The above doesn't make sense. The first line sets Z to the expression on the right. The second line claims that the right side of the previous equation is somehow equal to the expression after '=', which is not true.
    This is not an equation. An equation is a statement that two quantities have the same value. All you're showing here is one quantity. Keep in mind that Excel formulas always start with '=' but mathematical equations have the form <expression1> = <expression2>.

    The '=' that starts an Excel formula is a shorthand assignment statement, where the thing that's being set (the cell in which the formula is written) is not shown. It is probably a bit confusing that '=' is also used in Excel to test for equality. Most programming languages use different symbols for assignment and equality.
  6. Jun 5, 2012 #5
    So than is this:

    Y = (280.46646 + (X * 36) + (X * (0.0003032^2)))
    - (⌊(280.46646 + (X * 36) + (X * (0.0003032^2))) / 360⌋ * 360)

    the same as writing this....

    Y = (280.46646 + (X * 36) + (X * (0.0003032^2))) (mod 360)

    Any idea what the typical method would be in a scientific style report?
  7. Jun 5, 2012 #6


    Staff: Mentor

    I haven't checked your numbers, but I doubt that the two values are the same. I'm guessing that you want an integer value for Y in the range 0 ... 359. The argument to a modulus expression in mathematics is defined only for integer numbers, at least I've never seen it being used on numbers with fractional parts. That's the reason for the greatest integer function in your first equation above.

    To cut to the chase, what I think you're trying to do is to take a number such as 645.783 (for example), strip off the fractional part (.783) to get 645, and then find the remainder mod 360, which would be 285.
  8. Jun 5, 2012 #7
    Thanks for your help Mark.

    In your example you are describing what I am trying to do; however, the value of Y does not need to be an integer.

    Basically my main equation is Y = (280.46646 + (X * 36) + (X * (0.0003032^2)))
    and if this gave us a result of Y=645.783; I would want to use the modulo function to give me the result of 285.783.

    If the equation gave a result of Y=3525.783; I would want to use modulo to give a result of 285.783.

    So yes you are correct in saying I want a number between 0-359; however, that number does not need to be an integer.
  9. Jun 5, 2012 #8
    Several 'mathematical' applications define the mod function to take congruences of real numbers, eg Mathcad, Matlab and Mathematica.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Modulo Equation
  1. Factoring Modulo (Replies: 1)

  2. Boolean and modulo (Replies: 3)

  3. The modulo operator (Replies: 8)