1
$\begingroup$

I am trying to solve the integral using the following Mathematica code.

f1 = (t[m + 1] - t)^(\[Alpha] - 1)*(t - t[m - 1])*(t - t[m - 2]);

Integrate[f1, {t, t[k], t[k + 1]}]

But it doesn't work. Can you guys please help me solve it using Mathematica? Thanks in advance :-)

$\endgroup$
1
  • 1
    $\begingroup$ Perhaps Integrate[f1,{t,t[k],t[k+1]},GenerateConditions->False] does what you want. $\endgroup$
    – user293787
    Commented Nov 6, 2022 at 16:57

2 Answers 2

1
$\begingroup$

Another way is as follows.

ClearAll["Global`*"]; 
f1[s_] := (t[m + 1] - s)^(\[Alpha] - 1) (s - t[m - 1]) (s - t[m - 2]);
Integrate[f1[s], {s, t[k], t[k + 1]}, Assumptions -> {\[Alpha], t[k], t[k + 1], t[m - 1], t[m - 2], 
t[m + 1]} \[Element] Reals]

ConditionalExpression[1/(\[Alpha] (1 + \[Alpha]) (2 + \[Alpha])) (I + Cot[\[Pi] \[Alpha]]) Sin[\[Pi] \[Alpha]] ((1 + \[Alpha]) (2 + \ \[Alpha]) t[-2 + m] t[-1 + m] ((t[k] - t[1 + m])^\[Alpha] - (t[1 + k] - t[1 + m])^\[Alpha]) + \[Alpha] (1 + \[Alpha]) t[ k]^2 (t[k] - t[1 + m])^\[Alpha] - \[Alpha] (1 + \[Alpha]) t[ 1 + k]^2 (t[1 + k] - t[1 + m])^\[Alpha] + 2 \[Alpha] t[k] (t[k] - t[1 + m])^\[Alpha] t[1 + m] - 2 \[Alpha] t[1 + k] (t[1 + k] - t[1 + m])^\[Alpha] t[1 + m] + 2 ((t[k] - t[1 + m])^\[Alpha] - (t[1 + k] - t[1 + m])^\[Alpha]) t[1 + m]^2 - (2 + \[Alpha]) t[-2 + m] (\[Alpha] t[k] (t[k] - t[1 + m])^\[Alpha] - \[Alpha] t[1 + k] (t[1 + k] - t[1 + m])^\[Alpha] + ((t[k] - t[1 + m])^\[Alpha] - (t[1 + k] - t[1 + m])^\[Alpha]) t[ 1 + m]) - (2 + \[Alpha]) t[-1 + m] (\[Alpha] t[k] (t[k] - t[1 + m])^\[Alpha] - \[Alpha] t[ 1 + k] (t[1 + k] - t[1 + m])^\[Alpha] + ((t[k] - t[1 + m])^\[Alpha] - (t[1 + k] - t[1 + m])^\[Alpha]) t[ 1 + m])), t[k] > 0 && t[1 + k] > t[k] && 0 < t[1 + m] < t[k]]

$\endgroup$
3
$\begingroup$

As mentioned in comment, it is GenerateConditions which sometimes makes it slow. To verify this, do the definite integration by hand and verify it is same as when turning this condition checking off. Sometimes I think the default for GenerateConditions should have been False and the user should set it to True if they want. Now it is the other way around.

Clear["Global`*"]

f1 = (t[m + 1] - t)^(α - 1)*(t - t[m - 1])*(t - t[m - 2]);
sol = Integrate[f1, t];
upper = Limit[sol, t -> t[k + 1]];
lower = Limit[sol, t -> t[k]];
sol1 = (upper - lower)

sol2 = Integrate[f1, {t, t[k], t[k + 1]}, GenerateConditions -> False]

Simplify[sol1 - sol2]

(* 0 *)

The solution is

Mathematica graphics

$\endgroup$

Your Answer

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