{
  "schemaVersion": 1,
  "slug": "ohms-law-calculator",
  "category": "science",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "30b8a0df9cd3bbd6603d98a88be1291fc08a9a3d56fcc5640dcd2d26c95e6b98",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/ohms-law-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 = I × R; P = V × I",
    "vars": [
      [
        "V",
        "voltage, V"
      ],
      [
        "I",
        "current, A"
      ],
      [
        "R",
        "resistance, Ω"
      ],
      [
        "P",
        "power, W"
      ]
    ],
    "note": "The mode sets the unknown: I = V/R, R = V/I or V = I×R; division by zero yields 0; conductance = 1/R; power in mW = 1000×P."
  },
  "externalEvidence": {
    "reviewedAt": "2026-10-04",
    "sources": [
      {
        "name": "OpenStax University Physics — Ohm law",
        "url": "https://openstax.org/books/university-physics-volume-2/pages/9-4-ohms-law"
      }
    ],
    "basis": "V = IR; electrical power = VI; conductance = 1/R.",
    "limitations": "Ideal ohmic DC component; excludes AC phase, reactive impedance and temperature-dependent resistance.",
    "implementationHash": "30b8a0df9cd3bbd6603d98a88be1291fc08a9a3d56fcc5640dcd2d26c95e6b98",
    "domain": "home"
  },
  "contract": {
    "compute": "let V=voltage,I=current,R=resistance;if(mode==='vr'){if(R<=0)return{voltageOut:null,currentOut:null,resistanceOut:null,power:null,powerMilliwatts:null,conductance:null,__error:'inputError'};I=V/R}else if(mode==='vi'){if(I<=0)return{voltageOut:null,currentOut:null,resistanceOut:null,power:null,powerMilliwatts:null,conductance:null,__error:'inputError'};R=V/I;if(R<=0)return{voltageOut:null,currentOut:null,resistanceOut:null,power:null,powerMilliwatts:null,conductance:null,__error:'inputError'}}else{if(R<=0)return{voltageOut:null,currentOut:null,resistanceOut:null,power:null,powerMilliwatts:null,conductance:null,__error:'inputError'};V=I*R}const P=V*I;return{voltageOut:V,currentOut:I,resistanceOut:R,power:P,powerMilliwatts:P*1000,conductance:1/R}",
    "inputs": [
      {
        "name": "mode",
        "type": "select",
        "default": "vr",
        "options": [
          {
            "value": "vr"
          },
          {
            "value": "vi"
          },
          {
            "value": "ir"
          }
        ]
      },
      {
        "name": "voltage",
        "type": "number",
        "default": 12,
        "min": 0,
        "max": 1000000,
        "step": 0.01,
        "showWhen": {
          "mode": [
            "vr",
            "vi"
          ]
        }
      },
      {
        "name": "current",
        "type": "number",
        "default": 0.5,
        "min": 0,
        "max": 100000,
        "step": 0.001,
        "showWhen": {
          "mode": [
            "vi",
            "ir"
          ]
        }
      },
      {
        "name": "resistance",
        "type": "number",
        "default": 24,
        "min": 0,
        "max": 1000000000,
        "step": 0.01,
        "showWhen": {
          "mode": [
            "vr",
            "ir"
          ]
        }
      }
    ],
    "outputs": [
      {
        "name": "currentOut",
        "precision": 6,
        "unit": "A"
      },
      {
        "name": "voltageOut",
        "precision": 4,
        "unit": "V"
      },
      {
        "name": "resistanceOut",
        "precision": 4,
        "unit": "Ω"
      },
      {
        "name": "power",
        "precision": 4,
        "unit": "W"
      },
      {
        "name": "powerMilliwatts",
        "precision": 2,
        "unit": "mW"
      },
      {
        "name": "conductance",
        "precision": 8,
        "unit": "S"
      }
    ],
    "interpret": null
  }
}
