sympy is a very easy to use python-based symbolic calculation library, which uses technology to perform a series of advanced mathematical operations such as differentiation, integration, and limits.
SymPy is a Python library for symbolic mathematics. It aims to become a full-featured computer algebra system (CAS) while keeping the code as simple as possible in order to be comprehensible and easily extensible. SymPy is written entirely in Python. https://www.sympy.org/en/index.html
For example, verify that the entropy of the isentropic process becomes zero. This article installs the anaconda family bucket in the python environment and runs it in the jupyter notebook. 1. import the calculation library sympy:
In order to make the formula look better and make it typeset like?????LATEX, we set the following:
from sympy import init_printing init_printing(use_latex=True)
Well, define some variables, such as entropy change, pressure, etc.:
Cp,Rg,T1,T2,P1,P2,kappa = sympy.symbols('Cp Rg T1 T2 P1 P2 kappa') dS = Cp*sympy.ln(T2/T1)-Rg*sympy.ln(P2/P1) dS
Run the program, the result is as shown below, you can see the formula typesetting lever:
#According to the isentropic process, P2/P1 is: ratio=sympy.Pow(T2/T1,kappa/(kappa-1)) ratio
The relationship between #Cp and kappa is: kappa*Rg/(kappa-1)
After sorting it out a bit, the entropy becomes 0
In the morning, I drank a bowl of lamb soup and asked for an invoice! The boss asked: "Which unit?" I said: "Ulan Hada Sumuna Lingge Gacha Naling, Urad Right Rear Banner, Bayannaoer City, Inner Mongolia Autonomous Region, People's Republic of China Wulitu Uliji Gilgra Bayaner Tai, Director of the Volcano Historical and Cultural Site of the Villagers Committee of the 2.Society of Gecun’s Nalingge No. 2 Village Application for the United Nations Educational, Scientific and Cultural Organization’s World Intangible Cultural Heritage Work Leading Group!" The boss said: "Sheep soup No more!