Calculating gradient with NumPy

后端 未结 5 1196
粉色の甜心
粉色の甜心 2020-12-24 13:22

I really can not understand what numpy.gradient function does and how to use it for computation of multivariable function gradient.

For example

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-24 13:58

    Numpy and Scipy are for numerical calculations. Since you want to calculate the gradient of an analytical function, you have to use the Sympy package which supports symbolic mathematics. Differentiation is explained here (you can actually use it in the web console in the left bottom corner).

    You can install Sympy under Ubuntu with

    sudo apt-get install python-sympy
    

    or under any Linux distribution with pip

    sudo pip install sympy
    

提交回复
热议问题