I need to compute the law of cosines for the given values as shown above. I tested each one of the values to see if the correct computations are made for the parts of the equation. I need to find the cosine for the given angle "a" and in the equation, but the value is not computed. How can I solve this.
double b = 13; //side
double c = 15; // other side
double a =15; // angle
double cosines = Math.pow(b, 2) + Math.pow(c, 2) + 2*(b)*(c) *Math.cos(Math.toRadians(a));
double test = 2*(b)*(c);
double cosiness = Math.sqrt(cosines);
System.out.println(cosiness);
System.out.println(test);
double test2 = Math.cos(Math.toRadians(a));
System.out.println(a);
double test3 = Math.pow(b, 2);
System.out.println(test3);
System.out.println(Math.pow(c, 2));
This outputs:
27.761683526989795
390.0
15.0
169.0
225.0
How do I correct this?