0

for the XsineX function I have to calculate xsinx for each value in x then store in result. I need to call on the sin function to do calculations. I tried but I know its completely wrong, any help please??

```
#include <iostream>
#include <cmath>
using namespace std;
// uses Taylor series about x= 0 to find sine also finds limit//
double sine( double x, double tolerance, int & limit ) {
double term = x;
double lastTerm = 0.0;
int i = 1;
do {
term = -(lastTerm * x * x) / ((2 * i) * (2 * i + 1));
lastTerm = term;
i += 1;
}while(fabs(term - lastTerm) > tolerance);
limit = i;
return term;
}
int fillVector( double first, double last, double increment, int size, double data[ ] ) {
int i;
double min, max;
data[0]= min;
for( i = 1; i<size &&data[i-1]<max; i++){
data[i]= data[i-1]+increment;
return i;
}
int xSineX( double x[ ], double result[ ], int size, double tolerance, int limit )
{
int count;
count= (max-min)/increment +1;
for (i=1; i<count; i++){
x [0]= min + increment*i;
results[0]= x * sin (x);
```

*Edited 7 Years Ago by jhanthem*: n/a