Description Usage Arguments Details Value Note References See Also Examples

Solve a system of `m`

nonlinear equations of `n`

variables.

1 2 |

`f` |
function describing the system of equations. |

`x0` |
point near to the root. |

`J` |
Jacobian function of |

`maxiter` |
maximum number of iterations in |

`tol` |
tolerance to be used in Gauss-Newton. |

`...` |
additional variables to be passed to the function. |

`fsolve`

tries to solve the components of function `f`

simultaneously and uses the Gauss-Newton method with numerical gradient
and Jacobian. If `m = n`

, it uses `broyden`

.

List with

`x` |
location of the solution. |

`fval` |
function value at the solution. |

`fsolve`

mimics the Matlab function of the same name.

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ```
## Not run:
# 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 %*% X %*% X - a))
}
x0 <- matrix(1, 2, 2)
X <- matrix(fsolve(F, x0)$x, 2, 2)
X
# -0.1291489 0.8602157
# 1.2903236 1.1611747
## End(Not run)
``` |

```
[,1] [,2]
[1,] -0.1291489 0.8602157
[2,] 1.2903236 1.1611747
```

pracma documentation built on Dec. 11, 2018, 3 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.