Approximation

com.phasmidsoftware.number.core.applications.Approximation
object Approximation

Object which deals with the approximations of function values.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def converged(f: Double => Double, dfByDx: Double => Double)(confidence: Double)(x: Number, target: Number): Try[Boolean]

Method to determine if the approximation can be considered converged. We use the convolution of the probability density functions (PDFs) to determine if the probability of overlap exceeds the value p.

Method to determine if the approximation can be considered converged. We use the convolution of the probability density functions (PDFs) to determine if the probability of overlap exceeds the value p.

Value parameters

confidence

a probability between 0 and 1 -- 0 would always result in true; 1 will result in false unless x1 actually is x2.

dfByDx

the derivative function.

f

the function.

x

a Number which will be compared with zero.

Attributes

Returns

a Try[Boolean].

def evaluate(f: Double => Double, dfByDx: Double => Double)(x: Number): Try[Number]

Method to evaluate function f at value x.

Method to evaluate function f at value x.

Value parameters

dfByDx

the derivative of the function.

f

the function.

x

the value to pass into f.

Attributes

Returns

the function's value at x.

def evaluateWithoutDerivative(f: Double => Double)(x: Number): Try[Number]

Method to evaluate function f at value x. We ignore the derivative of the function at x. NOTE: this has consequences in terms of the precision of the result.

Method to evaluate function f at value x. We ignore the derivative of the function at x. NOTE: this has consequences in terms of the precision of the result.

Value parameters

f

the function.

x

the value to pass into f.

Attributes

Returns

the function's value at x.

def iterate(functions: Double => Double*): Number => Try[Number]

Method used by solve to iterate towards a solution. This method of iterating towards a root of a continuously differentiable function implements Householder's method in general. The number of functions provided is the "order" of the method. The Newton-Raphson method is Householder's method, order 1. The Halley method is Householder's method, order 2. And so on.

Method used by solve to iterate towards a solution. This method of iterating towards a root of a continuously differentiable function implements Householder's method in general. The number of functions provided is the "order" of the method. The Newton-Raphson method is Householder's method, order 1. The Halley method is Householder's method, order 2. And so on.

Value parameters

functions

the derivatives of the function, starting with the 0th, i.e., the function itself.

Attributes

def solve(confidence: Double, functions: Double => Double*)(x0: Number, target: Number = ...): Try[Number]

This method of finding a root of a continuously differentiable function implements Householder's method in general. The number of functions provided is the "order" of the method. The Newton-Raphson method is Householder's method, order 1. The Halley method is Householder's method, order 2. And so on. f[n](x) is the nth derivative of x, such that f[0](x) = f(x) and f[1](x) = f'(x) = d(f(x))/dx.

This method of finding a root of a continuously differentiable function implements Householder's method in general. The number of functions provided is the "order" of the method. The Newton-Raphson method is Householder's method, order 1. The Halley method is Householder's method, order 2. And so on. f[n](x) is the nth derivative of x, such that f[0](x) = f(x) and f[1](x) = f'(x) = d(f(x))/dx.

Value parameters

confidence

the confidence we need for the resulting root to be the same as zero.

functions

a list of the derivative functions: f0, f1, f2, f3, etc.

target

the target value, by default, this will be a fuzzy version of (Double) zero.

x0

the initial guess.

Attributes