PHP 클래스 MathPHP\NumericalAnalysis\NumericalIntegration\NumericalIntegration

Numerical integration techniques are used to approximate the value of an indefinite intergal. This calss gives each technique a set of common tools, and requires each technique to define an approximate() method to approximate an indefinite integral.
파일 보기 프로젝트 열기: markrogoyski/math-php

공개 메소드들

메소드 설명
approximate ( $source, $args )
getPoints ( $source, array $args = [] ) : array Determine where the input $source argument is a callback function, a set of arrays, or neither. If $source is a callback function, run it through the functionToPoints() method with the input $args, and set $points to output array. If $source is a set of arrays, simply set $points to $source. If $source is neither, throw an Exception.
validate ( array $points, number $degree = 2 ) : boolean Validate that there are enough input arrays (points), that each point array has precisely two numbers, and that no two points share the same first number (x-component)

보호된 메소드들

메소드 설명
functionToPoints ( callable $function, number $start, number $end, number $n ) : array Evaluate our callback function at n evenly spaced points on the interval between start and end
sort ( array $points ) : array Sorts our coordinates (arrays) by their x-component (first number) such that consecutive coordinates have an increasing x-component.

메소드 상세

approximate() 추상적인 공개 정적인 메소드

abstract public static approximate ( $source, $args )

functionToPoints() 보호된 정적인 메소드

Evaluate our callback function at n evenly spaced points on the interval between start and end
protected static functionToPoints ( callable $function, number $start, number $end, number $n ) : array
$function callable f(x) callback function
$start number the start of the interval
$end number the end of the interval
$n number the number of function evaluations
리턴 array

getPoints() 공개 정적인 메소드

Determine where the input $source argument is a callback function, a set of arrays, or neither. If $source is a callback function, run it through the functionToPoints() method with the input $args, and set $points to output array. If $source is a set of arrays, simply set $points to $source. If $source is neither, throw an Exception.
public static getPoints ( $source, array $args = [] ) : array
$source The source of our approximation. Should be either a callback function or a set of arrays.
$args array The arguments of our callback function: start, end, and n. Example: [0, 8, 5]. If $source is a set of arrays, $args will default to [].
리턴 array

sort() 보호된 정적인 메소드

Sorts our coordinates (arrays) by their x-component (first number) such that consecutive coordinates have an increasing x-component.
protected static sort ( array $points ) : array
$points array
리턴 array

validate() 공개 정적인 메소드

Validate that there are enough input arrays (points), that each point array has precisely two numbers, and that no two points share the same first number (x-component)
public static validate ( array $points, number $degree = 2 ) : boolean
$points array Array of arrays (points)
$degree number The miminum number of input arrays
리턴 boolean