This display shows a block of material constrained to move horizontally in one dimension as though it were on a frictionless rail. The mass of the block is large enough that the mass of the spring to which it is attached may be neglected. You may use the cursor and mouse button to drag the block to any location within the limits of the spring. When you release the mouse button, the block remains where you placed it. A click on the Action button releases the block, allowing the spring to move it. The work done by the spring on the block is plotted as the block moves.
Notice that the graph of work done by the spring shows a maximum at x=0 and decrease as x approaches the extremes of its value. The significance of the work done by the spring decreasing during the second half cycle of the motion is that during that half cycle, the block is doing work on the spring, or the spring is doing negative work if that makes more sense to you. When you halt the motion with the Cut button, the current value of position, x, work, w and kinetic energy, ke, are printed on the screen. The printed values of work and kinetic energy are calulated independently so the displayed values may disagree by the amount of rounding off errors.