ConceptPythonBeginner Computer algebra: formulas as trees, exact until you ask for digits print(f"SymPy Rational(1, 10) * 3 - Rational(3, 10) = {sp.Rational(1, 10) * 3 - sp.Rational(3, 10)}")return float(corr.subs(theta0, sp.Rational(a)).evalf(16))print(sp.srepr(sp.Rational(1, 10)))q = sp.Rational(1, 10**8)H = sp.Matrix(10, 10, lambda i, j: sp.Rational(1, i + j + 1))
ToolPythonBeginner SymPy from the ground up: where the pendulum's 1.74 % comes from E = sp.Rational(1, 2) * L**2 * theta_dot**2 + g * L * (1 - sp.cos(theta))root_two = sp.solve(sp.Eq(two - 1, sp.Rational(1, 100)), theta0)root_three = sp.solve(sp.Eq(three - 1, sp.Rational(1, 100)), theta0)print(sp.solve(sp.Eq(x**2 / 16, sp.Rational(1, 100)), x))