Home  >  Article  >  Backend Development  >  How to use python functions to find derivatives

How to use python functions to find derivatives

coldplay.xixi
coldplay.xixiOriginal
2021-03-05 15:46:1527840browse

The method of using python function to find derivatives: first, python running environment, import the differential module package; then define symbolic variables and functions; then find the derivative [diff = diff(f,x)]; finally enter diff. Its variable value is displayed.

How to use python functions to find derivatives

The operating environment of this tutorial: Windows 7 system, python version 3.9, DELL G3 computer.

How to use python functions to find derivatives:

1. Open the python running environment

How to use python functions to find derivatives

2. Import Differential module packagefrom sympy import *

How to use python functions to find derivatives

3. Define symbol variablesx = symbols('x')

How to use python functions to find derivatives

4. Define a function f = x**9

How to use python functions to find derivatives

5, diff = diff(f,x)Derivation

How to use python functions to find derivatives

6. Finally, enter diff to display the variable value

How to use python functions to find derivatives

Related free learning recommendations: python video tutorial

The above is the detailed content of How to use python functions to find derivatives. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to sum in pythonNext article:How to sum in python