#!/usr/bin/perl
#
# Compute the potential energy of a spring and its associted force
#
# MWR 3/4/2021

use POSIX;
$debug = 1;

$mypi = 3.14159265;


$start_x = 0.0;
$end_x = 10.0;
$d_x = 0.05;
for ($x = $start_x; $x <= $end_x; $x += $d_x) {

  $pe = 126.0*$x*$x;
  $force = -252.0*$x;

  printf "x %8.3f  force %8.3f  pe %8.3f \n", $x, $force, $pe;

}


exit 0;
