3
$\begingroup$
g[z_, k_] := Exp[-z*(1/(k + 1))] *(1/(k + 1))
G[z_, k_] := 1 - Exp[-z*1/(k + 1)]

h[k_, f_, n_, y_, m_] := 
 Assuming[n ∈ Integers && n > 0, 
  Integrate[G[s, f]^(1)*F[s], {s, 0, y}]]
j[k_, f_, n_, m_] = 
 Assuming[k > 0 && f > 0 && k ∈ Reals && f ∈ Reals &&
      n ∈ Integers && n > 0, 
    Integrate[g[y, k]*h[k, f, n, y, m], {y, 0, Infinity}]] 
 // FullSimplify              

If i define F[s] as s or Sqrt[s] or log[s] the above code gives me back a pretty easy solution. But if i don't specify F[s] the code has problems. I assume the code is not aware, that F[s] should be an integrable function. Can i somehow specify this information? Or do you know a smart way to integrate thuis by hand?

$\endgroup$
  • $\begingroup$ You're missing a : in the set of j, and there's an errant - before the FullSimplify, you don't seem to use the l at all, yet it's in the h definition. Perhaps it would help if you clarified how you called the function. $\endgroup$ – Feyre Dec 19 '16 at 13:31
  • $\begingroup$ Hi, i think the code should be fine without the : after the function j[...] $\endgroup$ – Paul Dec 19 '16 at 14:01
  • $\begingroup$ You can make your own custom transformation rules for Integrate[G[...]*F[s]]:>... if you know it's integrable. Mathematica won't do this automatically since it doesn't have the required information and there is no way to state this as an Assumption (that i'm aware of). $\endgroup$ – Thies Heidecke Dec 19 '16 at 14:56
3
$\begingroup$

You can use your own custom transformation rules for symbolic expressions with unevaluated integrals, if you know what you are doing. Mathematica won't do this automatically by itself and i think there is currently no way of specifying this information through Assumptions, so i actually think pattern based transformation rules are the canonical way of doing this (as basically everything in Mathematica under the hood).

As an example, let's start with something Mathematica won't integrate, like

Integrate[G[x] f[x], x]

. If we know that the indefinite integral of f[x] is F[x] we can write a rule that performs integration by parts for us, like

integrationByParts[f_, F_] := Integrate[G_*f, x] :> G*F - Integrate[D[G, x]*F, x]

And use it on our example to get

Integrate[G[x] f[x], x]
% /. integrationByParts[f[x], F[x]]
(* F[x] G[x] - Integrate[F[x] G'[x], x] *)

This works now also if G is known but f is not (except from the fact, that its integral is F).

Integrate[Sin[x] f[x], x]
% /. integrationByParts[f[x], F[x]]
(* -Integrate[Cos[x] F[x], x] + F[x] Sin[x] *)

Hope this helps to get the idea across, how you can apply the technique to your code.

$\endgroup$
  • $\begingroup$ Thank you this very close to what i am looking for. I tried to play with your code a little bit and this is where i am right now: integrationByParts[f_, F_, a_, b_] := Integrate[G_*f, {x, a, b}] :> G[b]*F[b] - G[a]*F[a] - Integrate[D[G, x]*F, {x, a, b}] Integrate[G[x] f[x], {x, a, b}] % /. integrationByParts[f[x], F[x], a, b] I would like to not only have the antiderivative of the indeterminate integral, but of the definite one. $\endgroup$ – Paul Dec 19 '16 at 16:14
  • $\begingroup$ Any ideas how i can include the bounds of integration? $\endgroup$ – Paul Dec 21 '16 at 12:53

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.