Spaces:
Sleeping
Sleeping
| import sympy as sp | |
| # Define the variable | |
| x = sp.symbols('x') | |
| # Define the polynomials | |
| poly1 = 2*x + 3 | |
| poly2 = 3*x | |
| # Sum the polynomials | |
| sum_poly = poly1 + poly2 | |
| # Simplify the resulting polynomial | |
| simplified_sum_poly = sp.simplify(sum_poly) | |
| # Print the simplified polynomial | |
| print(simplified_sum_poly) |