Skip to content

Instantly share code, notes, and snippets.

@mattly
Last active August 29, 2015 14:22
Show Gist options
  • Select an option

  • Save mattly/551589d4daea0d959992 to your computer and use it in GitHub Desktop.

Select an option

Save mattly/551589d4daea0d959992 to your computer and use it in GitHub Desktop.
Federal Tax in Calca
brackets = [ 13,150, 50,200, 129,601, 209,851, 411,501, 439,000, 999,999,999,999]
rates = [ 10%, 15%, 25%, 28%, 33%, 35%, 39.6%]
tax (amt, level) =
let this = brackets[level] in
let prev = brackets[level-1] in
let rate = rates[level] in
if this <= amt then (this - prev) * rate
else if prev < amt then (amt - prev) * rate
else 0
mytax(income) =
sum(tax(income, l), 0..6)
effective tax rate (i) =
mytax(i) / i * 100
plot(mytax(income), income, 10,000..250,000)
plot(effective tax rate, 10,000..250,000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment