CODE:

So as you see most of my problem is in the comments, if you know what the cause of the problem is, let me know, if there are any parts that aren't clear, again let me know.Code:`#define Pi 3.14159265 // PI equivalent`

#define DIF 0.001 //differencial size

double IntegralCharge(double Time);

int main()

{

IntegralCharge(0.3164);

return 0;

}

double IntegralCharge(double Time)

{

double Q1=0.0, Q2=0.0, Q=0.0, mid=0.0;

double temp=0.0;

for ( temp = 0.0 ; temp < Time ; temp += DIF); //this is the "integration" part

{ //it's just some stupid equation for

Q1 = (10 * sin(100*Pi*temp)); //charge in electrodynamics

Q2 = (10 * sin(100*Pi*(temp+DIF))); //but doesn't even matter.

mid = ((Q1+Q2) / 2); //The final SUM ( Q ) is completely

Q += (mid * DIF); //wrong, when I check the result

} //in analytic integration. Any idea?

/*

for (temp = 0.0 ; temp < 23 ; temp += DIF) //this is just some stupid easy test

{ // equation f(x)=x to see if the method

Q1 = temp; // is at least somewhat correct, and it is

Q2 = temp + DIF; // as long as DIF isn't "too" big

mid = ((Q1 + Q2) / 2); // I'm guessing that in most cases

Q += (mid * DIF); // the problem is that the computer

} // makes bigger and bigger mistake in

*/ //calculations as the numbers grow larger

printf("%lf\n",Q); //just a guess thow..

}

Thanks