/*
   Driver program for integrating motion of point particle.

   Exercises:
      1) Compare result to theory.
      2) Implement damping and compare to theory
      3) Implement a oscillating driving force and compare to theory

*/


// These are the standard C++ libraries with streams and mathematics
#include <iostream>
#include <cmath>
using namespace std;

// This is a header file for our own library.
#include "particle.hpp"

double harmonicforce(double x,double v,double t)
{
   const double k=10;
   return -k*x;               // Harmonic spring
}

int main()
{
   Particle P;
   P.SetPos(0.01);           // 10cm
   P.SetMass(0.02);          // 20g

   int N=1000;
   double dt=1e-3;
   for (int i=0; i<N; i++)
       {
          P.Integrate(dt, harmonicforce);
          cout << P.GetTime() << "  " << P.GetPos() << "\n";
       }
}
