Skip to content

Instantly share code, notes, and snippets.

@spellancer
Created October 8, 2012 16:56
Show Gist options
  • Save spellancer/3853574 to your computer and use it in GitHub Desktop.
Save spellancer/3853574 to your computer and use it in GitHub Desktop.
#encoding: utf-8
include Math
r = 5
a = 0.123
b = 1.951
e = 0.00001
i = 0
x = (a + b) / 2
while ((cos(2*x) - cos(4*x)).abs) > e
if (cos(2*x) - cos(4*x)) > 0
a = x
else
b = x
end
x = (a + b) / 2
i+=1
end
f = 25 * (sin(2*x) - sin(2*x)*cos(2*x))
puts "Угол: #{x}"
puts "Площадь: #{f}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment