plot_surface_with_tangents: Surface with tangent lines at a point
Description
Draws the surface \(z = f(x, y)\) on a rectangular domain and overlays
two tangent line segments at a given point \((x_0, y_0)\):
one tangent in the direction of the \(x\)-axis and one tangent in the
direction of the \(y\)-axis. The partial derivatives are approximated
numerically by central finite differences.
A plotly object representing the surface \(z = f(x, y)\) together
with the point \((x_0, y_0, f(x_0, y_0))\) and the two tangent line
segments. The object can be further modified with usual plotly
tools.
Arguments
f
Scalar field, given as function(x, y) returning a numeric
value.
x0, y0
Numeric scalars with the coordinates of the point where
the tangent lines are drawn.
xlim
Numeric vector c(x_min, x_max) giving the range of the
\(x\)-axis used to draw the surface.
ylim
Numeric vector c(y_min, y_max) giving the range of the
\(y\)-axis used to draw the surface.
n
Integer number of grid points per axis used to discretize the
surface. Must be at least 20.
h
Numeric step used for the central finite–difference
approximation of the partial derivatives \(f_x\) and \(f_y\).
t_len
Numeric scalar giving half the length of the tangent
segments along the \(x\) and \(y\) directions.
title_prefix
Optional character string used as a prefix in the
plot title (for example, the name of the function \(f\)).