Weierstrass–Mandelbrot function

The Weierstrass–Mandelbrot function (often abbreviated W-M function) is a generalization of the classical Weierstrass function, extended to higher dimensions to model natural fractal phenomena. It is frequently used in terrain generation, particularly in simulated environments for robotics and autonomous vehicle testing. Unlike its 1D counterpart, the W-M function in multiple dimensions displays directionality, anisotropy, and multifractality, making it suitable for simulations of physically realistic surfaces.[1]
Mathematical formulation
[edit]The W-M function has the following definition:
where:
- is the terrain height at the spatial coordinates ,
- are the 2D spatial coordinates on the ground plane,
- is a normalization factor,
- is the frequency scaling factor,
- is the fractal dimension,
- is a uniformly distributed random phase,
- is the number of angular directions,
- is the maximum frequency index,
- is the sampling length,
- is the scaling coefficient.[2]
The W-M function generates statistically self-similar surfaces with control over roughness, orientation, and frequency distribution, making it ideal for modeling realistic and irregular topographies.

Use in terrain generation
[edit]The Weierstrass–Mandelbrot function has found wide usage in procedural generation of digital terrains. Its multifractal nature allows the synthesis of realistic elevation maps for evaluating the performance of ground vehicles, particularly autonomous robots navigating rough or off-road environments.[3]
The function is especially useful for testing suspension, traction, and path planning modules of autonomous ground vehicles in computer simulations.
Implementation in Python / NumPy
[edit]import numpy as np
def weierstrass_mandelbrot_3d(x, y, D, G, L, gamma, M, n_max):
"""
Compute the 3D Weierstrass-Mandelbrot function z(x, y).
Parameters:
x, y : 2D np.ndarrays
Meshgrid arrays of spatial coordinates.
D : float
Fractal dimension (typically between 2 and 3).
G : float
Amplitude roughness coefficient.
L : float
Transverse width of the profile.
gamma : float
Frequency scaling factor (typically > 1).
M : int
Number of ridges (azimuthal angles).
n_max : int
Upper cutoff frequency index.
Returns:
z : 2D np.ndarray
The height field generated by the WM function.
"""
A = L * (G / L) ** (D - 2) * (np.log(gamma) / M) ** 0.5
z = np.zeros_like(x)
for m in range(1, M + 1):
theta_m = np.arctan2(y, x) - np.pi * m / M
phi_mn = np.random.uniform(0, 2 * np.pi, size=n_max + 1)
for n in range(n_max + 1):
gamma_n = gamma ** n
r = np.sqrt(x ** 2 + y ** 2)
term = (
np.cos(phi_mn[n]) -
np.cos(
2 * np.pi * gamma_n * r / L * np.cos(theta_m) + phi_mn[n]
)
)
z += gamma ** ((D - 3) * n) * term
return A * z
See also
[edit]- Fractal
- Digital elevation model
- Procedural generation
- Autonomous ground vehicle
- Weierstrass function
- Brownian surface
- Karl Weierstrass
- Benoit Mandelbrot
References
[edit]- ^ Robert L. Jackson (2023). Fractal terrain generation for vehicle simulation. Academia.edu. [1]
- ^ Marcel Ausloos and D. H. Berman (1985). "A Multivariate Weierstrass–Mandelbrot Function." Proceedings of the Royal Society A. 400 (1819): 331–350. DOI:10.1098/rspa.1985.0083
- ^ Casey D. Majhor and Jeremy P. Bos. "Multifractal Terrain Generation for Evaluating Autonomous Off-Road Ground Vehicles." arXiv preprint arXiv:2501.02172 (2025). arXiv:2501.02172