Learn R Programming

pracma (version 0.7.5)

fsolve: Solve System of Nonlinear Equations

Description

Solve a system of nonlinear equations.

Usage

fsolve(f, x0, ...)

Arguments

f
function describing the system of equations.
x0
point near to the root.
...
additional variables to be passed to the function.

Value

  • List with
  • xlocation of the solution.
  • fvalfunction value at the solution.

Details

fsolve tries to solve the components of function f simultaneously and uses the Gauss-Newton method with numerical gradient and Jacobian.

This function has not yet been implemented and thus stops with an error.

References

Antoniou, A., and W.-S. Lu (2007). Practical Optimization: Algorithms and Engineering Applications. Springer Science+Business Media, New York.

See Also

newtonsys

Examples

Run this code
# Find a matrix X such that X * X * X = [1, 2; 3, 4]
  F <- function(x) {
    a <- matrix(c(1, 3, 2, 4), nrow = 2, ncol = 2, byrow = TRUE)
    X <- matrix(x,             nrow = 2, ncol = 2, byrow = TRUE)
    return(c(X  }
  x0 <- matrix(1, nrow = 2, ncol = 2)
  fsolve(F, x0)
  # $x                     # newtonsys:
  # -0.1291489  0.8602157
  #  1.2903236  1.1611747
  # $fval
  # 8.881784e-16

Run the code above in your browser using DataLab