Work Calculator (Variable Force)
- Free
- No sign-up
- Works on phones
- Shows the working
This work calculator finds the work done by a force that changes with position. Enter the force \( F(x) \) in newtons and the start and end positions in meters, and it evaluates \( W = \int_a^b F(x)\,dx \), giving the answer in joules.
It’s the tool for the “work” section of Calculus II and intro physics: stretching and compressing springs with Hooke’s law, winding up chains and cables, or any force given as a formula. It’s free and needs no sign-up.
How to use the work calculator
- Type the force as a function of position in F(x). Use
^for powers (5x^2), plussqrt(),sin(),ln(),e^(x)andpias needed. Implicit multiplication works, so250xand5(10 - x)are fine. - Enter the starting position in From a and the ending position in To b, both in meters. Fractions and constants such as
1/2are accepted. - Press Compute work. The result is \( W \) in joules, found by numerical integration.
The calculator assumes newtons and meters. If your problem uses centimeters, convert first (12 cm is 0.12 m), or the answer won’t be in joules.
Formula
For a constant force, work is force times distance. When the force varies, split the path into small pieces of width \( \Delta x \), treat the force as constant on each, and add up \( F(x_i)\,\Delta x \). That’s a Riemann sum, and its limit is the integral:
$$W = \int_a^b F(x)\,dx$$
For springs, Hooke’s law says the force needed to hold a spring \( x \) meters beyond its natural length is
$$F(x) = kx$$
where \( k \) is the spring constant in N/m. Integrating gives the spring work formula:
$$W = \int_a^b kx\,dx = \tfrac{k}{2}\left(b^2 - a^2\right)$$
Worked example: a spring
A force of 30 N holds a spring stretched 0.12 m beyond its natural length. How much work does it take to stretch it from 0.1 m to 0.3 m beyond natural length?
Find \( k \). From \( 30 = k(0.12) \), \( k = 250 \) N/m, so \( F(x) = 250x \).
Integrate. An antiderivative of \( 250x \) is \( 125x^2 \) (by the power rule in reverse), so by the Fundamental Theorem of Calculus:
$$W = 125(0.3)^2 - 125(0.1)^2 = 10\ \text{J}$$
That’s the calculator’s prefilled input above. Notice that stretching the same spring from 0 to 0.1 m takes only 1.25 J: the farther it’s stretched, the harder each extra centimeter becomes.
Worked example: lifting a chain
A 10 m chain weighing 5 N/m hangs from the top of a building. How much work does it take to pull the whole chain up?
After \( x \) meters have been pulled up, \( 10 - x \) meters are still hanging, so the force needed is \( F(x) = 5(10 - x) \) N. Integrate from 0 to 10:
$$W = \int_0^{10} 5(10 - x)\,dx = \Big[50x - 2.5x^2\Big]_0^{10} = 250\ \text{J}$$
Enter 5(10 - x) with limits 0 and 10 to check. The answer also makes sense physically: the chain’s total weight is 50 N and its center of mass rises 5 m.
Setting up F(x): common mistakes
- Measuring from the wrong zero. In Hooke’s law, \( x \) is the stretch beyond natural length, not the spring’s total length. If a spring’s natural length is 20 cm and it’s stretched to 30 cm, that’s \( x = 0.1 \) m.
- Mixing units. Stretching from 10 to 30 in centimeters with \( k = 250 \) N/m gives 100,000, which is meaningless. Convert to meters first.
- Swapping the limits. Integrating from the end to the start flips the sign of \( W \).
- Pumping-tank problems. For pumping liquid out of a tank, the work formula is an integral of weight per slice times lift distance. Once you’ve written that integrand as a function of one variable, you can enter it here as \( F(x) \).
Related guides
- Fundamental Theorem of Calculus
- Riemann Sums: Left, Right, Midpoint and Simpson’s Rule
- Power Rule for Derivatives
- Average Value of a Function
Further reading
- Work (Paul’s Online Math Notes) — springs, cables and pumping problems set up as integrals.
- Computing Definite Integrals (Paul’s Online Math Notes) — evaluating the work integral by hand.
FAQ
How do you calculate work done by a spring?
Find \( k \) from the given force and stretch using \( F = kx \), then integrate \( kx \) between the two stretch distances. The result is \( \frac{k}{2}(b^2 - a^2) \) joules.
Why is work an integral?
Work is force times distance only when the force is constant. When the force changes along the path, you add up force times tiny distances, and that sum becomes the integral \( \int_a^b F(x)\,dx \).
What units does the work calculator use?
It assumes \( F \) in newtons and \( x \) in meters, so \( W \) comes out in joules (newton-meters). With pounds and feet, the same number is in foot-pounds.
Does it show the antiderivative?
No. It evaluates the integral numerically and shows the value of \( W \). The worked examples above show how to get the same number by hand, and the integral calculator shows the antiderivative with steps.
