Integral

scalation.calculus.Integral
object Integral

The Integral object provides implementations for five basic integration methods:

∫f(x)dx on interval [a, b]



trap      - trapezoidal method - linear
simpson   - Simpson method     - quadratic
simpson38 - 3/8 Simpson method - cubic
boole     - Boole Method       - quartic
romberg   - Romberg method     - recursive, uses trap

The first four are Composite Newton-Coates type integrators.

Attributes

See also

en.wikipedia.org/wiki/Newton%E2%80%93Cotes_formulas

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Integral.type

Members list

Value members

Concrete methods

def boole(a: Double, b: Double, f: FunctionS2S, sd: Int): Double

Integrate '∫f(x)dx' on interval '[a, b]' using the Boole method.

Integrate '∫f(x)dx' on interval '[a, b]' using the Boole method.

Value parameters

a

the start of the integration interval

b

the end of the integration interval

f

the function to be integrated

sd

the number of subdivision (intervals) of [a, b]

Attributes

def integrate(on: Interval, f: FunctionS2S): Double

Integrate '∫f(x)dx' on interval 'on' using the default method.

Integrate '∫f(x)dx' on interval 'on' using the default method.

Value parameters

f

the function to be integrated

on

the interval of integration, e.g., (0.0, 2.0)

Attributes

def romberg(a: Double, b: Double, f: FunctionS2S, iter: Int): Double

Integrate '∫f(x)dx' on interval '[a, b]' using the Romberg method. Translation of Java code from the site below to Scala.

Integrate '∫f(x)dx' on interval '[a, b]' using the Romberg method. Translation of Java code from the site below to Scala.

Value parameters

a

the start of the integration interval

b

the end of the integration interval

f

the function to be integrated

iter

the number of iterative steps

Attributes

See also

cs.roanoke.edu/Spring2012/CPSC402A/Integrate.java FIX: shouldn't need a 2D array/matrix.

def simpson(a: Double, b: Double, f: FunctionS2S, sd: Int): Double

Integrate '∫f(x)dx' on interval '[a, b]' using the Simpson method.

Integrate '∫f(x)dx' on interval '[a, b]' using the Simpson method.

Value parameters

a

the start of the integration interval

b

the end of the integration interval

f

the function to be integrated

sd

the number of subdivision (intervals) of [a, b]

Attributes

def simpson38(a: Double, b: Double, f: FunctionS2S, sd: Int): Double

Integrate '∫f(x)dx' on interval '[a, b]' using the 3/8 Simpson method.

Integrate '∫f(x)dx' on interval '[a, b]' using the 3/8 Simpson method.

Value parameters

a

the start of the integration interval

b

the end of the integration interval

f

the function to be integrated

sd

the number of subdivision (intervals) of [a, b]

Attributes

def test(a: Double, b: Double, f: FunctionS2S, ans: Double, sd: Int): Unit

Test each of the numerical integrators: '∫f(x)dx' on interval '[a, b]'.

Test each of the numerical integrators: '∫f(x)dx' on interval '[a, b]'.

Value parameters

a

the start of the integration interval

ans

the answer to the integration problem, if known (for % error)

b

the end of the integration interval

f

the function to be integrated

sd

the number of subdivision (intervals) of [a, b]

Attributes

def trap(a: Double, b: Double, f: FunctionS2S, sd: Int): Double

Integrate '∫f(x)dx' on interval '[a, b]' using the trapezoidal method.

Integrate '∫f(x)dx' on interval '[a, b]' using the trapezoidal method.

Value parameters

a

the start of the integration interval

b

the end of the integration interval

f

the function to be integrated

sd

the number of subdivision (intervals) of [a, b]

Attributes

def (on: Interval, f: FunctionS2S): Double