forked from kscience/kmath
Change signature of one of integrate helpers
This commit is contained in:
parent
f5289abdc3
commit
feb5743f58
@ -19,16 +19,16 @@ internal class IntegrationTest {
|
||||
|
||||
@Test
|
||||
fun simpson() {
|
||||
val res = CMIntegrator.simpson().integrate(0.0..2 * PI, function)
|
||||
val res = CMIntegrator.simpson().integrate(0.0..2 * PI, function = function)
|
||||
assertTrue { abs(res) < 1e-3 }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun customSimpson() {
|
||||
val res = CMIntegrator.simpson().integrate(0.0..PI, function) {
|
||||
val res = CMIntegrator.simpson().integrate(0.0..PI, {
|
||||
targetRelativeAccuracy = 1e-4
|
||||
targetAbsoluteAccuracy = 1e-4
|
||||
}
|
||||
}, function)
|
||||
assertTrue { abs(res - 2) < 1e-3 }
|
||||
assertTrue { abs(res - 2) > 1e-12 }
|
||||
}
|
||||
|
@ -57,8 +57,8 @@ public fun UnivariateIntegrator<Double>.integrate(
|
||||
@UnstableKMathAPI
|
||||
public fun UnivariateIntegrator<Double>.integrate(
|
||||
range: ClosedRange<Double>,
|
||||
featureBuilder: MutableList<IntegrandFeature>.() -> Unit = {},
|
||||
function: (Double) -> Double,
|
||||
featureBuilder: (MutableList<IntegrandFeature>.() -> Unit) = {},
|
||||
): Double {
|
||||
//TODO use dedicated feature builder class instead or add extensions to MutableList<IntegrandFeature>
|
||||
val features = buildList {
|
||||
|
Loading…
Reference in New Issue
Block a user