Examples

This page demonstrates Globtim features with inline examples and visual results.

Note: Standalone example scripts are being prepared for a future release.


Visual examples of Globtim finding critical points on standard benchmark functions.

Deuflhard

Deuflhard Function

Holder Table

Holder Table Function

Beale

Beale Function

Branin

Branin Function


Basic 2D Workflow

Core API sequence:

StepAPI Call
1. Define problemTestInput(f, dim=2, center=[0.0,0.0], sample_range=1.2)
2. Build polynomialConstructor(TR, degree)
3. Find critical ptssolve_polynomial_system(x, pol)
4. Process solutionsprocess_crit_pts(solutions, f, TR)
5. Analyze & classifyanalyze_critical_points(f, df, TR, enable_hessian=true)

Custom Objective Functions

Define any function accepting a vector x and returning a scalar:

my_function(x) = (x[1]^2 - 1)^2 + (x[2]^2 - 1)^2 + 0.1*sin(10*x[1]*x[2])

Statistical Analysis with Tables

API pattern:

df_enhanced, df_min, tables, stats = analyze_critical_points_with_tables(f, df, TR, show_tables=true)

Export options: write_tables_to_csv(), write_tables_to_markdown(), write_tables_to_latex()


High-Dimensional Problems (3D/4D)

Tips:

  • Use AdaptivePrecision for accuracy/performance balance
  • Reduce polynomial degree as dimension increases (4D → degree 4-6)
  • Disable Hessian analysis for faster results: enable_hessian=false

Domain Exploration

Test different domain sizes to find all critical points:

TR = TestInput(f, dim=2, center=[0.0, 0.0], sample_range=r)      # uniform
TR = TestInput(f, dim=2, center=[0.0, 0.0], sample_range=[2.0, 1.0])  # rectangular

Visualization

For plotting critical points and convergence analysis, use the GlobtimPlots package:

using GlobtimPlots
fig = plot_critical_points(df_enhanced)
fig = plot_convergence(results)

See the GlobtimPlots documentation for available plot types.

For post-experiment analysis (refinement, parameter recovery, campaign comparison), use GlobtimPostProcessing.


Polynomial Degree Comparison

Compare Chebyshev vs Legendre bases and analyze how polynomial degree affects approximation quality and critical point discovery. See the Polynomial Approximation page for theoretical background.


1D Functions with Scalar Input

Works with functions like sin, cos that expect scalar input:

f = x -> sin(3x) + 0.1*x^2
TR = TestInput(f, dim=1, center=[0.0], sample_range=π)

Basin Analysis

Analyze convergence basins for critical points. The df_min DataFrame includes:

  • basin_points - Number of points converging to this minimum
  • average_convergence_steps - Mean BFGS iterations
  • region_coverage_count - Spatial coverage metric

Next Steps