I have a piecewise linear function (spline) describing a progressive income tax schedule, with higher marginal rates kicking in for higher and higher incomes.

I want to understand the implications of a rule that some tax exempt income might still raise your average rate on the taxable part. Basically, with x being taxable income and y being exempt income, your taxes will be f(x+y)/(x+y)*x, where f is the nonlinear scheme that would apply to income without exemptions. I can define f as a piecewise linear function, see above.

To calculate marginal tax rates on taxable and exempt income, I’d simply need the partial derivates of this expression, with the particular function f plugged in, and this I can plot against the two variables. Or plot against one and use the other as a parameter for Manipulate.

The derivative looks OK in Mathematica, though it is a bit hard to check with so many cases.

However, I get empty plots, which of course are pointless to manipulate. Where does this go wrong?


Think of Tax this way:

Tax [z_]:= Piecewise[{
                        {0,0    <=z< 11265},
                        {0+ 0.0856(z-11265),11265<=z}

1 Answer 1


Use Evaluate in the first argument of Plot:

Manipulate[Plot[Evaluate@D[Tax[x + y]/(x + y)*x, y], {y, 0, 200000}],
   {x, 0, 200000}]

enter image description here

  • $\begingroup$ Does it work for you? I still get an empty plot, even if I move x around. $\endgroup$
    – László
    Jul 2, 2019 at 19:55
  • 1
    $\begingroup$ @László, it works in both version 12 (Wolfram Cloud) and version 9 (Windows 19). I posted a picture. (Perrhaps using ClearAll[Tax] before you define Tax may help to avoid possible previous assignments getting in the way). $\endgroup$
    – kglr
    Jul 2, 2019 at 20:07
  • $\begingroup$ Great, it did the trick, thanks! $\endgroup$
    – László
    Jul 2, 2019 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.