> For the complete documentation index, see [llms.txt](https://johannesliu.gitbook.io/learning-advanced-mathematics-with-python/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://johannesliu.gitbook.io/learning-advanced-mathematics-with-python/7.0-partial_differential_equation/7.2-solve_pde.md).

# 7.2 解偏微分方程

使用sympy.solvers.pdesolve()可以对偏微分方程进行求解。

例：求解偏微分方程$$1+\frac{2 \frac{\partial}{\partial x} f(x,y)}{f(x,y)} + \frac{3 \frac{\partial}{\partial y} f(x,y)}{f(x,y)} =0$$

```python
[]:from sympy.solvers.pde import pdsolve

u = f(x, y)

ux = u.diff(x)

uy = u.diff(y)

eq = Eq(1 + (2\*(ux/u)) + (3\*(uy/u)))

eq
```

\[]: ![](https://3607972777-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mjx-9CYfSlrNPw45CMh%2Fuploads%2Fgit-blob-15e9bb25c2f60d9e5be17378a0ae5780fe507619%2F0cd43807ec0898d5ebe4aa156411c525.png?alt=media)

```python
[]:pdsolve(eq)
```

\[]: ![](https://3607972777-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mjx-9CYfSlrNPw45CMh%2Fuploads%2Fgit-blob-0afa192021f1312f35090cf152a794e087467c97%2F9c3102d11e6b232e9f0c3cb7f673e0e9.png?alt=media)
