Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

double dot_product (const doubleu[],const double v[],const int SIZE); The functi

ID: 3613228 • Letter: D

Question

double dot_product (const doubleu[],const double v[],const int SIZE);

The functionangle()will call the functiondot_product().The definition of this function will be likethis:

double angle (const double u[], constdouble v[], const int SIZE ){

double normu, normv, dotuv;

dotuv = dot_product ( u, v, SIZE );

normu = sqrt ( dot_product(u, u, SIZE));

normv = sqrt ( dot_product(v, v, SIZE));

doubleangle;

angle = acos ( dotuv / (normu * normv));

returnangle;

}

The math functionacoscomputes cos-1.

You need to implementthe function dot_product().

double ( const double u[], const doublev[], const int SIZE ){

...

}

Explanation / Answer

double dot_product(const double u[], const double v[], constint SIZE) {    double result=0.0f;    for (int i=0;i<SIZE;i++)    {        result+=u[i]*v[i];    }    return result; }