## Newton's Method (newtons_method)

version 6.0.2 (373 KB) by
Newton's method for finding the root of a differentiable, univariate, scalar-valued function.

Updated 20 Apr 2022

From GitHub

# `newtons_method` Newton's method for finding the root of a differentiable, univariate, scalar-valued function.

## Syntax

`x = newtons_method(f,df,x0)`
`x = newtons_method(f,df,x0,opts)`
`[x,k] = newtons_method(__)`
`[x,k,x_all] = newtons_method(__)`

## Description

`x = newtons_method(f,df,x0)` returns the root of a function specified by the function handle `f`, where `df` is the derivative of (i.e. ) and `x0` is an initial guess of the root.

`x = newtons_method(f,df,x0,opts)` does the same as the syntax above, but allows for the specification of optional solver parameters. `opts` is a structure with the following fields:

`[x,k] = newtons_method(__)` also returns the number of iterations (`k`) performed of Newton's method.

`[x,k,x_all] = newtons_method(__)` does the same as the previous syntaxes, but also returns an array (`x_all`) storing the root estimates at each iteration. This syntax requires that `opts.return_all` be set to true.

• See "EXAMPLES.mlx" or the "Examples" tab on the File Exchange page for examples.

### Cite As

Tamas Kis (2022). Newton's Method (newtons_method) (https://github.com/tamaskis/newtons_method-MATLAB/releases/tag/v6.0.2), GitHub. Retrieved .

##### MATLAB Release Compatibility
Created with R2021b
Compatible with any release
##### Platform Compatibility
Windows macOS Linux