wp_area(wp) is the area under the work precision curve of a
WorkPrecision() in log10 coordinates (trapezoid rule over the
tolerances with a positive error and time, by increasing error), or Inf
with fewer than two such points; lower is better.
Usage
wp_area(wp)
best_by_tag(wp_set, tag, n = 1L, metric = "area")
best_of_families(wp_set, family_tags, n = 1L, metric = "area")Details
best_by_tag(set, tag, n) keeps the n best entries carrying tag:
first those with the most usable points, then the lowest mean log10 time
over the error range they cover (the area divided by that range).
best_of_families(set, family_tags, n) keeps the n best of each
family, and signals an error when no family has an entry.
Examples
prob <- ODEProblem(function(u, p, t) -u, 1, c(0, 1))
tols <- c(1e-3, 1e-4, 1e-5)
mk <- function(name, e, t, tags) WorkPrecision(prob, tols, tols, list(final = e), t, NULL, NULL,
name, "final", 3, tags)
set <- WorkPrecisionSet(list(mk("A", c(1e-2, 1e-4, 1e-6), c(1, 2, 5) / 1000, "rk"),
mk("B", c(1e-3, 1e-5, 1e-7), c(2, 4, 9) / 1000, "rk")), 2, tols, tols, prob, NULL,
c("A", "B"), "final", NULL)
wp_area(set[[1]])
#> [1] -10.69897
best_by_tag(set, "rk")$names
#> [1] "A"