SymPy Flashcards
1
Q
A
from sympy import symbols, solve
x = symbols(‘x’)
equation = x**2 - 4
solution = solve(equation, x)
2
Q
A
from sympy import symbols, sin, cos, integrate
x = symbols(‘x’)
expression = sin(x) * cos(x)
integral = integrate(expression, x)
3
Q
A
from sympy import symbols, diff
x = symbols(‘x’)
expression = x3 + 2x**2 + 3x + 4
derivative = diff(expression, x)
print(derivative)
4
Q
A
from sympy import symbols, Function, dsolve
x, y = symbols(‘x y’)
f = Function(‘f’)
equation = f(x).diff(x) - x*f(x)
solution = dsolve(equation, f(x))
print(solution)
5
Q
A
from sympy import Matrix
A = Matrix([[1, 2], [2, 1]])
eigenvalues = A.eigenvals()
eigenvectors = A.eigenvects()
print(“Eigenvalues:”, eigenvalues)