SymPy module, identify equation as linear or non-linear?
The answer depends on what you want to do next. To just get a True/False answer try Poly(expr, x).is_linear. This will expand the expression and tell you if it is linear in x.
linear_coeffs will either raise an error if non-linear terms are encountered or else give you the linear coefficients of the given variables, solveset.linear_coeffs(2*x+3*y+z**2,x,y) -> [2, 3, z**2] (where the last element is the constant term in the expression).
linear_eq_to_matrix and solve_linear are also possibilities.
Using SymPy module, is there a method to tell me if the equation is linear or non-linear? If not what's your recommendation to implement such a method. I noticed from documentation that solve() returned values change according to the coefficients.
I just need it as a simple introduction to high school students. to answer a question I found to label whether the function is linear or not.
thank you very much.