Elliptic Curve Point Doubling Example

This section provides algebraic calculation example of point doubling, adding a point to itself, on an elliptic curve.

The second example is doubling a single point, also taken from "Elliptic Curve Cryptography: a gentle introduction" by Andrea Corbellini at andrea.corbellini.name/2015/05/17 /elliptic-curve-cryptography-a-gentle-introduction/:

```For the elliptic curve given below:
y2 = x3 + ax + b, where (a=-7 and b=10)
Or:
y2 = x3 - 7x + 10

And a given point:
P = (xP, yP) = (1,2)

Find the sum of P and P or 2P:
R = 2P = (xR, yR)

From equation (6):
3(xP)2 + a
m = ---------                 (6)
2(yP)

We get:
m = (3*1*1-7)/4 = -4/4 = -1

From equations (4) and (5):
xR = m2 - 2xP                  (4)
yR = m(xP - xR) - yP           (5)

We get:
xR = (-1)*(-1) - 2*1 = -1
yR = (-1)*(1 + 1) - 2 = -4

So:
R = (-1,-4)
```

Here is how we can verify the result:

```Point, -R=(-1,4), must be on the elliptic curve, which can be verified as:
y2 = x3 - 7x + 10
Or:
4*4 = (-1)*(-1)*(-1) - 7*(-1) + 10
16 = -1 + 7 + 10
16 = 16

Point, -R=(-1,4), must be on the straight line passing through P,
and tangent to the curve, which can be verified as:
y = m(x - xP) + yP
Or:
4 = m(-1 - 1) + 2
4 = -1*(-2) + 2
4 = 4
```