Surface.Gradient Method
Definition
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.1.0
Overload List
| Gradient( | Computes the gradient of the surface at the specified point. |
| Gradient( | Computes the gradient of a 2D surface at the specified point. |
| Gradient( | Computes the gradient of the surface at the specified point. |
| Gradient( | Computes the gradient of the surface at the specified point. |
Gradient(Vector<Double>)
public Vector<double> Gradient(
Vector<double> point
)Parameters
Return Value
Vector<Double>A new vector containing the gradient at the point.
Remarks
This is a convenience method that allocates a new vector for the result.
The length of point must equal Dimension.
Exceptions
| Argument | point is null. |
| Argument | The length of point does not equal Dimension. |
| Not | This surface type does not support gradient computation. |
Gradient(Double, Double)
public virtual (double dx, double dy) Gradient(
double x,
double y
)Parameters
Return Value
ValueTuple<Double, Double>A tuple containing the partial derivatives (∂f/∂x, ∂f/∂y).
Remarks
This is a convenience method for 2D surfaces. It internally calls Gradient(ReadOnlySpan<Double>, Span<Double>).
This method is only applicable when Dimension equals 2.
Exceptions
| Invalid | The surface dimension is not 2. |
| Not | This surface type does not support gradient computation. |
Gradient(ReadOnlySpan<Double>, Span<Double>)
public virtual void Gradient(
ReadOnlySpan<double> point,
Span<double> result
)Parameters
- point ReadOnlySpan<Double>
- A read-only span representing the coordinates of the point.
- result Span<Double>
- A span to receive the gradient vector.
Remarks
The gradient is a vector of partial derivatives with respect to each coordinate dimension.
The length of point must equal Dimension. The length of result must also equal Dimension.
Not all surface types support gradient computation. The default implementation throws NotSupportedException. Override this method in derived classes to provide gradient computation.
For surfaces with extrapolation modes, the gradient respects the same extrapolation behavior as Evaluate(ReadOnlySpan<Double>).
Exceptions
| Argument | The length of point does not equal Dimension. -or- The length of result does not equal Dimension. |
| Not | This surface type does not support gradient computation. |
Gradient(Vector<Double>, Vector<Double>)
public Vector<double> Gradient(
Vector<double> point,
Vector<double>? result
)Parameters
- point Vector<Double>
- A vector representing the coordinates of the point.
- result Vector<Double>
- An optional vector to receive the gradient. If null, a new vector is allocated.
Return Value
Vector<Double>A vector containing the gradient at the point.
Remarks
The length of point must equal Dimension.
If result is non-null, its length must also equal Dimension.
Exceptions
| Argument | point is null. |
| Argument | The length of point does not equal Dimension. -or- result is non-null and its length does not equal Dimension. |
| Not | This surface type does not support gradient computation. |