Created
March 29, 2014 13:49
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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