Break a curved path into straight sections and add the work.
The red ball marks the start of the selected section.
The path is fixed. The force shown is the force whose work we calculate; it need not be the net force producing this motion. Playback steps through sample positions, rather than simulating the ball's motion in time.
Divide the smooth curve into sections of equal arc length. Join their endpoints with straight lines. On each straight section, use the force at its start and calculate its dot product with the displacement. The total is the sum over all sections.
For friction, the magnitude is 2 N. Its direction opposes the tangent on the smooth path and opposes each straight displacement in the approximation. Thus its work is minus 2 N times the corresponding path length.
The constant forces are 2 N rightwards or 2 N downwards. The changing force circulates anticlockwise about (4 m, 2.5 m): , where . It changes both size and direction with position.
The smooth-path reference is calculated by numerical integration at high resolution. The straight-section sum is calculated separately. For a constant force the sum equals the reference for every subdivision, including zero work around a closed path. The changing force can do nonzero work around a closed path.
Click a section on the right or use the section slider to inspect its two vectors and its contribution. Increasing the number of sections makes the polygon follow the curve more closely. All totals cover the whole path, irrespective of the selected section.