{
  "schemaVersion": 1,
  "slug": "wavelength-frequency-calculator",
  "category": "science",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "f83847ecb12bd10e146e5e28cd414740e2a289cb28f79a4671e2445419b28a78",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/wavelength-frequency-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": "f = c ÷ λ; T = 1 ÷ f; E = h × f",
    "vars": [
      [
        "c",
        "Wave speed (m/s)"
      ],
      [
        "λ",
        "Wavelength (m)"
      ],
      [
        "f",
        "Frequency (Hz)"
      ],
      [
        "T",
        "Period (s)"
      ],
      [
        "E",
        "Photon energy (J)"
      ]
    ],
    "note": "Solving for wavelength uses λ = c ÷ f. Preset c: sound 343, water 1482, light/radio 299792458; h = 6.62607015×10^-34 J·s; E only for light/radio; band by lookup."
  },
  "externalEvidence": {
    "reviewedAt": "2026-10-04",
    "sources": [
      {
        "name": "OpenStax — Traveling waves",
        "url": "https://openstax.org/books/university-physics-volume-1/pages/16-1-traveling-waves"
      }
    ],
    "basis": "Wavelength × frequency = propagation speed; period = 1 / frequency. The reference supports this wave relationship.",
    "limitations": "Preset propagation speeds and spectrum boundaries are implementation assumptions; actual sound speed depends on the medium and conditions. Photon energy is returned only for light/radio using Planck’s relation and is outside the cited traveling-wave section.",
    "implementationHash": "f83847ecb12bd10e146e5e28cd414740e2a289cb28f79a4671e2445419b28a78"
  },
  "contract": {
    "compute": "const speeds={sound:343,light:299792458,water:1482,radio:299792458};const c=waveType==='custom'?customSpeed:speeds[waveType];const input=solveFor==='frequency'?wavelength:frequency;if(!(c>0)||!(input>0)||!Number.isFinite(c)||!Number.isFinite(input)) return {wavelengthOut:null,frequencyOut:null,period:null,speed:null,wavelengthNm:null,photonEnergy:null,band:null,__error:'inputError'};let wl=wavelength,f=frequency;if(solveFor==='frequency')f=c/wl;else wl=c/f;const h=6.62607015e-34;const band=waveType==='light'||waveType==='radio'?(wl*1e9<10?'Gamma or X-ray':wl*1e9<380?'Ultraviolet':wl*1e9<750?'Visible light':wl*1e9<1e6?'Infrared':'Microwave or radio'):(f<20?'Infrasonic':f<20000?'Audible range':'Ultrasonic');return {wavelengthOut:wl,frequencyOut:f,period:1/f,speed:c,wavelengthNm:wl*1e9,photonEnergy:waveType==='light'||waveType==='radio'?h*f:null,band};",
    "inputs": [
      {
        "name": "solveFor",
        "type": "select",
        "default": "frequency",
        "options": [
          {
            "value": "frequency"
          },
          {
            "value": "wavelength"
          }
        ]
      },
      {
        "name": "wavelength",
        "type": "number",
        "default": 0.5,
        "min": 0,
        "max": 100000,
        "step": 0.001,
        "showWhen": {
          "solveFor": [
            "frequency"
          ]
        }
      },
      {
        "name": "frequency",
        "type": "number",
        "default": 600000000,
        "min": 0,
        "max": 100000000000000000000,
        "step": 1,
        "showWhen": {
          "solveFor": [
            "wavelength"
          ]
        }
      },
      {
        "name": "waveType",
        "type": "select",
        "default": "sound",
        "options": [
          {
            "value": "sound"
          },
          {
            "value": "light"
          },
          {
            "value": "water"
          },
          {
            "value": "radio"
          },
          {
            "value": "custom"
          }
        ]
      },
      {
        "name": "customSpeed",
        "type": "number",
        "default": 343,
        "min": 0,
        "max": 1000000000,
        "step": 1,
        "showWhen": {
          "waveType": [
            "custom"
          ]
        }
      }
    ],
    "outputs": [
      {
        "name": "frequencyOut",
        "precision": 3,
        "unit": "Hz"
      },
      {
        "name": "wavelengthOut",
        "precision": 6,
        "unit": "m"
      },
      {
        "name": "period",
        "precision": 9,
        "unit": "s"
      },
      {
        "name": "speed",
        "precision": 2,
        "unit": "m/s"
      },
      {
        "name": "wavelengthNm",
        "precision": 2,
        "unit": "nm"
      },
      {
        "name": "photonEnergy",
        "precision": 6,
        "unit": "J",
        "optional": true
      },
      {
        "name": "band",
        "precision": 0,
        "unit": "",
        "type": "text"
      }
    ],
    "interpret": null
  }
}
