0

Modexp$(-81.875,1,35);$ will not work.

So what I have to do is the following:

  1. Modexp$(-81,1,35); = 24$

  2. $875/1000; = 7/8$

  3. Modexp$(24*7,1,35); = 28$

  4. Modexp$(8,-1,35); = 22$

  5. Modexp$(22*28,1,35); = 21 \equiv −81.875 \mod 35$

But there has to be a more efficient way of calculuting $-\frac{655}{8}$ mod $35$. Does anyone know how that might be?

EDIT: Read comments below for correction.

Eric Stucky
  • 12,758
  • 3
  • 38
  • 69
  • -81.875 $\equiv$ 21 mod 35. – Adam Staples Apr 21 '14 at 23:34
  • This makes absolutely no sense mathematically. In particular, $-81.875 = -81 - \frac{7}{8}$, yet you multiplied the remainders of $81$ and $7$ modulo $35$. I won't even begin to get into the ways in which the other steps are complete rubbish. – heropup Apr 21 '14 at 23:35
  • Okay, I did it wrong, I get it. That's not my point though, my point is to calculate a RATIONAL number Mod a positive integer in magma. I just gave an example. Like for example maybe -8445/101 (mod 39) – Adam Staples Apr 21 '14 at 23:40
  • Why am I getting a non integer result? (8,35) = 1 so there should be a unique inverse of 8 modulo 35. I am doing this calculation because I'm working in a finite field and I'm still new to using these CAS systems. – Adam Staples Apr 21 '14 at 23:46
  • If it hasn't occurred to you by now, $-81.875$ is not an integer, and it's not a member of any finite field that I have ever heard of, so why would you expect modular arithmetic to be integer-valued in this way over the rationals? – heropup Apr 21 '14 at 23:48
  • -81.875 = $\frac{-655}{8}$ = -655 * $8^{-1}$ (mod 35). $8^{-1}$ has an inverse (mod 35) so $\frac{1}{8}$ is an integer modulo 35. Thus so is $\frac{-655}{8}$ (mod 35).
    In fact $8^{-1} = 22$. Then -81.875 $\equiv \frac{-665}{8} \equiv 10*22 \equiv 10$ mod 35.
    – Adam Staples Apr 21 '14 at 23:53
  • Specifically I am computing multiples of a point on an Elliptic Curve over a finite field. – Adam Staples Apr 21 '14 at 23:55
  • The definition of congruence modulo some integer $m$ is given by $$a \equiv b \pmod m \Leftrightarrow m \mid (a-b).$$ Does your computation satisfy this definition? – heropup Apr 21 '14 at 23:56
  • Yes, since $8^{-1}$ solves the equation $8x \equiv 1$ mod 35. Since x = 22 we see that 822 - 1 = 535. – Adam Staples Apr 21 '14 at 23:59
  • My point is that you should not be using such notation, if you want your questions to be clearly understood. – heropup Apr 21 '14 at 23:59
  • -81.875 is the numerical answer of my slope that I had got when attempting to find 2P for P on an elliptic curve E over a finite field of order 35. I am simply trying to find a quick and easy way to find what this number is modulo 35. I can obviously do this using several lines but it would be nice if I could do it in 1 or 2 lines. – Adam Staples Apr 22 '14 at 00:01

2 Answers2

3

Magma can be quite picky about where your objects live. Though in this case, I can hardly blame it---why would you enter this number as the decimal $-81.875$, which will be treated as an element of a precision field, rather than the exact $-655/8$? Here's what I typed into Magma:

R := Integers(35);

R;

Residue class ring of integers modulo 35

R!-655/8;

10

The ! is used to coerce $-655/8$ into the ring $R$.

Viktor Vaughn
  • 19,278
1

In Mathematica, the particular type of computation you are looking for is done with the syntax PolynomialMod[-655/8, 35]. In Magma, I don't know, because I don't use it.

heropup
  • 135,869
  • Yes, thank you very much. It outputs 10 which is the correct answer. – Adam Staples Apr 22 '14 at 00:02
  • This works for my homework but for my Final Exam I am expected to use Magma so I'm trying to get used to do computations in it. Still very useful because I'd always use PowerMod in Mathematica but this looks very helpful. – Adam Staples Apr 22 '14 at 00:03
  • 1
    I am going to take a total guess (since I don't know Magma syntax) based on what you wrote in your question, and say that the command Modexp(Modexp(-655,1,35)*Modexp(8,-1,35),1,35) should work. – heropup Apr 22 '14 at 00:05
  • Hmm.. yeah that works nicely. I guess I will just use this same outline for now until I find a function in Magma similar to PolynomialMod for Mathematica. – Adam Staples Apr 22 '14 at 00:07