class_docstr: Montgomery form of Points in an elliptic curve.
  In this form, the addition and doubling of points
  does not need any y-coordinate information thus
  decreasing the number of operations.
  Using Montgomery form we try to perform point addition
  and doubling in least amount of multiplications.
  
  The elliptic curve used here is of the form
  (E : b*y**2*z = x**3 + a*x**2*z + x*z**2).
  The a_24 parameter is equal to (a + 2)/4.
  
  References
  ==========
  
  .. [1] Kris Gaj, Soonhak Kwon, Patrick Baier, Paul Kohlbrenner, Hoang Le, Mohammed Khaleeluddin, Ramakrishna Bachimanchi,
         Implementing the Elliptic Curve Method of Factoring in Reconfigurable Hardware,
         Cryptographic Hardware and Embedded Systems - CHES 2006 (2006), pp. 119-133,
         https://doi.org/10.1007/11894063_10
         https://www.hyperelliptic.org/tanja/SHARCS/talks06/Gaj.pdf
docstr: Add two points self and Q where diff = self - Q. Moreover the assumption
  is self.x_cord*Q.x_cord*(self.x_cord - Q.x_cord) != 0. This algorithm
  requires 6 multiplications. Here the difference between the points
  is already known and using this algorithm speeds up the addition
  by reducing the number of multiplication required. Also in the
  mont_ladder algorithm is constructed in a way so that the difference
  between intermediate points is always equal to the initial point.
  So, we always know what the difference between the point is.
  
  
  Parameters
  ==========
  
  Q : point on the curve in Montgomery form
  diff : self - Q
  
  Examples
  ========
  
  >>> from sympy.ntheory.ecm import Point
  >>> p1 = Point(11, 16, 7, 29)
  >>> p2 = Point(13, 10, 7, 29)
  >>> p3 = p2.add(p1, p1)
  >>> p3.x_cord
  23
  >>> p3.z_cord
  17
docstr_tok: ["Add","two","points","self","and","Q","where","diff","=","self","-","Q",".","Moreover","the","assumption","is","self.x_cord","*","Q.x_cord","*","(","self.x_cord","-","Q.x_cord",")","!","=","0",".","This","algorithm","requires","6","multiplications",".","Here","the","difference","between","the","points","is","already","known","and","using","this","algorithm","speeds","up","the","addition","by","reducing","the","number","of","multiplication","required",".","Also","in","the","mont_ladder","algorithm","is","constructed","in","a","way","so","that","the","difference","between","intermediate","points","is","always","equal","to","the","initial","point",".","So",",","we","always","know","what","the","difference","between","the","point","is",".","Parameters","==========","Q",":","point","on","the","curve","in","Montgomery","form","diff",":","self","-","Q","Examples","========",">",">",">","from","sympy.ntheory.ecm","import","Point",">",">",">","p1","=","Point","(","11",",","16",",","7",",","29",")",">",">",">","p2","=","Point","(","13",",","10",",","7",",","29",")",">",">",">","p3","=","p2.add","(","p1",",","p1",")",">",">",">","p3.x_cord","23",">",">",">","p3.z_cord","17"]
code: def add(self, Q, diff):
      """
      Add two points self and Q where diff = self - Q. Moreover the assumption
      is self.x_cord*Q.x_cord*(self.x_cord - Q.x_cord) != 0. This algorithm
      requires 6 multiplications. Here the difference between the points
      is already known and using this algorithm speeds up the addition
      by reducing the number of multiplication required. Also in the
      mont_ladder algorithm is constructed in a way so that the difference
      between intermediate points is always equal to the initial point.
      So, we always know what the difference between the point is.
  
  
      Parameters
      ==========
  
      Q : point on the curve in Montgomery form
      diff : self - Q
  
      Examples
      ========
  
      >>> from sympy.ntheory.ecm import Point
      >>> p1 = Point(11, 16, 7, 29)
      >>> p2 = Point(13, 10, 7, 29)
      >>> p3 = p2.add(p1, p1)
      >>> p3.x_cord
      23
      >>> p3.z_cord
      17
      """
      u = (self.x_cord - self.z_cord) * (Q.x_cord + Q.z_cord)
      v = (self.x_cord + self.z_cord) * (Q.x_cord - Q.z_cord)
      add, subt = u + v, u - v
      x_cord = diff.z_cord * add * add % self.mod
      z_cord = diff.x_cord * subt * subt % self.mod
      return Point(x_cord, z_cord, self.a_24, self.mod)
  
file_path: sympy/sympy/ntheory/ecm.py
imports: from math import log
  from sympy.core.random import _randint
  from sympy.external.gmpy import gcd, invert, sqrt
  from sympy.utilities.misc import as_int
  from .generate import sieve, primerange
  from .primetest import isprime
label_desc: Use image node_id 3 for calling the Point obj's underlying member method code with example usage: obj.add(Q, diff) and returns: Point