71
Canonical Grid model
Physics starter - Resolve a localized integral
A deliberately narrow Gaussian illustrates why adaptive samples can miss known structure.
- Scale
- Small
- Source
- physics-quadrature-recovery.grid
- Length
- 38 lines
- Collection
- Advanced language
- Level
- Intermediate
- Runtime
- Portable
- Version
- 1.0.0
MODEL "Physics starter - Resolve a localized integral"
DESCRIPTION "A deliberately narrow Gaussian illustrates why adaptive samples can miss known structure."
VERSION "1.0.0"
AUTHOR "Grid Team"
TAGS "physics", "starter", "quadrature"
# A peak well inside [0,1]; the restricted interval covers ten widths either side.
input PeakWidth = 0.0001
VALIDATE BETWEEN 0.00001 AND 0.001 MESSAGE "Use width from 0.00001 to 0.001."
input PeakCenter = 0.12345
VALIDATE BETWEEN 0.1 AND 0.9 MESSAGE "Keep the peak away from interval boundaries: center 0.1 to 0.9."
output Unsplit = INTEGRATE((x) => EXP(-(((x - PeakCenter) / PeakWidth)^2)), 0, 1, 1e-12)
output Restricted = INTEGRATE((x) => EXP(-(((x - PeakCenter) / PeakWidth)^2)), PeakCenter - 10 * PeakWidth, PeakCenter + 10 * PeakWidth, 1e-12)
output Reference = PeakWidth * SQRT(PI())
output UnsplitError = ABS(Unsplit - Reference)
output RestrictedError = ABS(Restricted - Reference)
output Interpretation = "The infinite-domain reference differs by negligible Gaussian tails in this admitted range. An unsplit zero is not physical validation. Supplying the known peak neighborhood recovers the area; estimated quadrature error cannot certify unseen structure."
output PeakProfile = MAKEARRAY(101, 2, (row, col) => col = 1 THEN PeakCenter + (row - 51) * PeakWidth / 10 ELSE EXP(-(((row - 51) / 10)^2)))
output ScenarioGuide = "Save Baseline, double PeakWidth, compare recovered area with Reference, then restore. Plot PeakProfile using column 1 for position and column 2 for height, with unsmoothed segments. Save and reopen .gridoc."
Charts_1!type = "charts"
Charts_1!config = <toml>
version = 1
kind = "charts"
title = "Known localized peak"
[layout]
x_axis = "Position"
y_axis = "Integrand"
[[charts]]
type = "line"
smooth = false
bind = "PeakProfile"
x = "0"
y = "1"
label = "Known Gaussian structure"
</toml>
END MODEL