Calca

July 28, 2013

A cool Mac/iOS app called Calca came out this week. The basic idea is that you can mix mathematical expressions with Markdown-like text. The Mac version was an instant-buy for me. I was buying some LEDs for the layout this week and the seller said that you could find the required resistance for compensating for LED voltage vs supply voltage. So I made a Calca document:

# Parameter units: volts, volts, milliamps
ohmsForSupplyAndLedVolts(supply v, led v, led ma) =
    (supply v - led v) / (led ma / 1000)

supply volts = 18

ohmsForSupplyAndLedVolts(supply volts, 1.8, 20) => 810

Calca fills in the result after whenever I enter =>, so to run a 1.8V LED on a 20V power supply I need at least an 810Ω resistor (probably 1KΩ). It was fun creating this document, but sites like ledcalc.com are probably a bit more useful (this one shows the resistor colors).

Another example, pretty trivial but handy none-the-less:

mm per inch = 25.4

scale ratio = 1/48 # O scale, 1:48

scale_mm_in_inches(mm) =
  (mm / scale ratio) / mm per inch
  
scale_mm_in_inches(2) => 3.7795

For this one I used a handy Calca feature where you type in a string, such as mm per inch, and append = ?. Calca will then ask Google for the result. So in this case I typed in:

mm per inch = ?

And Calca turns that into:

mm per inch = 24.5  # googled

A very handy app for your toolbox. It’s still a little rough around the edges but I imagine that will improve. Another handy app in this space is Soulver, which is nice but much more like a spreadsheet. To me Soulver feels like it has a bit of a learning curve, where Calca feels much more natural, like living math expressions written on a page.