Skip to content

Instantly share code, notes, and snippets.

@jadar
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jadar/f706c3ef42ccb9ce577e to your computer and use it in GitHub Desktop.
Save jadar/f706c3ef42ccb9ce577e to your computer and use it in GitHub Desktop.
Law of Cosines
var a = 8;
var b = 9;
var c = 90;
c = c * Math.PI/180;
var a_square = Math.pow(a, 2);
var b_square = Math.pow(b, 2);
//console.log(Math.cos(Math.PI));
var answer = Math.sqrt((a_square + b_square) - (2*a*b*Math.cos(c)));
console.log(answer);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment