3
$\begingroup$

Suppose, I wanted to calculate some definite (or indefinite) integral in Mathematica: $$\int_a^bf(x)\mathrm{d}x$$ Normally, this can be done using

Integrate[f[x], {x, a, b}]

which will give the result.

However, there are cases where no antiderivative exists for $f$. What I want to do is to "trick" Mathematica into thinking, that there exists some antiderivative $F(x)$ of $f$, even if this function would normally not be expressible in terms of "elementary functions".
That is, I want the above code to return

F[b] - F[a]

instead of returning the integral unevaluated. This may then be further simplified when I provide some expression for $F$, for example some approximation for the antiderivative.

$\endgroup$
8
$\begingroup$

Use TagSetDelayed

Clear["Global`*"]

f /: Integrate[f[x_], {x_, a_, b_}] := F[b] - F[a]

Integrate[f[y], {y, lb, ub}]

(* -F[lb] + F[ub] *)
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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