#include "AnT.hpp"

#define a parameters[0]
#define b parameters[1]
#define X currentState[0]
#define Y currentState[1]

// return value x mod y is between 0 and y
real_t mod (real_t x, real_t y)
{
    if (x > 0)
	while (x > y) 
	    x -= y;
    else
	while (x < 0) 
	    x += y;

    return x;
}

bool kaplan_yorke (const Array<real_t>&currentState,
		   const Array<real_t>& parameters,
		   Array<real_t>& rhs)
{
  
  rhs[0] = mod (a * X, 1.0) ;
  rhs[1] = - b * Y + cos (Two_Pi * X);

  return true;
}

#undef a
#undef b
#undef X
#undef Y

extern "C" 
{

void connectSystem ()
{
  MapProxy::systemFunction = kaplan_yorke;

}

}


