Dear Friends,
I tried hard to complete this code but as this is just 1 week I have started programming I can not complete the code below. Would you please help me?
I have the equation acceleration (dx^2/dt^2=-10t) and I want to calculate the acceleration, velocity and position in a table by numerical method mentioned below from t=0 till t=1.
f(x+1)=dt/2*(f'(x+1)-f'(X))-f(x)
I decreased the size of my code. I want to progress step by step. Would you please guide me about my code below? I want to get acc=-10*t values between t=0 and t=1 with step size 0.001
#include <iostream>
#include <cmath>
using namespace std;
#define dt 0.001 /* time steps*/
#define time 1 /* end time */
//--------------------------------------------------------------------------
// to calculate d2x/dt2=acceleration=-10*t
void a(double acc[], int t){
acc[t]=-10*t;
}
//--------------------------------------------------------------------------
// main program
int main(){