Processing math: 100%

First time here? Check out the FAQ!

Ask Your Question
0

ArithmeticError: reduction modulo not defined

asked 4 years ago

Miroslaw gravatar image

updated 0 years ago

FrédéricC gravatar image

I have tried performed modulo operation:

and I got this:

ArithmeticError                           Traceback (most recent call last) <ipython-input-1-b13f3c6e195a> in <module>

     54     print(" po podziale x 2")
     55     xP, yP = Pp.xy() 
  ---> 56     uu = xQ % xP 

       57     print( f"uu mod = {(uu)} " ) 

/home/sc_serv/sage/local/lib/python3.8/site-packages/sage/rings/finite_rings/integer_mod.pyx in sage.rings.finite_rings.integer_mod.IntegerMod_abstract.__mod__ (build/cythonized/sage/rings/finite_rings/integer_mod.c:7287)()
    493         R = IntegerModRing(modulus)
    494         if (<Element>self)._parent._IntegerModRing_generic__order % R.order():
--> 495             raise ArithmeticError(f"reduction modulo {modulus!r} not defined")
    496         return R(self)
    497 

ArithmeticError: reduction modulo 55066263022277343669578718895168534326250603453777594175500187360389116729240 not defined

i don't understand in python work

xQ = 0x5699b93fc6e1bd29e09a328d657a607b4155b61a6b5fcbedd7c12df7c67df8f5

xP = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798

Preview: (hide)

Comments

  • I reformatted your question to present Sage's output without reformatting, in order to facilitate reading. You van do that by selecting the relevant text andclick on the "101010" button.

  • What are the parents of xQ and xP ?

  • Your question might be answerable if you could post you source code or, better, a minimal example exhibiting your problem.

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 4 years ago )

2 Answers

Sort by » oldest newest most voted
0

answered 4 years ago

Emmanuel Charpentier gravatar image

WorksForMe(TM) in 9.3.beta8 :

sage: xQ = 0x5699b93fc6e1bd29e09a328d657a607b4155b61a6b5fcbedd7c12df7c67df8f5
sage: xP = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798
sage: xQ%xP
39170511121567495843205514895817413266634475076437334144150038082329899825397

xP and/or xQ may be different of what you think they are. Check your code upstream of line 56...

Preview: (hide)
link
0

answered 4 years ago

Max Alekseyev gravatar image

updated 4 years ago

Apparently, xP and xQ are coordinates of some points on an elliptic curve over a finite field GF(p). In this case they represent residues modulo p, and operation % is not defined for them. If one wants to treat them as integers, lifting is needed: uu = lift(xQ) % lift(xP)

Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 4 years ago

Seen: 1,794 times

Last updated: Mar 11 '21