{
  "schemaVersion": 1,
  "slug": "pyramid-volume-calculator",
  "category": "geometry",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "3bbe99406f1607476c0079efdf4afb4ff1c008c3b292417f6f52d5c608884712",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/pyramid-volume-calculator.json",
    "src/engine.js"
  ],
  "runtimeSource": "/sources/engine.txt",
  "runtimeHash": "5c888d8898afbdee36267bb9977829e1e2ac568f6677c8ee87469c139864645c",
  "scope": "The compute function records implemented equations, constants, lookup tables and custom rules. Inputs record defaults and allowed values; outputs record precision and units. Defaults are examples, not recommendations. General background references are not evidence for this specific algorithm.",
  "publishedFormula": {
    "formula": "V = s²h ÷ 3; l = √(h² + (s ÷ 2)²); A_lat = 2sl; e = √(h² + s² ÷ 2)",
    "vars": [
      [
        "s",
        "Base side"
      ],
      [
        "h",
        "Height"
      ],
      [
        "V",
        "Volume"
      ],
      [
        "l",
        "Slant height"
      ],
      [
        "A_lat",
        "Lateral area"
      ],
      [
        "e",
        "Lateral edge"
      ]
    ],
    "note": "Regular square pyramid. Base area = s²; total surface area = s² + 2sl."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const s = baseSide, h = height;\nconst slant = Math.sqrt(h*h + (s/2)*(s/2));\nconst base = s*s;\nconst lateral = 2*s*slant;\nconst edge = Math.sqrt(h*h + (s/Math.SQRT2)*(s/Math.SQRT2));\nreturn { volume: base*h/3, baseArea: base, slantHeight: slant, lateralEdge: edge, lateralArea: lateral, totalArea: lateral+base };",
    "inputs": [
      {
        "name": "baseSide",
        "type": "number",
        "default": 6,
        "min": 0.01,
        "max": 100000,
        "step": 0.01
      },
      {
        "name": "height",
        "type": "number",
        "default": 10,
        "min": 0.01,
        "max": 100000,
        "step": 0.01
      }
    ],
    "outputs": [
      {
        "name": "volume",
        "precision": 3,
        "unit": "unit³"
      },
      {
        "name": "baseArea",
        "precision": 3,
        "unit": "unit²"
      },
      {
        "name": "slantHeight",
        "precision": 4,
        "unit": "unit"
      },
      {
        "name": "lateralEdge",
        "precision": 4,
        "unit": "unit"
      },
      {
        "name": "lateralArea",
        "precision": 3,
        "unit": "unit²"
      },
      {
        "name": "totalArea",
        "precision": 3,
        "unit": "unit²"
      }
    ],
    "interpret": null
  }
}
