DGS Studio

Line Integrals

Line Integrals

Scalar integrals use ds. Vector integrals use F·dr and keep the path orientation.

Solve Equation evaluates line_integral(x+y,(t,t),t,0,1) as a scalar line integral. On r(t) = (t, t) the field is 2t and the speed is sqrt(2), so the integrand is 2t*sqrt(2). From 0 to 1 the exact value is sqrt(2). The same card also evaluates line_integral((y,x),(t,t),t,0,1), which is F·dr and equals 1, and line_integral((-y,x),(cos(t),sin(t)),t,0,2*pi), the circulation 2*pi.

A parenthesized first argument is the vector field. A scalar first argument uses ds. The steps show r'(t) and either the speed or the dot product before the boxed value. Reversing the bounds changes only the vector integral. A path with derivative zero, a zero-length interval, or a singularity such as 1/x on [-1, 1] is rejected. When no exact antiderivative is found, a numerical value is accepted only inside the quadrature tolerance.

Equation

line_integral(x+y,(t,t),t,0,1)

Graph preview

Graph preview of line_integral(x+y,(t,t),t,0,1)
A static sample of this expression. The studio draws the full interactive result.

How a line integral is formed

A scalar line integral adds f times arc length along a path. If the path is r(t), the element is ds = ||r'(t)|| dt, and the integral runs from the lower parameter to the upper one after those bounds are ordered. Reversing the bounds does not change the value, because speed is positive. A vector line integral instead adds F(r(t)) · r'(t) dt. That dot product keeps the direction, so traversing the path backward changes the sign. The same line_integral command chooses the scalar form when the first argument is a scalar and the vector form when the first argument is a tuple (P, Q) or (P, Q, R).

The path may be written as (x(t), y(t)) or (x(t), y(t), z(t)). The older flat form, with each component as its own argument, still uses the same calculation. An exact antiderivative is preferred. When symbolic integration does not finish, one adaptive quadrature is accepted only if its estimated error is small, and the steps say the value is numerical. A divergent integral, a singularity on the interval, a zero-length parameter interval, or a path whose derivative is identically zero is reported as an error rather than as a number. The path is drawn with direction arrows. A vector integral can also show the field.

Reading the input

Other versions of this example

These stay on this page so each version keeps the same explanation. Choose Try example to run a version in its Studio workflow, or copy it into the editable field below.

Scalar segment

Expected value sqrt(2).

line_integral(x+y,(t,t),t,0,1)

Vector segment

Expected value 1.

line_integral((y,x),(t,t),t,0,1)

Unit circle

Expected value 2*pi.

line_integral((-y,x),(cos(t),sin(t)),t,0,2*pi)

Try a change

Solve Equation distinguishes a scalar line integral from F·dr, shows the path derivative, the speed or the dot product, and the exact value. A numerical fallback is labeled as an approximation. A singular, divergent, or degenerate path is an error.

Edit and generate

Solve Equation opens the studio homepage and runs this field. Open in DGS Studio loads the same text and waits for you to generate it. The equation is sent once, as a query parameter.

Related examples