Add chi-square test, rewrite FunctionNode.__eq__