Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

fminviz

Visualize Function Minimum


Description

Visualizes multivariate functions around a point or along a line between two points in R^n.

Usage

fminviz(fn, x0, nlines = 2*length(x0),
        npoints = 51, scaled = 1.0)

flineviz(fn, x1, x2, npoints = 51, scaled = 0.1)

Arguments

fn

multivariate function to be visualized.

x0,x1,x2

points in n-dimensional space.

nlines

number of lines to plot.

npoints

number of points used to plot a line.

scaled

scale factor to extend the line(s).

Details

fminviz vizualizes the behavior of a multivariate function fn around a point x0. It randomly selects nlines lines through x0 in R^n and draws the curves of the function along these lines in one graph.

Curves that have at least one point below fn(x0) are drawn in red, all others in blue. The scale on the x-axis is the Euclidean distance in R^n. The scale factor can change it.

flineviz vizualizes the behavior of a multivariate function fn along the straight line between the points x1 and x2. Points x1 and x2 are also plotted.

Value

Plots a line graph and returns NULL (invisibly).

Examples

## Not run: 
  f1 <- function(x) x[1]^2 - x[2]^2
  fminviz(f1, c(0, 0), nlines = 10)

  f2 <- function(x) (1 - x[1])^2 + 100*(x[2] - x[1]^2)^2
  flineviz(f2, c(0, 0), c(1, 1))
  
## End(Not run)

adagio

Discrete and Global Optimization Routines

v0.8.4
GPL (>= 3)
Authors
Hans W. Borchers [aut, cre]
Initial release
2021-04-30

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.