{
  "schemaVersion": 1,
  "slug": "speed-of-sound-calculator",
  "category": "science",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "97e9a616869ba44599cb8a008450ba86181b0b2c4e833489c43dc4b754237ac2",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/speed-of-sound-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": "c = 331.3 × √(1 + T ÷ 273.15)",
    "vars": [
      [
        "T",
        "Air temperature (°C)"
      ],
      [
        "medium",
        "Medium (air/helium/water/…)"
      ]
    ],
    "note": "Air and helium use approximate temperature formulas; liquids and solids use fixed representative speeds. Actual values vary with conditions; travel time is distance divided by selected speed."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const T = Math.max(-273, temperature); const air = 331.3*Math.sqrt(1 + T/273.15); const table = { air: air, helium: 965*Math.sqrt(1 + T/273.15), water: 1482, seawater: 1520, steel: 5960, wood: 3850, concrete: 3200 }; const speed = table[medium] !== undefined ? table[medium] : air; return { speedMps: speed, speedKmh: speed*3.6, speedMph: speed*2.23694, machOne: air, travelTime: speed > 0 ? distance/speed : 0, mediumUsed: medium };",
    "inputs": [
      {
        "name": "temperature",
        "type": "number",
        "default": 20,
        "min": -50,
        "max": 50,
        "step": 0.1
      },
      {
        "name": "medium",
        "type": "select",
        "default": "air",
        "options": [
          {
            "value": "air"
          },
          {
            "value": "helium"
          },
          {
            "value": "water"
          },
          {
            "value": "seawater"
          },
          {
            "value": "steel"
          },
          {
            "value": "wood"
          },
          {
            "value": "concrete"
          }
        ]
      },
      {
        "name": "distance",
        "type": "number",
        "default": 1000,
        "min": 0,
        "max": 1000000,
        "step": 1
      }
    ],
    "outputs": [
      {
        "name": "speedMps",
        "precision": 2,
        "unit": "m/s"
      },
      {
        "name": "speedKmh",
        "precision": 2,
        "unit": "km/h"
      },
      {
        "name": "speedMph",
        "precision": 2,
        "unit": "mph"
      },
      {
        "name": "machOne",
        "precision": 2,
        "unit": "m/s"
      },
      {
        "name": "travelTime",
        "precision": 3,
        "unit": "s"
      },
      {
        "name": "mediumUsed",
        "precision": 0,
        "unit": "",
        "type": "text"
      }
    ],
    "interpret": null
  }
}
