Last active
August 29, 2015 14:22
-
-
Save mattly/551589d4daea0d959992 to your computer and use it in GitHub Desktop.
Federal Tax in Calca
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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