Skip to content

Repository files navigation

Catenary–Parabola Lab

CLI application comparing a uniform hanging cable with a parabola sharing its span and sag.

Solve from span plus sag or cable length; calculate continuous maximum deviation, exact arc lengths, normalized tensions, and optional forces. Sweep sag/span ratios against two explicit geometric tolerances. Export deterministic JSON, CSV, and standalone SVG.

Build and run

Install a .NET 10 SDK. No SDK patch or NuGet package is required.

dotnet build CatenaryParabolaLab.slnx -c Release
dotnet run --project tests/CatenaryParabolaLab.Verify -c Release

dotnet run --project src/CatenaryParabolaLab -c Release -- solve --span 10 --sag 1 --mass-per-metre 0.5 --out artifacts/example
dotnet run --project src/CatenaryParabolaLab -c Release -- solve --span 10 --length 10.3 --out artifacts/length-example
dotnet run --project src/CatenaryParabolaLab -c Release -- sweep --span 10 --out artifacts/sweep
dotnet run --project src/CatenaryParabolaLab -c Release -- help

Use --overwrite to replace existing result files. Demos: bash scripts/demo.sh or ./scripts/demo.ps1 on systems whose PowerShell policy permits that script. Both run the build, verifier, and five examples.

Example result

For span 10 m, sag 1 m, mass 0.5 kg/m, gravity 9.80665 m/s²:

The curves nearly overlap at true physical scale. The separate deviation plot shows a maximum gap of 3.231 mm, or 0.3231% of sag.

Catenary and same-span, same-sag parabola for a 10 m span and 1 m sag, shown at equal x/y scale.

Vertical deviation as a percentage of sag, with symmetric continuous maxima at approximately x = ±3.538 m.

These SVGs are generated by the span-and-sag solve command above.

Quantity Result
Catenary parameter a 12.663243604 m
Catenary length 10.2618686813 m
Parabola length 10.2606063043 m
Maximum vertical deviation 0.0032311549874 m
Positive maximum location 3.53782470254 m
Maximum deviation / sag 0.3231154987%
Signed relative length error -0.01230162905%
Horizontal = lowest-point tension 62.0919989446 N
Support tension 66.9953239446 N

The maximum comes from a continuous stationary-point solve, independently of plot samples. The default logarithmic sweep has 125/150 passing samples; its largest sampled passing ratio is 0.176247387488, and its upper endpoint fails. This is a sampled result, not an exact threshold.

Files

Command Output files
solve summary.json, coordinates.csv, overlay.svg, deviation.svg
sweep sweep-summary.json, sweep.csv, approximation-errors.svg, tension.svg

JSON carries explicit units, optional force nulls, schema version 1, and separate geometry/maximum solver diagnostics. CSV uses round-trip invariant numbers and empty force cells when mass is omitted. Text outputs use UTF-8 and LF.

The overlay uses equal physical x/y scales, so a shallow cable looks nearly flat. Deviation has a separately labeled y scale. Sweep plots show both error criteria and dimensionless tensions.

Arguments and all results are validated before writing. Files are staged in the destination directory and promoted only after successful staging. Existing target conflicts fail before replacing files; overwrite preserves unrelated files. A failure during promotion can leave partial results. Concurrent writers to one output directory are unsupported.

Exit codes: 0 success/help; 2 arguments/domain; 3 numerical failure/range; 4 IO/export failure. The verifier returns 0 for a nonempty passing suite, 1 for failed checks, and 2 for configuration/runner failures.

Physics and numerical limits

  • Supported sag/span is [1e-6, 2]. Span and sag are positive metres; cable length must exceed span.
  • Cable self-weight is uniform per actual cable length. The matched parabola corresponds to a different loading law and receives no invented self-weight tension.
  • Without positive mass per metre, forces remain absent; normalized tension is still reported. Default gravity is 9.80665 m/s².
  • Near-straight length inputs are solved as represented binary64 values. Rounding length to span loses the excess and is rejected.
  • The relative-length-error metric has an absolute resolution floor of 5e-13. Values below it are flagged, retained, and not assigned an invented sign. Sweep tolerance percentages must be at least 1e-8.
  • Extreme dimensional scales that produce nonfinite or materially underflowed results fail deliberately.

This model assumes equal-height supports, static equilibrium, uniform gravity, a perfectly flexible inextensible cable, and no bending stiffness. It excludes wind, ice, concentrated loads, unequal supports, elasticity, and material strength assessment. The two approximation tolerances are geometric criteria.

Verification

Validated on Windows x64 with .NET SDK 10.0.401: Release build with zero warnings/errors, 162 passing named checks, independent 70-digit Decimal fixtures, real CLI integration, and rendered SVG review. The Git Bash demo passed. This machine's PowerShell execution policy blocked the unsigned PowerShell demo; that launcher is not claimed as tested.

Fixtures are independent of the production implementation. Python is needed only to regenerate development fixtures, never by the application.

Documentation

About

CLI for comparing catenary and parabolic curves, calculating cable tension, and visualizing geometric differences with SVG, CSV, and JSON exports

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages