If I is not the zero ideal, and an initlal point p is not specified, then a numerical irreducible decomposition of I is performed, and cached under I.cache.WitnessSet.
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. Alternatively, one can provide an initial point p on the source V(I), which is then used to generate additional points on the source V(I). This can be much quicker than performing a numerical irreducible decomposition.
In the example below, we sample a point from A3 and then 3 points from V(x2 + y2 + z2 - 1) in A3.
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 |
In the following example, we sample a point from SO(5), by starting with the identity matrix as an initial point:
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 : p = point id_(RR^n) o10 = p o10 : Point |
i11 : time q = first numericalSourceSample(I, p) -- used 0.107766 seconds o11 = q o11 : Point |
i12 : O = matrix pack(n, q#Coordinates/realPart) o12 = | .907013 -.412533 .00310453 .0477588 -.069664 | | .397953 .782149 -.148323 -.323808 .320976 | | .0713505 .182098 .966902 -.0646173 -.150578 | | .116777 .410935 -.0846366 .830394 -.347532 | | -.0152782 -.126618 .189544 .446249 .865257 | 5 5 o12 : Matrix RR <--- RR 53 53 |
i13 : clean(1e-10, O*transpose O - id_(RR^n)) == 0 o13 = true |
Since numerical irreducible decompositions are done over CC, if I is not the zero ideal, then the output will be a point in complex space (regardless of the ground field of the ring of I).