Skip to content

FormClassNumber ​

How many classes of indefinite binary quadratic forms a discriminant has. A class is not one reduced form but a CYCLE of them, and that cycle is a periodic continued fraction — which is to say, a closed geodesic.

FormClassNumber(D)the number of classes
FormCycle(form)the class the form lies in, listed
ReducedForms(D)every reduced form of that discriminant
FormAutomorph(form)the hyperbolic matrix generating the form's stabiliser
PellSolution(D)the fundamental (t,u)(t, u) with t2−Du2=4t^2 - Du^2 = 4
Typed signatures
TypePackageApplies
(integer) -> integermodularalways

Domain: The modular group

Details
  • Indefinite means D>0D > 0 and DD is not a perfect square; a square discriminant gives a form that factors, with no cycle
  • SL(2,Z)\mathrm{SL}(2,\mathbb{Z}) acts by (x,y)↦(px+qy,rx+sy)(x,y) \mapsto (px+qy, rx+sy) and preserves DD, so classes live inside one discriminant
  • Gauss's reduction condition is ∣D−2∣a∣∣<b<D|\sqrt{D} - 2|a|| < b < \sqrt{D}, and FormRho steps round the cycle
  • A cycle's length is always even, because ρ\rho flips the sign of the leading coefficient
  • The automorph has trace t>2t > 2, hence is hyperbolic — so a form class IS one of the closed geodesics ModularClasses counts
  • A discriminant ≢0,1(mod4)\not\equiv 0, 1 \pmod 4 has no forms at all, and the class number is 0

Plot

Examples

Basic #

four classes of discriminant 60

live ↗
InFormClassNumber(60)\mathrm{FormClassNumber}(60)Out44
Scope #

the discriminant of a form

live ↗
InFormDiscriminant(QuadraticForm(1,1,−1))\mathrm{FormDiscriminant}(\mathrm{QuadraticForm}(1, 1, -1))Out55

indefinite when D=5D=5

live ↗
InIsIndefinite(QuadraticForm(1,1,−1))\mathrm{IsIndefinite}(\mathrm{QuadraticForm}(1, 1, -1))OutTrue\mathrm{True}

definite when D=−4D=-4

live ↗
InIsIndefinite(QuadraticForm(1,0,1))\mathrm{IsIndefinite}(\mathrm{QuadraticForm}(1, 0, 1))OutFalse\mathrm{False}

already reduced

live ↗
InIsReducedForm(QuadraticForm(1,1,−1))\mathrm{IsReducedForm}(\mathrm{QuadraticForm}(1, 1, -1))OutTrue\mathrm{True}

x2+xy−y2x^2+xy-y^2 at (2,3)(2,3)

live ↗
InEvaluateForm(QuadraticForm(1,1,−1),2,3)\mathrm{EvaluateForm}(\mathrm{QuadraticForm}(1, 1, -1), 2, 3)Out11

one class of discriminant 5

live ↗
InFormClassNumber(5)\mathrm{FormClassNumber}(5)Out11

two classes of discriminant 12

live ↗
InFormClassNumber(12)\mathrm{FormClassNumber}(12)Out22
Applications #

the class, read back as a geodesic

live ↗
InModularWord(FormAutomorph(QuadraticForm(1,1,−1)))\mathrm{ModularWord}(\mathrm{FormAutomorph}(\mathrm{QuadraticForm}(1, 1, -1)))OutLR\text{LR}
Properties #

the action preserves the discriminant

live ↗
InFormDiscriminant(FormAction(QuadraticForm(1,1,−1),ModularMatrix(1,1,0,1)))\mathrm{FormDiscriminant}(\mathrm{FormAction}(\mathrm{QuadraticForm}(1, 1, -1), \mathrm{ModularMatrix}(1, 1, 0, 1)))Out55

32−5⋅12=43^2 - 5\cdot 1^2 = 4

live ↗
InPellSolution(5)\mathrm{PellSolution}(5)Out[3,1]\bigl\lbrack3, 1\bigr\rbrack

42−12⋅12=44^2 - 12\cdot 1^2 = 4

live ↗
InPellSolution(12)\mathrm{PellSolution}(12)Out[4,1]\bigl\lbrack4, 1\bigr\rbrack

the automorph fixes the form

live ↗
InFormAction(QuadraticForm(1,1,−1),FormAutomorph(QuadraticForm(1,1,−1)))\mathrm{FormAction}(\mathrm{QuadraticForm}(1, 1, -1), \mathrm{FormAutomorph}(\mathrm{QuadraticForm}(1, 1, -1)))OutQuadraticForm(1,1,−1)\mathrm{QuadraticForm}(1, 1, -1)

the automorph is hyperbolic

live ↗
InModularTrace(FormAutomorph(QuadraticForm(1,1,−1)))\mathrm{ModularTrace}(\mathrm{FormAutomorph}(\mathrm{QuadraticForm}(1, 1, -1)))Out33

confirmed by ModularKind

live ↗
InModularKind(FormAutomorph(QuadraticForm(1,1,−1)))\mathrm{ModularKind}(\mathrm{FormAutomorph}(\mathrm{QuadraticForm}(1, 1, -1)))OutHyperbolic\text{Hyperbolic}
About
Examples15
CrosswalkWikipediaMathWorldWikidatanLab

See also: ModularClasses, ContinuedFraction, RademacherSymbol