WorksMathematics
Adaptive visualization for enumerative problems
Abstract
We present an adaptive visualization framework and its implementation in the julia package AdaptiveVisualization.jl. Our algorithm visualizes functions using an adaptive sampling procedure that concentrates the evaluation budget at interesting regions of the domain. We illustrate our package on our main application: visualizing parameter spaces of enumerative problems.
Introduction
The main goal of the julia [2] package AdaptiveVisualization.jl [7] is to visualize a function
given an evaluation oracle for . The cost of this task is given by the number of oracle calls. Rather than sampling a compact domain uniformly, our algorithm adaptively samples in regions where the behavior of varies significantly. Therefore, the computational effort is focused on regions where the function has interesting behavior.
Our framework is especially effective for functions associated with solution sets of parametrized polynomial systems. In this setting, an oracle is available by solving via homotopy continuation. For example, fix a polynomial system with parameters and which, for generic parameter values, admits finitely many solutions. This is known as an enumerative problem. Define the function
which counts the number of real solutions. It is locally constant off the real discriminant . Visualizing shows the complement of directly, and a representation of emerges indirectly as the negative-space. Figure 1 shows several refinements of a visualization of such a function.

Figure 1. Successive refinements of visualizations of for a parametrized polynomial system with 6 complex solutions: the equilibria of the Kuramoto model [8, 14].
Our adaptive procedure involves triangulating a finite set of samples in a region , and subsequently determining which triangles are complete versus incomplete. The incomplete triangles are refined by inserting more samples and the process iterates as-decided by the user. At any point, the triangulation may be visualized using GLMakie.jl, the OpenGL backend of Makie.jl [9].
Our software extends beyond real-valued functions on . Given an oracle for a function on , the software automatically restricts to a random 2-plane and visualizes . It can distinguish discrete-valued functions like from locally continuous functions like the Dietmaier function [13]:
Our software supports the visualization of functions which take categorical values, that is, discrete values which are not numerical. For example, one may seek to simultaneously count the number of real and positive solutions to a parametrized system as a pair of integers.
In subsequent sections, we outline the pipeline shown in the flowchart of Figure 2. § 2 describes the initialization steps, and § 3, the refinement steps. § 4 describes the user-interface. Finally, § 5 focuses on the HomotopyContinuation.jl extension for enumerative problems.

Figure 2. Flowchart of the main steps of our adaptive visualization procedure.
Initialization
We describe the procedure for initializing our main datatype: a TriangulationCache. To define it, we introduce two inputs to the initialization process: an evaluation oracle for a function
and a rectangular window
The next subsection describes how our software prepares more general functions into the form (1).
Pre-processing
Given an evaluation oracle for a function with , our software replaces with the composition where is a parametrization of a fixed random 2-plane in . We sample a single random evaluation, and if it returns a floating point type, we declare that is (locally) continuous, and if it returns an integer, we declare it is discrete. More generally, if evaluates to a non-numerical value, we also declare that it is discrete. For the sake of uniformity, discrete non-numerical values are interpreted as being embedded within .
Figure 3. Illustration of the four initialization steps.
Initial point mesh
After pre-processing, the first step in initialization involves producing a lattice of points in the rectangle which preserves its aspect ratio and whose cells are approximately square. Given a resolution , we choose the number of and values to be
so that and .
Delaunay Triangulation
Next, our process stores a Delaunay triangulation of . A Delaunay triangulation is a triangulation of a point set which maximizes the minimum angle involved in a triangle (see [11] or [10 Chapter 9] for a definition). They are used ubiquitously in visualization algorithms due to this feature. In contrast, triangles with small angles often appear “sharp” or degenerate (see Figure 4). We rely on the julia package DelaunayTriangulation.jl for performing this standard computational geometry task efficiently [17].

Figure 4. (Left) three barycentric insertions of an equilateral triangle. (Right) the Delaunay triangulation of the same point set.
Evaluation
Next, we evaluate the oracle at each element of . This is often the most computationally demanding step, motivating the main goal of the package: reduce the number of total evaluations required for a visualization by only evaluating at interesting regions of .
In practice, evaluating on many inputs may be best performed in batches. This is the case, for example, in HomotopyContinuation.jl [4] where it is much quicker to solve a parametrized polynomial system over many parameters in a single call than it is to run several single-solves.
Completeness of Triangles
Initially, all triangles in the Delaunay triangulation are deemed incomplete. The intuition behind this terminology is that incomplete triangles contain interesting behavior of and complete triangles do not. In practice, a triangle is complete if the values of on its vertices do not vary much. For discrete , this means that the values are equal. For locally continuous , it means that the values are within some numerical tolerance.
Beyond these default methods for determining whether a triangle is deemed complete, an advanced user may provide their own is_complete function.
Main datatype: TriangulationCache
The initial points , their Delaunay triangulation, their evaluations via , and the completeness of each triangle are all stored in our main datatype of a TriangulationCache. A TriangulationCache can be easily initialized by calling it on any function of two variables. Optional arguments for its initialization include a visualization window (default: ), a resolution (default: 100), and several additional settings involved in the refinement step discussed in the next section.
Example 1. The code below produces an image (Figure 5) of the Boolean function

Figure 5. Visualization of the function which determines if is negative. Called with resolution .
julia> nodal_cubic(x, y) = y^2 - x^2 * (x + 1) < 0 ? "negative" : "nonnegative"
julia> TC = TriangulationCache(nodal_cubic; xlims = [-2.5, 2.5], resolution = 500)
julia> visualize(TC; edges=true)
Example 2. Consider the function
Figure 6 illustrates the effect of using three different initial resolutions : 500, 5000, and 50000.

Figure 6. Visualizations of the function which indicates whether a point lies inside or outside the curve cut out by . The resolutions of the visualizations are 500, 5000, and 50000, respectively.
Example 2 and Figure 6 illustrate the crux of the problem with naive visualization via a uniform sample: increasing the resolution only marginally increases the visualization quality. Compare the rightmost image in Figure 6 with the result of adaptive visualization, Figure 9, which only uses 5437 evaluations.

Figure 9. Output of above code.
Refinement
The heart of our algorithm is the refinement step. Refinement involves inserting new points into each of the incomplete triangles, updating the Delaunay triangulation, and then repeating two of the steps already discussed in the previous section: “evaluate” and “completeness-check”. The steps of the refinement stage refine! are illustrated in Figure 7. At the top level, refine! accepts a budget of a number of points that can be inserted. The process repeats until that budget runs out or no further refinement can occur.
Figure 7. Illustration of the refinement steps.
Selecting incomplete triangles
The first step of refinement is choosing which incomplete triangles to refine. This is controlled by the window along with two keyword arguments: min_refinement_area and budget. The minimum refinement area controls one of the two filters which are always applied to the set of incomplete triangles. The first filter is that incomplete triangles outside of are ignored. This is relevant since our user-interface allows a user to move the viewing window. The second filter ignores incomplete triangles with area less than
The default for min_refinement_area is , which, for reference, is about the proportion of a image taken up by a grid of pixels.
Once the candidate incomplete triangles have been established, they are sorted by area and scheduled to be refined.
Point insertion strategies
Once a set of incomplete triangles has been chosen for refinement, points are sampled according to a local refinement strategy. Our software offers three native choices:
sierpinski: insert the edge midpoints of the inputted triangles, irredundantly.
barycenter: insert the barycenters of the inputted triangles.
random: insert random points in the interior of the inputted triangles.
The last two of these increase the number of points in TriangulationCache by one for every incomplete triangle chosen for refinement. The method sierpinski increases the number of points by a factor of at most 3. This depends on the configuration of the triangles chosen for refinement. These three strategies are illustrated in Figure 8.

Figure 8. Native local refinement strategies.
Updating the Delaunay triangulation
After the new points have been selected, they are inserted into the triangulation. DelaunayTriangulation.jl has functionality for inserting individual points into a Delaunay triangulation, triangulating, and then locally performing “flips” to make it Delaunay again. This locality is a well-known feature of Delaunay triangulations (see, e.g., [10 Section 9.3]) and is much more efficient than computing a brand new Delaunay triangulation.
Evaluation and triangle completeness
From here, the algorithm proceeds as it does at the end of the initialization step: is evaluated over each of the newly inserted points and each of the triangles in the updated TriangulationCache is checked for completeness.
Functionality and User-Interface
We use this section to summarize the functionality of AdaptiveVisualization.jl. The main exported functions of our package are TriangulationCache, visualize, and refine!. We illustrate this functionality on the function from Example 2.
The TriangulationCache can be initialized via
julia> petal(x, y) = (x^2+y^2)^4-(x^6-15x^4*y^2+15x^2*y^4-y^6)<0 ? "inside" : "outside";
julia> I = [-1.2,1.2];
julia> TC = TriangulationCache(petal; xlims = I, ylims = I, resolution = 1000)
TriangulationCache with:
961 function values
1800 (306) triangles (incomplete)
julia> refine!(TC; budget = 7000); TC
Resolution used:589. Small triangles skipped:0
Resolution used:1237. Small triangles skipped:0
Resolution used:2534. Small triangles skipped:2507
Resolution used:110. Small triangles skipped:2627
Resolution used:6. Small triangles skipped:2640
Resolution used:0. Small triangles skipped:2640
Unable to spend refinement budget; no eligible refinement points remain.
TriangulationCache with:
5437 function values
10752 (2640) triangles (incomplete)
julia> visualize(TC)
The output Makie window is shown in Figure 9.
Compare, for example, the quality of this image and that of the center image in Example 2 with approximately the same number of oracle calls (5000).
Makie Buttons
Notably, the Makie window shown in Figure 9 has the buttons
Refine ← → ↑ ↓ Zoom+ Zoom- Edges Fully Refine
along with a slider for min_refinement_area. Figure 6 already illustrates how the edges of the triangulation appear when the Edges button is pressed. The remaining buttons do as one may expect: Refine calls refine!(TC) and replots, the buttons ←, →, ↑, ↓ each translate the viewing window by 20% in the corresponding direction, and Zoom± either zooms in or out by 20%. When the viewing window changes to contain regions of not seen before, the code recognizes this and re-lays a lattice on the new window with resolution set to the optional argument navigation_initial_resolution. It then refines the new regions using a budget given by the value navigation_refinement_budget. In particular, the software has the quirk that translating nearby a region repeatedly refines it. The min area slider updates min_area_refinement. The Fully Refine button will iteratively call refine! until there are no incomplete triangles with sufficiently large area to refine.
The following code showcases the simplest way to use our software: pass an oracle to the visualize function. Doing so initializes a TriangulationCache with total_resolution-many points, and subsequently refines using the remaining budget of total_resolution.
julia> f = (x, y) -> round(Int, 4 + 3sin(3x)cos(4y));
julia> (TC, puddleImage) = visualize(f)
Resolution used:598. Small triangles skipped:0
Resolution used:152. Small triangles skipped:0
(TriangulationCache with:
975 function values
1841 (978) triangles (incomplete), Scene(13 children, 0 plots))
The code above produces an image, which after pressing ←, ↑, ↑, Zoom-, Refine produces Figure 10.

Figure 10. Image of after clicking →, ↑, ↑, Zoom- and Refine.
Applications to polynomial system solving
Our main motivation for the development of AdaptiveVisualization.jl was the use-case of visualizing parameter spaces of polynomial systems. Our software has a julia extension which activates whenever both AdaptiveVisualization and HomotopyContinuation are loaded by the user. With this extension, the user can input a polynomial system and explore its parameter space.
Fix a system of polynomials in complex variables and parameters,
with the property that has finitely many complex solutions for generic . Then our software has hardcoded functionality to visualize the following three functions:
: counts the number of real solutions to
: counts the number of positive real solutions to
: the same as , but certified using HomotopyContinuation.jl’s [4] certify [5] command.1
The simplest example is the number of real solutions to a monic quadratic univariate polynomial
julia> @var x; @var b,c;
julia> F = System([x^2+b*x+c],variables=[x],parameters=[b,c])
julia> TC1, fig1 = visualize(F; func=:real) # Default
julia> TC2, fig2 = visualize(F; func=:positive)
julia> TC3, fig3 = visualize(F; func=:certify_real)
The pictures produced are shown in Figure 11. We remark that this computation is fundamentally different than how [3] compute similar images.

Figure 11. Visualization of the number of real roots and the number of positive roots of a univariate quadratic polynomial.
The locus , where the number of real solutions changes, emerges as the relief-image of the figures produced by our software. This is sometimes called the real discriminant, which should not be confused with the real part of the complex discriminant (see [1] for an explanation). In settings with more solutions, it is known that chambers can be incredibly small (see, e.g., [12 Page 4]), making our methods particularly apt for such problems.
One additional hard-coded function is the Dietmaier function from [13]:
It takes values in and is the central function involved in the heuristic of Dietmaier optimization (see [6, 13]). Below, we visualize the Dietmaier function on the Kuramoto model on three coupled oscillators (see [14, 16]).
julia> K = kuramoto_model(3);
julia> visualize(K; func = :Dietmaier);

Figure 12. (Left) The function which counts real solutions of the Kuramoto model for . (Right) The Dietmaier function on the same model.
Kuramoto gallery
Kuramoto models for coupled oscillators (see [8, 14]) have beautiful real discriminants. We work with the algebraic formulation
In [15], the authors relate these discriminants with Lissajous varieties. The authors of [1] also look at the real discriminant of the Kuramoto models, but they use intersection points with the discriminant and lines, where we do not ever directly access the discriminant algebraically or geometrically. In each image Figure 13-Figure 15 we visualize a random 2-plane through the origin of the parameter space of the Kuramoto model. The left-most plot is zoomed-out and the plots are zoomed-in as one moves to the right.

Figure 13. A visualization of a random 2-plane through 0 in Kuramoto-4.
We end with our favorite: a highly symmetric 2-plane slice of the parameter space of Kuramoto-7.

Figure 14. A visualization of a random -plane through in Kuramoto-5.

Figure 15. A visualization of a random -plane through in Kuramoto-6.

Figure 16. A visualization of a 2-plane in the parameter space of Kuramoto-7, containing , and . This image has 14-fold symmetry: 7-fold symmetry by cyclically permuting the oscillators, and another 2-fold symmetry given by negation.
Acknowledgements and Funding Declaration
The authors are grateful to Charles Wampler for his comments on an initial version of the code and to Michael Burr for his comments on a later one. This project was supported by a USRA award and by NSERC Discovery Grant RGPIN-2023-03551.
AI Statement
AI tools were not used in the preparation of this manuscript. They were, however, used in improving the code. The original architecture and a prototype were produced by the authors alone. Later, with OpenAI’s Astra and Sol models through Codex, the code was improved on the levels of user-interface and optimized. AI tools were used to simplify and organize the code as well as write tests and documentation. All code and documentation has been subsequently checked by the authors who take full responsibility for them.
References
Email address: [email protected]
Department of Mathematics, University of Western Ontario, London, Ontario, Canada
Email address: [email protected]
Department of Mathematics, University of Western Ontario, London, Ontario, Canada
References
- [1]Edgar A. Bernal, Jonathan D. Hauenstein, Dhagash Mehta, Margaret H. Regan, and Tingting Tang, Machine learning the real discriminant locus, Journal of Symbolic Computation 115 (2023), 409–426.arxiv.org/abs/2006.14078
- [2]J. Bezanson, A. Edelman, S. Karpinski, and V. B. Shah, Julia: A fresh approach to numerical computing, SIAM Rev. 59 (2017), no. 1, 65–98.arxiv.org/abs/1411.1607
- [3]P. Breiding, B. Sturmfels, and K. Wang, Computing arrangements of hypersurfaces, J. Softw. Algebra Geom. 15 (2025), 11–27.DOI
- [4]P. Breiding and S. Timme, HomotopyContinuation.jl: A package for homotopy continuation in Julia, Mathematical Software—ICMS 2018 (Cham), Lecture Notes in Comput. Sci., vol. 10931, Springer, 2018, pp. 458–465.arxiv.org/abs/1711.10911
- [5]Paul Breiding, Kemal Rose, and Sascha Timme, Certifying zeros of polynomial systems using interval arithmetic, ACM Trans. Math. Softw. 49 (2023), no. 1, 11:1–11:14.arxiv.org/abs/2011.05000
- [6]Taylor Brysiewicz, David K. Johnson, and Deepak Mundayur, Dietmaier optimization, In preparation, 2026.
- [7]Taylor Brysiewicz and Noah Vale, AdaptiveVisualization.jl, Julia package, 2026, Available in the Julia General Registry.
- [8]O. Coss, J. D. Hauenstein, H. Hong, and D. K. Molzahn, Locating and counting equilibria of the Kuramoto model with rank-one coupling, SIAM J. Appl. Algebra Geom. 2 (2018), no. 1, 45–71.arxiv.org/abs/1705.06568
- [9]S. Danisch and J. Krumbiegel, Makie.jl: Flexible high-performance data visualization for Julia, J. Open Source Softw. 6 (2021), no. 65, 3349.DOI
- [10]Mark de Berg, Otfried Cheong, Marc van Kreveld, and Mark Overmars, Computational geometry: Algorithms and applications, 3 ed., Springer, Berlin, Heidelberg, 2008.
- [11]Jesús A. De Loera, Jörg Rambau, and Francisco Santos, Triangulations: Structures for algorithms and applications, Algorithms and Computation in Mathematics, vol. 25, Springer, Berlin, Heidelberg, 2010.
- [12]A. Dickenstein, J. M. Rojas, K. Rusek, and J. Shih, Extremal real algebraic geometry and A-discriminants, Moscow Math. J. 7 (2007), no. 3, 425–452.arxiv.org/abs/math/0609485
- [13]Peter Dietmaier, The Stewart–Gough platform of general geometry can have 40 real postures, Advances in Robot Kinematics: Analysis and Control (Jadran Lenarčič and Manfred L. Husty, eds.), Springer, Dordrecht, 1998, pp. 7–16.DOI
- [14]Yoshiki Kuramoto, Self-entrainment of a population of coupled non-linear oscillators, International Symposium on Mathematical Problems in Theoretical Physics (Huzihiro Araki, ed.), Lecture Notes in Physics, vol. 39, Springer, Berlin, Heidelberg, 1975, pp. 420–422.
- [15]Francesco Maria Mascarin and Simon Telen, Lissajous varieties, Advances in Geometry 26 (2026), no. 2, 263–282.
- [16]Dhagash Mehta, Noah S. Daleo, Florian Dörfler, and Jonathan D. Hauenstein, Algebraic geometrization of the Kuramoto model: Equilibria and stability analysis, Chaos 25 (2015), no. 5, 053103.DOI
- [17]D. J. VandenHeuvel, DelaunayTriangulation.jl: A Julia package for Delaunay triangulations and Voronoi tessellations in the plane, J. Open Source Softw. 9 (2024), no. 101, 7174.DOI

