It's very helpfull to use antiderivative of a given function in the form Derivative[-1][fun][t]
!
Here my example with a simple piecewise function:
fun = Which[0 <= t <= 1, Min[1, 2 (# (1 - #))/(1/2)^2], True, 0] &
Plot[fun[t], {t, 0, 1}]
The antiderivative evaluates as expected
Plot[(Derivative[-1][Function[t, fun[t]]][t]), {t, 0, 1}, Evaluated -> True]
But if I try calculate the antiderivative inside a subroutine I get strange results:
test =.
test[fu_] :=Plot[(-Derivative[-1][Function[t, fu]][t]), {t, 0, 1},
Evaluated -> True]
test[fun[t]]
My question: What might be the reason for the obviously wrong result? Is there a simple workaround?
Thanks