Learn R Programming

vectorialcalculus (version 1.0.5)

solid_of_revolution_y: Solid of revolution around a horizontal line

Description

Construct a three-dimensional surface for the solid obtained by rotating the graph of a function f(x) around the line y = a on a finite interval, and compute its volume and surface areas.

Usage

solid_of_revolution_y(
  f,
  xlim,
  a,
  nx = 120L,
  nt = 120L,
  deriv = NULL,
  h = NULL,
  include_end_caps = FALSE,
  plot = TRUE,
  colors = list(surface = "steelblue", axis = "black", curve = "firebrick"),
  opacity = 0.9,
  show_axis = TRUE,
  show_profile_curve = TRUE,
  curve_thetas = 0,
  curve_width = 4,
  curve_opacity = 1,
  scene = list(aspectmode = "data", xaxis = list(title = "x"), yaxis = list(title = "y"),
    zaxis = list(title = "z"))
)

Value

A list with components:

  • volume: numeric value of the volume.

  • surface_area_lateral: numeric value of the lateral area.

  • surface_area_total: numeric value of the total area.

  • figure: plotly object with the three-dimensional plot if plot = TRUE and plotly is available; otherwise NULL.

Arguments

f

Function of one numeric argument x that returns a numeric value.

xlim

Numeric vector of length two with the limits of the x interval c(xmin, xmax), with xmax > xmin.

a

Numeric scalar that gives the horizontal axis of rotation.

nx

Integer number of grid points along the x direction (for plotting).

nt

Integer number of grid points along the angular direction (for plotting).

deriv

Optional function that returns the derivative of f. If NULL a numeric derivative is used.

h

Optional numeric step for the numeric derivative.

include_end_caps

Logical value. If TRUE the area of the circular cross sections at the ends of the interval is added to the total area.

plot

Logical; if TRUE and plotly is available, the solid is drawn.

colors

List with optional entries surface, axis and curve that control the colours used in the plot.

opacity

Numeric value between 0 and 1 that controls the surface opacity in the plot.

show_axis

Logical value indicating whether the axis of rotation is drawn.

show_profile_curve

Logical value indicating whether the generating curve is drawn on the surface.

curve_thetas

Numeric vector of angles (in radians) where profile curves are drawn.

curve_width

Numeric line width for the profile curves.

curve_opacity

Numeric value between 0 and 1 for the profile curves.

scene

List of plotly scene options used in plotly::layout().

Examples

Run this code
f <- function(x) sqrt(x)
solid_of_revolution_y(f, xlim = c(0, 4), a = 0, plot = FALSE)

Run the code above in your browser using DataLab