plot_tangent_plane: Plot the function f(x, y) and the tangent plane of f(x, y) at...

View source: R/plot_tanget_plane.R

plot_tangent_planeR Documentation

Plot the function f(x, y) and the tangent plane of f(x, y) at a point (a, b)

Description

Plot the function f(x, y) and the tangent plane of f(x, y) at a point (a, b)

Usage

plot_tangent_plane(
  target_fun,
  grad_fun,
  a = 3,
  b = 2,
  n = 50,
  xlim = c(-4, 4),
  ylim = c(-4, 4)
)

Arguments

target_fun

The function f(x, y) of interest.

grad_fun

The gradient (d/dx f(x,y), d/dy f(x,y)) of the function f(x, y).

a

The point at which to evaluate the tangent plane in the x-axis coordinates.

b

The point at which to evaluate the tangent plane in the y-axis coordinates.

n

The number of grid points at which to evaluate the function f(x, y) and the tangent plane of f(x, y)

xlim

The range of points in the x-axis at which to evaluate the function f(x, y) and the tangent plane of f(x, y)

ylim

The range of points in the y-axis at which to evaluate the function f(x, y) and the tangent plane of f(x, y)

Value

A plotly plot of the function of interest and the

Examples

target_fun <- function(x, y) {
    return(x^2 + y^2)
}
  grad_fun <- function(x, y) {
    c(2 * x, 2 * y)
}
plot_tangent_plane(target_fun = target_fun, grad_fun = grad_fun, a=-1, b = 1)

jtipton25/dasc2594 documentation built on Oct. 7, 2022, 3:46 p.m.