For this assignment the functions you arc to write arc as follows: double radian
ID: 3678422 • Letter: F
Question
For this assignment the functions you arc to write arc as follows: double radians(double degrees); double xCosXy SinY(double x, double y); int linspace(double data[ ], double dataMin, double delta, int nPoints); Fills data[ ] with nPoints values, starting at dataMin and increasing in steps of delta. Returns the number of array spots filled, (normally nPoints), or -1 in the case of errors (bad input.) int linspacc(double data[ ], double dataMin, double delta, double dataMax); Fills data[ ] with values, ranging from dataMin to dataMax in steps of delta. Returns the number of array spots filled, (calculated), or -1 in the case of errors (bad input.) double distance And Vector(double x 1, double y 1, double x2, double y2, double & deltaX, double &deltaY;); Returns the distance between (x 1, y 1) and (x2, y2). Stores in (deltaX, dcltaY) the vector pointing from (x 1, y 1) to (x2, y2). int xCosXySinY(int nRows, int nCols, double x[ ], double y[ ], double result[ ][MAXCOLS]); Fills in result[ ][ ] by calling double xCosXySinY(double x, double y); The array passed to result must have MAXCOLS columns. nRows and nCols should be the number of rows and columns of result to fill. They should be checked for validity. x[ ] holds the X values to be used for each row. y[ ] holds the Y values to be used for each column.Explanation / Answer
double radians(double degrees)
{
double radians = degrees*M_PI/180;
return radians;
}
double xCosXySinY(double x, double y)
{
double xCosXySinY = x*cos(radians(x))*y*cos(radians(Y));
return xCosXySinY;
}
int linspace(double data[], double dataMin, double delta, int nPoints)
{
do{ double i =dataMin;
data [0] = dataMin;
count =1;
}
while(nPoints>0)
{
i= i+delta;
data[count]=i;
npoint --;
}
if(count == 1)
{
return nPoints;
}
else
{
return -1;
}
}
int linspace(double data[], double dataMin, double delta, double dataMax)
{
do{
count =1;
i =dataMin;
data[0] =dataMin;
}
while(i<dataMax)
{
i=i+delta;
data[count]=i;
count++;
}
if(i==dataMax)
{
retrun count;
}
else
{
return -1;
}
}
double distanceAndVector(double x1, double y1, double x2, double y2, double &deltaX, double &deltaY)
{
{
double distance;
distance = sqrt((deltaX->x1 - deltaX->x2) * (deltaX->x1 - deltaX->x2) + (deltaY->y1-deltaY->y2) *(deltaY->y1-delta->y2));
return distance;
}
}
int xCosXySinY(int nRows, nCols, double x[], double y[],double result[][MAXCOLS])
{
if(nCols<0|| nRows<0) //check for validity
{
printf("matrix not possible");
}
else
{
for(i =0; i<nRows; i++)
{
for(j=0;j<nCols; j++)
{
for(k=0; k<MAXCOLS; k++)
result [][k] = xCosXySinY(x[i][j], y[i][j]);
}
}
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.