So I'm trying to practice using Ruby to solve trig functions and I'm having some difficulty getting the Math library to work.
The trig function is: y = (x^3 sqrt(2x^2)) / (sin(x+5))
where x = 51, and the answer needs to be in degrees. The problem is supposed to be solved in Matlab, which I have no experience with, but I managed to hack together the following output for the function: 1.1540e + 07
, and I want to verify that what I'm doing in Matlab is correct, so I want to use Ruby to make sure the answer is what I'm supposed to be getting.
The Ruby code I'm trying to use to solve this function is: puts ((51 ** 3)Math.sqrt(2(51 ** 2)) / (Math::sin(56.degrees)))
however when running the code I get the following errors:
/Users/sam/Desktop/jasons_shit.rb:1: syntax error, unexpected tCONSTANT, expecting ')'
puts ((51 ** 3)Math.sqrt(2(51 ** 2)) / (Math::sin(56.degrees)))
^
/Users/sam/Desktop/jasons_shit.rb:1: syntax error, unexpected '(', expecting ')'
puts ((51 ** 3)Math.sqrt(2(51 ** 2)) / (Math::sin(56.degrees)))
^
/Users/sam/Desktop/jasons_shit.rb:1: syntax error, unexpected ')', expecting end-of-input
puts ((51 ** 3)Math.sqrt(2(51 ** 2)) / (Math::sin(56.degrees)))
How can I go about evaluating this function and resolving the errors?