0% found this document useful (0 votes)
56 views

Symbolic Programming Code in Python

This document demonstrates various mathematical operations using the sympy Python library including differentiation, integration, solving equations, expanding and factoring expressions, working with matrices, and finding eigenvectors. It shows how to define symbols, perform differentiation and integration, solve sets and systems of equations, expand and simplify expressions, factor polynomials, check satisfiability, define and manipulate matrices through addition and multiplication, and find eigenvalues.

Uploaded by

xlntyogesh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views

Symbolic Programming Code in Python

This document demonstrates various mathematical operations using the sympy Python library including differentiation, integration, solving equations, expanding and factoring expressions, working with matrices, and finding eigenvectors. It shows how to define symbols, perform differentiation and integration, solve sets and systems of equations, expand and simplify expressions, factor polynomials, check satisfiability, define and manipulate matrices through addition and multiplication, and find eigenvalues.

Uploaded by

xlntyogesh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

import sympy as sym

x=sym.Symbol('x')
y=sym.Symbol('y')
#differentiation
print(sym.diff(x**5))
#integration
print(sym.integrate((3*x**4+4*x**3+4*x),(x,1,3)))
#solve expression
sol=sym.solveset(x**2+x-12,x)
print(sol)
sol=sym.solve((x+5*y-2,-3*x+6*y-15),(x,y))
print(sol)
#expand
expr = (x + 1) ** 2
print(sym.expand(expr))
#simplify
print(sym.simplify((x + x * y) / x))
#factors
f=x**4-3*x**2+1
print(sym.factor(f))
print(sym.satisfiable(x & y))
#matrix
m1 = sym.Matrix([[1,2,3],[4,5,6],[7,8,9]])
m2 = sym.Matrix([[9,8,7],[6,5,4],[3,2,1]])
print(m1)
#addition of two matrix
sym.pprint(m1+m2)
#multiplication
sym.pprint(m1*m2)
#eigen vectors
eg=sym.Matrix.eigenvals(m1)
print(eg)

You might also like