Using the sympy.subs()
method, we can substitute the values of variables into various mathematical functions using the sympy.subs ()
method.
Syntax:
sympy.subs (source, destination)
Return: Return the same expression by changing the variable.
Example # 1:
In this example, we see that with sympy.subs ()
we can substitute the value of an existing variable into a new variable.

Output:
cos (y) + 1
Example # 2:
# import sympy
from
sympy
import
*
# symbol declaration
x, y
=
symbols (
` xy`
)
gfg_exp
=
cos (x)
+
1
# use the sympy.subs () method
gfg_exp
=
gfg_exp.subs (x,
0
)
print (gfg_exp)
Logout:
2
Python Data Science Handbook: Essential Tools for Working with Data  PDF, 1st Edition For many researchers, Python is a firstclass tool, primarily because of its libraries for storing, manipulati...
22/08/2021
Python Crash Course is the world's bestselling guide to the Python programming language. This quick and indepth introduction to Python programming will get you started writing programs, solving prob...
11/08/2021
We live in an age of socalled Big Data. We hear terms like data scientist, and there is much talk about analytics and the mining of large amounts of corporate data for tidbits of business value. Ther...
10/07/2020
IRMA is a researchbased professional organization dedicated to advancing the concepts and practices of information resource management in modern organizations. The primary purpose of IRMA is to promo...
28/08/2021