vc_plot_linearization: Plot a candidate tangent plane, coordinate tangents and...

View source: R/plot_multivariable_models.R

vc_plot_linearizationR Documentation

Plot a candidate tangent plane, coordinate tangents and linearization error

Description

Plot a candidate tangent plane, coordinate tangents and linearization error

Usage

vc_plot_linearization(
  result,
  f,
  xlim = NULL,
  ylim = NULL,
  n = 61L,
  colors = c(surface = "#24476b", plane = "#188367", x_tangent = "#c44736", y_tangent =
    "#8250a3", normal = "#555555", increment = "#dd8800", point = "#222222"),
  alpha = 0.5,
  plane_alpha = 0.35,
  line_width = 3,
  t_len = 0.5,
  show_surface = TRUE,
  show_plane = TRUE,
  show_tangents = TRUE,
  show_sections = TRUE,
  show_normal = FALSE,
  normal_scale = 1,
  animate = TRUE,
  frame_ms = 500,
  title = NULL,
  scene = list(aspectmode = "data")
)

Arguments

result

Two-dimensional vc_linearization() result.

f

Deterministic scalar field accepting ONE numeric vector and returning one finite real scalar. For f(x,y), supply an explicit wrapper function(v)f(v[1],v[2]); no automatic signature guessing is performed.

xlim, ylim

Optional finite increasing bounds containing the point; NULL covers the point and successfully evaluated probe endpoints.

n

Integer number of surface/plane samples per coordinate, at least two.

colors

Named surface, plane, x_tangent, y_tangent, normal, increment and point Plotly/CSS colors.

alpha

Finite original-surface opacity between zero and one.

plane_alpha

Finite plane opacity between zero and one.

line_width

Positive finite vector line width.

t_len

Positive finite half-length of coordinate tangent segments.

show_surface, show_plane, show_tangents, show_sections, show_normal

Logical display switches. Sections are sampled true coordinate curves; tangents are linear candidates. Normal uses the stored unit vector (-fx,-fy,1).

normal_scale

Positive finite display length for the normal vector.

animate

Logical; multiple valid probe rows get playback/slider; FALSE displays the last valid row. One valid row is static.

frame_ms

Positive finite frame duration in milliseconds.

title

Optional scalar title; default labels a candidate affine plane and the separate coordinate-sensitivity flag. It never certifies a tangent.

scene

Plotly 3D scene list for camera, axes and aspect settings.

Details

Calculation is not rerun. Surface and affine values are sampled separately with rows corresponding to y and columns to x. Invalid samples are gaps. Probe rows with unavailable values remain in result diagnostics but are omitted from geometry and counted in the default title. Hover retains scale, differential, finite change, remainder and normalized remainder. The plane is a mathematical tangent only if appropriate total differentiability holds; finite probes and partial checks do not prove it.

Value

Plotly widget with sampled scalar surface, candidate affine plane, coordinate tangent models and optional normal. Each displayed probe joins its predicted and actual heights above the same actual domain endpoint.

Examples

if(requireNamespace("plotly",quietly=TRUE)) {
  f <- function(v)v[1]^2+2*v[2]^2
  f |> vc_linearization(c(1,1),dx=c(.1,.2)) |> vc_plot_linearization(f=f)
}

vectorialcalculus documentation built on Nov. 17, 2026, 1:09 a.m.