Skip to content

Resolve "(LearnerND) allow any convex hull as domain"

Jorn Hoofwijk requested to merge 114--learnerND-convex-hull into master

Closes #114 (closed)

Works especially well when combined with !124 (merged)

usage:

import scipy
import adaptive
adaptive.notebook_extension()

def f(xyz):
    x, y, z = xyz
    return x**4 + y**4 + z**4 - (x**2+y**2+z**2)**2

b = [(-1, -1, -1),
     (-1,  1, -1),
     (-1, -1,  1),
     (-1,  1,  1),
     ( 1,  1, -1),
     ( 1, -1, -1)]

bounds = scipy.spatial.ConvexHull(b)
learner = adaptive.LearnerND(f, bounds)
runner = adaptive.Runner(learner, goal=lambda l:l.npoints>1000)
runner.live_info()

Now, if you indeed also have !124 (merged) at your disposal, you are able to run something like this:

learner.plot_isosurface(-0.5)

in order to get this:

image

otherwise you could run:

learner.plot_slice({1:0})

to get this:

image

Edited by Jorn Hoofwijk

Merge request reports

Loading