Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Haskeleton solution in Creative category for Similar Triangles by veky
import fractions, operator, collections
sub = lambda A, B: tuple(map(operator.sub, A, B))
dot = lambda u, v: sum(map(operator.mul, u, v))
proj = lambda u, v: fractions.Fraction(dot(u, v), dot(v, v))
spread = lambda u, v: proj(u, v) * proj(v, u)
cosq = lambda A, B, C: spread(sub(A, C), sub(B, C))
angles = lambda A,B,C: collections.Counter([cosq(A,B,C),cosq(B,C,A),cosq(C,A,B)])
similar_triangles = lambda ABC, DEF: angles(*ABC) == angles(*DEF)
Jan. 26, 2020
Comments: