//Alexander Sage
//Hw7
//Date: 11/30/11
//Purpose: to assign the arrays y and rhs proper values to be used in the main function.

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

void probRHS(double t, double y[], double rhs[])      //referencing needed arrays
{
double x; double y0; double vx; double vy; // initializing new variables for rhs calculation
double grav = 39.47; double msun = 1.0;  // initialize constants 

x = y[0];     //setting values of the array y to 
y0 = y[1];    //the respective x, y, vx, vy it represents
vx = y[2];    // where x and y are coordinate points and 
vy = y[3];    // vx and vy are velocities of x and y
rhs[0] = vx;
rhs[1] = vy;
rhs[2] = -grav*msun*x/pow((pow(x,2) + pow(y0,2)),1.5);
rhs[3] = -grav*msun*y0/pow((pow(x,2) + pow(y0,2)),1.5);
}