**Introduction**

In short, *gradient* is a measure of steepness or rate of change.

The *gradient* is a fancy word for derivative, or the *rate of change of a function*. Itâ€™s a vector (a direction to move) that

- points in the direction of greatest increase of a function;
- is zero at a local maximum or local minimum (because there is no single direction of increase).

The term *gradient* is typically used for functions with several inputs and a single output (a scalar field). We can represent these multiple rates of change in a vector, with one component for each derivative.

Similarly to the usual derivative, the gradient represents the slope of the tangent of the graph of the function. More precisely, the gradient points in the direction of the greatest rate of increase of the function and its magnitude is the slope of the graph in that direction.

*So, the gradient points to the direction of greatest increase; keeping following the gradient, and you will reach the local maximum.* (source)

Usefull video - The gradient function dy/dx.

**Example**

Consider a room in which the temperature is given by a scalar field, *T*, so at each point *(x, y, z)* the temperature is *T(x, y, z)* (we will assume that the temperature does not change over time.) At each point in the room, the gradient of *T* at that point will show *the direction the temperature rises most quickly*. The magnitude of the gradient will determine how fast the temperature rises in that direction.

Be careful not to confuse *the coordinates* and *the gradient*. The coordinates are the current location, measured on the x-y-z axis. The gradient is a direction to move from our current location, such as move up, down, left or right.

The gradient at any location points in the direction of greatest increase of a function. In this case, our function measures temperature. So, the gradient tells us *which direction* to move *T* to get a location with a higher temperature. Remember that the gradient does not give us the coordinates of where to go; it gives us the direction to move to increase our temperature.

**Calculation**

Let . Find .

The gradient is just the vector of partial derivatives. The partial derivatives of *f* at the point are:

Therefore, the gradient is

Let's calculate gradient of a function in R with numDeriv package.

# install.packages("numDeriv") library("numDeriv") # define function myfunc <- function(lst) {lst[1]^2 * lst[2]} # calculate grad(myfunc, c(3,2)) # [1] 12 9

All models are wrong, but some are useful.
*George E. P. Box*

- Android
- AngularJS
- Databases
- Development
- Django
- iOS
- Java
- JavaScript
- LaTex
- Linux
- Meteor JS
- Python
- Science

- March 2020
- February 2020
- January 2020
- December 2019
- November 2019
- October 2019
- September 2019
- August 2019
- July 2019
- February 2019
- January 2019
- December 2018
- November 2018
- August 2018
- July 2018
- June 2018
- May 2018
- April 2018
- March 2018
- February 2018
- January 2018
- December 2017
- November 2017
- October 2017
- September 2017
- August 2017
- July 2017
- June 2017
- May 2017
- April 2017
- March 2017
- February 2017
- January 2017
- December 2016
- November 2016
- October 2016
- September 2016
- August 2016
- July 2016
- June 2016
- May 2016
- April 2016
- March 2016
- February 2016
- January 2016
- December 2015
- November 2015
- October 2015
- September 2015
- August 2015
- July 2015
- June 2015
- February 2015
- January 2015
- December 2014
- November 2014
- October 2014
- September 2014
- August 2014
- July 2014
- June 2014
- May 2014
- April 2014
- March 2014
- February 2014
- January 2014
- December 2013
- November 2013
- October 2013