SymPy symbolic operation library and latex mathematical formula

SymPy symbolic operation library and latex mathematical formula

sympy

SymPy is a Python library for symbolic mathematics, mainly symbolic operations. Its goal is to be a full-featured computer algebra system (CAS), while keeping the code as simple as possible so that it is easy to understand and easy to extend. SymPy is written entirely in Python. Official website address: https://www.sympy.org/en/index.html

From the SymPy version 1.4 documentation, it can be seen that SymPy can support many symbolic calculations in elementary mathematics, advanced mathematics, and even graduate mathematics. In elementary and advanced mathematics, SymPy can support content including but not limited to:

  1. Basic Operations;
  2. Formula simplification (Simplification);
  3. Calculus;
  4. solve equation (Solver);
  5. matrix(Matrices);
  6. geometry (geometry);
  7. series (Series);

In more mathematical fields, what SymPy can support includes but is not limited to:

  1. Category Theory;
  2. Differential Geometry;
  3. Ordinary Differential Equations (ODEs);
  4. Partial Differential Equations (PDEs);
  5. Fourier Transform;
  6. Set Theory;
  7. Logical calculation (Logic Theory).

Sympy is a python library that can be installed directly with pip.

pip install sympy

Sympy can be used to push formulas and simplify, and then directly output the latex code of the formula.
insert image description here
insert image description here
1 + \frac{- Dilation \left(Kernel - 1\right) + L_{in} + 2 Padding - 1}{Stride}It can be copied directly, and it will be displayed as follows:
1 + − Dilation ( K ernel − 1 ) + L in + 2 P adding − 1 S tride 1 + \frac{- Dilation \left(Kernel - 1\right) + L_{in} + 2 Padding - 1}{Stride}1+StrideDilation(Kernel1)+Lin+2Padding1

latex

LaTeX typesetting writing paper
LaTeX (LATEX, transliteration "La Taihe") is a typesetting system based on TEX, developed by American computer scientist Leslie Lamport in the early 1980s, using this This format, even if the user has no knowledge of typesetting and programming, he can give full play to the powerful functions provided by TeX, and can generate a lot of book-quality prints in a few days or even a few hours. This is especially true for generating complex tables and mathematical formulas. It is therefore ideal for producing scientific and mathematical documents of high print quality. This system is equally suitable for generating all other kinds of documents from simple letters to complete books.

The biggest difference between Latex and word is: what you see in Word is what you get, and what you write in Latex is what you get. Latex can write what you get because the typesetting format is uniquely marked by code.

There are many tools that support Latex, and the easiest one can use online Latex tools, such as Overleaf. There are many templates on Overleaf that can be used directly. In addition to the commonly used templates for journal papers, there are also templates for lectures, reports, PPTs, and even academic posters, which basically cover all the conventional needs. Latex typesetting; Sympy pushes the formula and outputs the Latex statement of the formula , or Mathpix Snipping generates formula code recognition output codes.

reference link

Guess you like

Origin blog.csdn.net/qq_39506862/article/details/128461234