/*

  Class to define basic properties of Dual numbers. The dual number w is defined as  w = x + ey
  where x,y are reals (represented as doubles), and e is an infinitesimal number with the properties e^2=0 and e!=0 
  Hence we can think of e as somewhat similar to the imaginary number i with i^2 = -1.
  
*/

#include <cmath>
#include <iostream>
using namespace std;

// This is the header defining DualNumber class.
#include "DualNumber.hpp"

int main()
{
   DualNumber w(1.0,1.0);
   DualNumber q(2.0,3.0);
   double     a=20;
   
   cout << "w=" << w << "\n";
   cout << "q=" << q << "\n";
   cout << "a=" << a << "\n";
   
   cout << "Basic algebra\n";
   cout << "w+q=" << w+q << "\n";   
   cout << "w-q=" << w-q << "\n";   
   cout << "w*q=" << w*q << "\n";   
   cout << "w/q=" << w/q << "\n";   

   cout << "\nMixed algebra\n";
   cout << "w+a=" << w+a << "\n";   
   cout << "a+w=" << a+w << "\n";   
   cout << "w-a=" << w-a << "\n";   
   cout << "a-w=" << a-w << "\n";   
   cout << "w*a=" << w*a << "\n";   
   cout << "a*w=" << a*w << "\n";   
   cout << "w/a=" << w/a << "\n";   
   cout << "a/w=" << a/w << "\n";   

   return 0;
}




