Profile Picture

Hi, I'm Bobby Matson.

I'm a NYC-based software engineer and entrepreneur. I love working on new business models and experimenting with funky ideas. Shoot me an email if you'd like to collaborate on one!

Bobby's Blog

Math in Ruby

Numerical Coercion

  • Finding a common numeric type in Ruby


  • Wrap a magnitude and a direction (velocity, acceleration)
  • Often mapped as arrows. ========>
  • Source
v =,4)
2 * v
v * 2*2, 4*2)


  • Affects the magnitude by making them longer or shorter (population, battery life, finite values)

Dimensional Analysis

  • The analysis of the dimensions of measurements (60 mph, 2.7GHz)
  • Conversion of complex units to a simple one
  • Unitary library does the conversion for you
speed = 5 * :mi/:hr

Ruby needs to be better at Math

Why can’t we do things like:

4.dollars == 6.5.euros
g = 2 * Math::tan
f = Math::sin * Math::cos