5-16
#!/usr/bin/ruby
def f(n)
if n > 0
n*n-n
else
n*n+n
end
end
for i in -5..5
print i, ", ", f(i), "\n"
end
5-23
#!/usr/bin/ruby
include Math
theta = PI/9
result = exp(theta)/2-exp(-theta)/2
print "sinh 20°= ", result, "\n"