This method computes a list of sample points on a variety numerically. If $I$ is the zero ideal in a polynomial ring of dimension $n$, then an $n$-tuple of random elements in the ground field is returned. Otherwise, a numerical irreducible decomposition of $I$ is computed, which is then used to sample points.
If the number of points $s$ is unspecified, then it is assumed that $s = 1$.
One can provide a witness set for $V(I)$ if a witness set is already known.
In the example below, we sample a point from $A^3$ and then $3$ points from $V(x^2 + y^2 + z^2 - 1)$ in $A^3$.
i1 : R = CC[x,y,z]; |
i2 : samp = numericalSourceSample(ideal 0_R) o2 = {{.892712+.673395*ii, .29398+.632944*ii, .025888+.714827*ii}} o2 : List |
i3 : samp#0 o3 = {.892712+.673395*ii, .29398+.632944*ii, .025888+.714827*ii} o3 : Point |
i4 : I = ideal(x^2 + y^2 + z^2 - 1); o4 : Ideal of R |
i5 : numericalSourceSample(I, 3) o5 = {{.0639312+.363095*ii, .349078+.480802*ii, -1.12512+.169804*ii}, {1.824+.510044*ii, -.745985+1.12127*ii, ---------------------------------------------------------------------------------------------------------------------------- -.080127+1.17155*ii}, {.904524-.892533*ii, 1.19581+.66524*ii, .0902927+.13085*ii}} o5 : List |
As of version 2.2.0 (Nov 2020), it is also possible to specify a custom sampling function: namely, one can specify the value of the option Software to be a function which takes in the ideal $I$ and returns a point.
The following example shows how to sample a point from SO(5, $\mathbb{R}$).
i6 : n = 5 o6 = 5 |
i7 : R = RR[a_(1,1)..a_(n,n)] o7 = R o7 : PolynomialRing |
i8 : A = genericMatrix(R,n,n); 5 5 o8 : Matrix R <--- R |
i9 : I = ideal(A*transpose A - id_(R^n)); o9 : Ideal of R |
i10 : q = first numericalSourceSample(I, Software => I -> realPoint(I, Iterations => 100)) o10 = q o10 : Point |
i11 : matrix pack(n, q#Coordinates) o11 = | -.514585 -.0590333 -.340792 .739251 .262836 | | .794998 -.127686 -.519368 .270682 .0930521 | | .218364 .714315 .3546 .47793 -.296496 | | .204042 -.603484 .670006 .36953 .0933285 | | .117732 .325223 .198658 -.12356 .908647 | 5 5 o11 : Matrix RR <--- RR 53 53 |
i12 : norm evaluate(gens I, q) o12 = .00000340327416159525 o12 : RR (of precision 53) |
Since numerical irreducible decompositions are done over CC, if $I$ is not the zero ideal, then by default the output will be a point in complex space (regardless of the ground field of the ring of $I$).
The object numericalSourceSample is a method function with options.