net.sf.tweety.math.opt

## Class NewtonRootFinder

• ```public class NewtonRootFinder
extends RootFinder```
This class implements the Newton method for finding zeros of a function.
Author:
Matthias Thimm
• ### Field Summary

Fields
Modifier and Type Field and Description
`private java.util.List<java.util.List<Term>>` `jacobian`
The jacobian of the function.
`static int` `MAX_FIX_ITERATIONS`
The maximum number of fixing iterations.
`static double` `PRECISION`
The precision of the approximation.
• ### Constructor Summary

Constructors
Constructor and Description
```NewtonRootFinder(java.util.List<Term> functions, java.util.Map<Variable,Term> startingPoint)```
Creates a new Newton root finder for the given starting point and the given (multi-dimensional) function
```NewtonRootFinder(Term function, java.util.Map<Variable,Term> startingPoint)```
Creates a new Newton root finder for the given starting point and the given function
• ### Method Summary

All Methods
Modifier and Type Method and Description
`private java.util.List<java.lang.Double>` ```approximate(java.util.List<java.util.List<java.lang.Double>> currentJacobianValue, java.util.List<java.lang.Double> currentVector, java.util.List<java.lang.Double> currentValue)```
Solves the linear equation currentJacobianValue * (X-currentVector) = - currentValue.
`private java.util.List<java.util.List<java.lang.Double>>` ```evaluateMatrix(java.util.List<java.util.List<Term>> functions, java.util.Map<Variable,? extends Term> mapping)```
Evaluates each function in the given matrix with the given values for variables.
`private java.util.Map<Variable,Term>` ```midpoint(java.util.Map<Variable,Term> m1, java.util.Map<Variable,Term> m2)```
Computes the midpoint of the two maps
`java.util.Map<Variable,Term>` `randomRoot()`
Determines the values for the variables appearing in the function such the function evaluates to zero.
• ### Methods inherited from class net.sf.tweety.math.opt.RootFinder

`getFunctions, getStartingPoint, setStartingPoint`
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Field Detail

• #### jacobian

`private java.util.List<java.util.List<Term>> jacobian`
The jacobian of the function.
• #### PRECISION

`public static final double PRECISION`
The precision of the approximation. The actual used precision depends on the number of variables.
Constant Field Values
• #### MAX_FIX_ITERATIONS

`public static final int MAX_FIX_ITERATIONS`
The maximum number of fixing iterations.
Constant Field Values
• ### Constructor Detail

• #### NewtonRootFinder

```public NewtonRootFinder(Term function,
java.util.Map<Variable,Term> startingPoint)```
Creates a new Newton root finder for the given starting point and the given function
Parameters:
`startingPoint` -
• #### NewtonRootFinder

```public NewtonRootFinder(java.util.List<Term> functions,
java.util.Map<Variable,Term> startingPoint)```
Creates a new Newton root finder for the given starting point and the given (multi-dimensional) function
Parameters:
`startingPoint` -
• ### Method Detail

• #### randomRoot

```public java.util.Map<Variable,Term> randomRoot()
throws GeneralMathException```
Description copied from class: `RootFinder`
Determines the values for the variables appearing in the function such the function evaluates to zero.
Specified by:
`randomRoot` in class `RootFinder`
Returns:
a map from variables to terms such that "function" evaluates to zero.
Throws:
`GeneralMathException` - if something went wrong.
• #### midpoint

```private java.util.Map<Variable,Term> midpoint(java.util.Map<Variable,Term> m1,
java.util.Map<Variable,Term> m2)```
Computes the midpoint of the two maps
Parameters:
`m1` -
`m2` -
• #### approximate

```private java.util.List<java.lang.Double> approximate(java.util.List<java.util.List<java.lang.Double>> currentJacobianValue,
java.util.List<java.lang.Double> currentVector,
java.util.List<java.lang.Double> currentValue)
throws GeneralMathException```
Solves the linear equation currentJacobianValue * (X-currentVector) = - currentValue.
Returns:
the next guess for the approximation.
Throws:
`GeneralMathException`
• #### evaluateMatrix

```private java.util.List<java.util.List<java.lang.Double>> evaluateMatrix(java.util.List<java.util.List<Term>> functions,
java.util.Map<Variable,? extends Term> mapping)```
Evaluates each function in the given matrix with the given values for variables.
Parameters:
`functions` -
`mapping` -