Calculating Work in Python: Hooke’s Law
Author: David Manuel
In this video, we use Python to calculate the amount of work done in moving a spring using Hooke's Law. First, we solve for the spring constant k using the given information. Once we know k, we can setup the integral representing the work done and evaluate it.
Transcript 23
Transcript 23
Exercises
Python Code:
#10 Joules of work to move a spring from a natural length of 10cm to a length of 15cm
#How much work would it take to move the spring from a length of 15cm to a length of 20cm?
from sympy import *
x,k=symbols('x k') F=k*x Work1=integrate(F,(x,0,0.05)) ksol=solve(Work1-10,k)[0] print(ksol) Fnew=F.subs(k,ksol) print(Fnew) Work=integrate(Fnew,(x,.05,.10)) print('The work required is',Work,'J')
Open Python Notebook File
Related Videos (176)
MATH 152: Work Exercise 13
Calculating the work done pulling part of a rope to the top of a building
MATH 152: Work Exercise 8
Calculating the work done pumping water out of a tank shaped like a trough
MATH 152: Work Exercise 9
Calculating the work done pumping water out of a tank shaped like a trough
Work Done Pulling Up a Rope
How to calculate the work done in lifting up a rope possibly with a mass
