Showing posts with label smooth. Show all posts
Showing posts with label smooth. Show all posts

Wednesday, 8 April 2026

Singular Versus Non-Singular Elliptic Curves

I needed to clarify the difference between singular and non-singular elliptic curves. Figure 1 shows an example of a singular elliptic curve and Figure 2 shows an example of a non-singular elliptic curve. They differ only in the constant term.


Figure 1: \(y^2=x^3-3x+2\)


Figure 2:  \(y^2=x^3-3x-2\)

I asked Gemini to clarify:

Understanding Elliptic Curves:
Singular vs. Non-Singular and the Discriminant

The difference between singular and non-singular elliptic curves comes down to two main aspects: their geometric shape (how they look) and their algebraic properties (how their roots behave). To be a formal elliptic curve, the curve must be non-singular, meaning it is completely smooth and has no sharp points or self-intersections. Let's explore exactly why this happens and how the math behind it works.

1. The Geometric Difference: Smooth vs. Broken

An elliptic curve is typically defined by the short Weierstrass equation:

$$y^2 = x^3 + ax + b$$

Visually, the distinction relies on whether you can draw a unique, straight tangent line at every single point on the curve.

  • Non-Singular (Smooth): The curve flows perfectly without breaking. Every point on the curve has exactly one clear tangent line.
  • Singular (Node): The curve loops back and intersects itself, creating a shape that looks like a little ribbon or a fish. At the exact point where the lines cross (the node), there are two different tangent lines.
  • Singular (Cusp): The curve comes to a sharp, pinching point before turning around. At this sharp tip (the cusp), the tangent line is undefined or vertical in a way that breaks the curve's smooth flow.

2. The Algebraic Difference: The Roots and the Discriminant

Mathematically, whether a curve is smooth or singular is determined by the roots of the cubic polynomial on the right side of the equation: \(f(x) = x^3 + ax + b\).

For the curve to be non-singular, \(f(x)\) must have three distinct roots. If any roots are repeated, the curve becomes singular. We measure this using the discriminant (\(\Delta\)), which checks for repeated roots without forcing us to actually factor the polynomial:

$$\Delta = -16(4a^3 + 27b^2)$$

The discriminant categorizes the curve as follows:

  1. \(\Delta \neq 0\) (Non-Singular): There are no repeated roots. The curve is valid and smooth.
  2. \(\Delta = 0\) (Singular - Node): The polynomial has one root that repeats twice.
  3. \(\Delta = 0\) and \(a=b=0\) (Singular - Cusp): The polynomial has one root that repeats three times.

3. Deriving the Discriminant

How do we know that \(4a^3 + 27b^2\) is the exact expression to check for repeated roots? It comes from a core algebraic principle: finding the exact conditions under which a polynomial and its derivative share a common root.

When a polynomial has a repeated root (creating a singular node or cusp), its graph touches the x-axis without crossing it. At that exact touching point, two things are true: the value of the function is zero, and the slope of the tangent line (the derivative) is also zero.

Let’s look strictly at the cubic part of the equation: \(f(x) = x^3 + ax + b\) where \(f(x) \equiv y \) and \( \textbf{not} \)  \(y^2\). To find where the slope is zero, we take the first derivative: \(f'(x) = 3x^2 + a\). If the curve has a repeated root, we set both equal to zero and solve the system of equations.

Step 1: Solve the derivative for \(x^2\)

$$3x^2 + a = 0 \implies x^2 = -\frac{a}{3}$$

Step 2: Substitute this into the original polynomial

We know \(f(x) = 0\). We can rewrite \(x^3\) as \(x(x^2)\) and substitute our finding:

$$x\left(-\frac{a}{3}\right) + ax + b = 0$$

Combine the \(x\) terms:

$$\frac{2a}{3}x + b = 0 \implies x = -\frac{3b}{2a}$$

Step 3: Combine everything to find the condition

Take this new expression for \(x\), square it, and set it equal to our original \(x^2\) equation:

$$\left(-\frac{3b}{2a}\right)^2 = \frac{9b^2}{4a^2}$$

$$\frac{9b^2}{4a^2} = -\frac{a}{3}$$

Cross-multiply to clear the fractions and move everything to one side:

$$27b^2 = -4a^3$$

$$4a^3 + 27b^2 = 0$$

This expression is the core polynomial discriminant. If it equals zero, the curve is singular.

4. The Mystery of the "-16"

In the standard elliptic curve discriminant formula \(\Delta = -16(4a^3 + 27b^2)\), the \(-16\) multiplier often seems mysterious because it doesn't change whether the expression equals zero or not. Its origin lies in the general Weierstrass equation:

$$y^2 + a_1xy + a_3y = x^3 + a_2x^2 + a_4x + a_6$$

When calculating the discriminant for this complex general equation (often used in cryptography over different prime bases), the result is a very long polynomial. When mathematicians apply the algebraic transformations required to squash that long equation down into the short \(y^2 = x^3 + ax + b\) format, the math naturally factors out a \(-16\). This factor is kept in the definition so that the discriminant's properties remain perfectly consistent across all fields of mathematics, regardless of which version of the equation you are using.

5. Why Does This Matter? (The Group Law)

Elliptic curves are famously used in cryptography and number theory. This utility relies on the Group Law, a geometric way to "add" two points on the curve to find a third point. The rule states that a straight line drawn through any two points on an elliptic curve will intersect the curve at exactly one other point, which is then reflected across the x-axis.

If a curve has a node or a cusp, this mathematical machinery breaks down. If your line passes through a self-intersecting node, the math cannot determine a unique intersection point, and the addition fails. Because singular curves cannot sustain this group structure, algorithms naturally reject them to prevent invalid calculations.

Saturday, 29 March 2025

Smooth Versus Jagged

I need to make more use of AI in my blog posts and to this end I wanted to replace the jagged lines in Figure 3 of my previous post with one continuous smooth line. The graph in question looked as shown in Figure 1 below:


Figure 1

The data being plotted were the numbers from 395 to 425 and their corresponing sigma values:

[(395, 480), (396, 1092), (397, 398), (398, 600), (399, 640), (400, 961), (401, 402), (402, 816), (403, 448), (404, 714), (405, 726), (406, 720), (407, 456), (408, 1080), (409, 410), (410, 756), (411, 552), (412, 728), (413, 480), (414, 936), (415, 504), (416, 882), (417, 560), (418, 720), (419, 420), (420, 1344), (421, 422), (422, 636), (423, 624), (424, 810), (425, 558)]

I asked Google Gemini to put a smooth curve through these points and Figure 2 shows what it came up with when I pasted the code into SageMathCell.


Figure 2: permalink

This is a satisfying output and is just an alternative way to display the data. There may well be a way to implement this using SageMath code alone but this approach using Python was quick and easy. It also creates a title and legends for the point and curve. I can use this code in future when needed. Here is the code that Gemini created:

import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import CubicSpline

data = [(395, 480), (396, 1092), (397, 398), (398, 600), (399, 640), (400, 961), (401, 402), (402, 816), (403, 448), (404, 714), (405, 726), (406, 720), (407, 456), (408, 1080), (409, 410), (410, 756), (411, 552), (412, 728), (413, 480), (414, 936), (415, 504), (416, 882), (417, 560), (418, 720), (419, 420), (420, 1344), (421, 422), (422, 636), (423, 624), (424, 810), (425, 558)]

# Extract x and y values
x = [point[0] for point in data]
y = [point[1] for point in data]

# Create a cubic spline interpolation
cs = CubicSpline(x, y)

# Generate smoother x values for plotting the curve
x_smooth = np.linspace(min(x), max(x), 500)  # Adjust 500 for more/less smoothness
y_smooth = cs(x_smooth)

# Plot the original points and the smooth curve
plt.figure(figsize=(10, 6))
plt.plot(x, y, 'o', label='Original Points')
plt.plot(x_smooth, y_smooth, '-', label='Smooth Curve (Cubic Spline)')
plt.xlabel('X')
plt.ylabel('Y')
plt.title('Smooth Curve Through Points')
plt.legend()
plt.grid(True)
plt.show()

Of course, Gemini provides a full explanation of the code that it created:

Explanation:

  1. Import Libraries:
    • numpy for numerical operations (especially for generating smoother x-values).
    • matplotlib.pyplot for plotting the graph.
    • scipy.interpolate.CubicSpline for creating the smooth curve.

  2. Extract Data: The x and y values are extracted from the data list into separate lists.

  3. Cubic Spline Interpolation:
    • CubicSpline(x, y) creates a cubic spline object that represents the smooth curve passing through the given data points. Cubic splines are chosen as they offer a good balance between smoothness and accuracy.

  4. Generate Smooth x-Values:
    • np.linspace(min(x), max(x), 500) creates an array of 500 evenly spaced x-values between the minimum and maximum x-values of the original data. This is used to generate a smoother curve for plotting. Adjust the 500 for a curve with more or less detail.

  5. Calculate Smooth y-Values:
    • cs(x_smooth) calculates the corresponding y-values for the smoother x-values using the cubic spline interpolation.

  6. Plotting:
    • plt.plot(x, y, 'o', label='Original Points') plots the original data points as circles.
    • plt.plot(x_smooth, y_smooth, '-', label='Smooth Curve (Cubic Spline)') plots the smooth curve.
    • The rest of the code sets up the plot's labels, title, legend, and grid.
    • plt.show() displays the plot.

  7. How to Run:
    • Make sure you have numpy, matplotlib, and scipy installed (pip install numpy matplotlib scipy).
    • Save the code as a Python file (e.g., smooth_curve.py).
    • Run the file from your terminal: python smooth_curve.py.