Skip to content

Instantly share code, notes, and snippets.

@LennMars
Created March 29, 2014 13:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LennMars/9854807 to your computer and use it in GitHub Desktop.
Save LennMars/9854807 to your computer and use it in GitHub Desktop.
// Ex. Points=newmat(3,2,[[-1,0],[0,1],[1,0]]);
def get_vanishing_ideal(Points) {
Size = size(Points);
if (Size[1] != 2) error("Error: The number of columns must be 2");
NumPoints = Size[0];
Ideal = [x - Points[0][0], y - Points[0][1]];
for (I = 1; I < NumPoints; ++I) {
PointIdeal = [x - Points[I][0], y - Points[I][1]];
Ideal = poly_ideal_intersection(Ideal, PointIdeal, [x, y], 0);
}
NumPolynomial = length(Ideal);
MaxDegreeInIdeal = 0;
for (IdealLoop = Ideal; IdealLoop != []; ) {
D = poly_degree(car(IdealLoop));
MaxDegreeInIdeal = D > MaxDegreeInIdeal ? D : MaxDegreeInIdeal;
IdealLoop = cdr(IdealLoop);
}
print(["NumPolynomial: ", NumPolynomial, " MaxDegreeInIdeal: ", MaxDegreeInIdeal]);
return Ideal;
}
end$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment