Enter Function Details
Use explicit multiplication, such as 2*x. Supported functions include
sin, cos, tan, sqrt,
log, ln, exp, and abs.
Example Data Table
| Function |
Variables |
Point |
Expected gradient |
Magnitude |
| x^2 + y^2 |
x,y |
3,4 |
<6, 8> |
10 |
| x*y + sin(x) |
x,y |
1,2 |
<2 + cos(1), 1> |
About 2.73 |
| x^2 + y^2 + z^2 |
x,y,z |
1,-2,3 |
<2, -4, 6> |
About 7.48 |
How to Use This Calculator
- Enter your function with variables like
x, y, or z.
- List the variables in the same order used by the point values.
- Enter the point where the gradient should be measured.
- Add a direction vector if you need a directional derivative.
- Select a numerical method and step size.
- Press the calculate button to see results above the form.
- Use the graph to inspect local behavior.
- Export the final result as CSV or PDF.
Understanding the Gradient of a Function
What the Gradient Means
The gradient is a vector. It describes how a function changes near a point.
Each component is a partial derivative. That component measures change along one variable.
In two variables, the gradient points across the contour lines. In three or more variables,
it still points toward the fastest local increase.
Why It Is Useful
Gradients appear in calculus, optimization, physics, data science, and engineering.
They show the slope of a surface at a chosen location. A large magnitude means the
function changes quickly. A small magnitude means the function is flatter. A zero
gradient can mark a local maximum, minimum, or saddle point.
Numerical Gradient Method
This calculator uses finite differences. The method evaluates the function near the
selected point. Central difference is usually the best default. It checks values on both
sides of the point. Forward and backward methods are useful near boundaries. A smaller
step can improve precision, but it may also increase rounding error.
Direction and Magnitude
The magnitude gives the strength of the gradient. The unit gradient gives only direction.
The directional derivative checks change along a custom vector. A positive value means
the function rises in that direction. A negative value means it falls. A value near zero
means the direction is almost level.
Reading the Graph
For one variable, the graph shows the curve and tangent line. For two or more variables,
the plot shows a contour slice. The arrow follows the local gradient direction. When extra
variables exist, the graph holds them fixed at the entered point. This keeps the view clear.
FAQs
What is the gradient of a function?
The gradient is a vector of partial derivatives. It shows the direction and rate of fastest local increase for a multivariable function.
Can this calculator handle three variables?
Yes. Enter variables like x,y,z and provide three point values. The graph shows a two-variable slice while keeping other variables fixed.
Which derivative method should I choose?
Central difference is usually best for smooth functions. Forward or backward difference can help when points outside a boundary are not valid.
What step size should I use?
A value like 0.0001 works well for many functions. Try nearby values if the result seems unstable or too sensitive.
What is gradient magnitude?
Gradient magnitude is the length of the gradient vector. It measures how strongly the function changes at the chosen point.
What is a directional derivative?
It measures the function change along a selected direction. The calculator normalizes your direction vector before taking the dot product.
Why does the graph hold some variables fixed?
Graphs are easiest in one or two dimensions. For higher dimensions, the calculator varies two variables and keeps the remaining variables fixed.
Why did I get an invalid input error?
The expression may include unsupported syntax, missing multiplication, division by zero, or a function outside its valid domain.