{
  "id": "line-integral",
  "version": "e64fb3eda16c",
  "status": "published",
  "name": "Line Integral Calculator",
  "question": "What is the line integral along C?",
  "summary": "Finds the line integral ∫ F · dr of a vector field, or ∫ f ds of a function, along a curve r(t) from t = a to t = b.",
  "category": "math",
  "subcategory": "calculus",
  "url": "https://www.acalculator.org/math/line-integral-calculator",
  "markdown": "https://www.acalculator.org/math/line-integral-calculator.md",
  "kind": "function",
  "method": "∫ F · dr = ∫ₐᵇ F(r(t)) · r′(t) dt and ∫ f ds = ∫ₐᵇ f(r(t)) ‖r′(t)‖ dt, each derivative and integral from a computer algebra system, checked.",
  "assumptions": [
    "C runs from r(a) to r(b) as t grows; reversing C changes the sign of ∫ F · dr, not of ∫ f ds.",
    "Angles in radians. When the algebra finds no antiderivative, adaptive Simpson’s rule gives the value."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "kind": {
        "title": "Integral",
        "description": "A vector field F (work, ∫ F · dr) or a function f (∫ f ds).",
        "type": "string",
        "enum": [
          "vector",
          "scalar"
        ]
      },
      "p": {
        "title": "P (i component of F)",
        "description": "The x component of F, in x, y and z.",
        "type": "string",
        "maxLength": 150
      },
      "q": {
        "title": "Q (j component of F)",
        "description": "The y component of F.",
        "type": "string",
        "maxLength": 150
      },
      "r": {
        "title": "R (k component, optional)",
        "description": "The z component of F; empty is 0.",
        "type": "string",
        "maxLength": 150
      },
      "f": {
        "title": "f(x, y, z)",
        "description": "The function to integrate along C.",
        "type": "string",
        "maxLength": 150
      },
      "x": {
        "title": "x(t)",
        "description": "The x component of the curve.",
        "type": "string",
        "maxLength": 150
      },
      "y": {
        "title": "y(t)",
        "description": "The y component of the curve.",
        "type": "string",
        "maxLength": 150
      },
      "z": {
        "title": "z(t) (empty for a plane curve)",
        "description": "The z component of the curve.",
        "type": "string",
        "maxLength": 150
      },
      "a": {
        "title": "From t = a",
        "description": "Where the curve starts: a number or a constant such as pi.",
        "type": "string",
        "maxLength": 40
      },
      "b": {
        "title": "To t = b",
        "description": "Where the curve ends.",
        "type": "string",
        "maxLength": 40
      }
    }
  },
  "outputs": {
    "value": {
      "label": "Line integral",
      "description": "The value of the integral along C.",
      "format": "number"
    },
    "exact": {
      "label": "Exact value",
      "description": "The integral, exactly, when the algebra finds it.",
      "format": "math"
    },
    "integrand": {
      "label": "Integrand in t",
      "description": "F(r(t)) · r′(t), or f(r(t)) ‖r′(t)‖, the function integrated from a to b.",
      "format": "math"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "kind": "vector",
      "p": "y z",
      "q": "x y",
      "f": "x^2 + y^2 + z",
      "x": "t^2",
      "y": "t",
      "a": "0",
      "b": "1",
      "r": "x z",
      "z": "t^4"
    },
    "outputs": {
      "value": 0.9357142857142857,
      "exact": "131/140",
      "integrand": "2t^6 + 4t^9 + t^3"
    },
    "text": "The line integral along C from t = 0 to t = 1 is 0.9357142857."
  },
  "examples": [
    {
      "given": {
        "kind": "vector",
        "p": "y z",
        "q": "x y",
        "r": "x z",
        "x": "t^2",
        "y": "t",
        "z": "t^4",
        "a": "0",
        "b": "1"
      },
      "expect": {
        "value": 0.9357142857142857,
        "exact": "131/140"
      },
      "source": "OpenStax, Calculus Volume 3, section 6.2 Line Integrals (https://openstax.org/books/calculus-volume-3/pages/6-2-line-integrals), Example 6.23 (F = ⟨yz, xy, xz⟩, r(t) = ⟨t², t, t⁴⟩, 0 ≤ t ≤ 1)"
    },
    {
      "given": {
        "kind": "vector",
        "p": "-y",
        "q": "x",
        "x": "cos(t)",
        "y": "sin(t)",
        "a": "0",
        "b": "pi"
      },
      "expect": {
        "value": 3.141592653589793
      },
      "source": "OpenStax, Calculus Volume 3, section 6.2 Line Integrals (https://openstax.org/books/calculus-volume-3/pages/6-2-line-integrals), Example 6.18 (F = ⟨−y, x⟩ on the upper half of the unit circle)"
    },
    {
      "given": {
        "kind": "scalar",
        "f": "x^2 + y^2 + z",
        "x": "cos(t)",
        "y": "sin(t)",
        "z": "t",
        "a": "0",
        "b": "2pi"
      },
      "expect": {
        "value": 36.80122267487225
      },
      "source": "OpenStax, Calculus Volume 3, section 6.2 Line Integrals (https://openstax.org/books/calculus-volume-3/pages/6-2-line-integrals), Example 6.15 (helix): 2√2π + 2√2π²; Python 3",
      "tolerance": 1e-9
    }
  ],
  "sources": [
    "OpenStax, Calculus Volume 3, section 6.2 Line Integrals (retrieved 2026-10-03): https://openstax.org/books/calculus-volume-3/pages/6-2-line-integrals"
  ],
  "related": [
    "curl",
    "double-integral",
    "integral",
    "arc-length"
  ],
  "changelog": []
}
