# How can I plot a graph of an integral?

I want to plot the following function:

$$\int \left(\frac{\Gamma (x+1)}{2}-\frac{\Gamma (x-1)}{2}\right) \, dx$$

• what are the limits of integration – k_v Mar 28 '15 at 11:05
• @k_v I want to plot the indefinite integral of this function. – Anixx Mar 28 '15 at 11:14
• this integral may be calculated only numerically, and one of the limits of integration is requared to define the function – k_v Mar 28 '15 at 11:17
• @k_v so how can I plot it? – Anixx Mar 28 '15 at 11:28

g[x_]=Gamma[x+1]/2-Gamma[x-1]/2 // FunctionExpand


(-(1/2) + 1/2 (-1 + x) x) Gamma[-1 + x]

f[y_] := NIntegrate[g[x], {x, 2, y}]

Plot[f[x], {x, 2, 10}]


• Why NIntegrate does not work inside plot? – Anixx Mar 28 '15 at 17:25
• this works Plot[NIntegrate[g[x], {x, 2, y}], {y, 2, 10}] – k_v Mar 28 '15 at 17:31
• I have tried before asking this question, it does not. – Anixx Mar 28 '15 at 17:32
• @Anixx I does work. What Mathematica version are you running? – m0nhawk Mar 29 '15 at 11:35

You could use NDSolveValue to integrate the function:

int = NDSolveValue[
{
f'[x] == Gamma[x+1]/2-Gamma[x-1]/2,
f[2] == 0
},
f,
{x, 2, 10}
];


Visualization:

Plot[int[x], {x, 2, 10}]


It may be interesting to plot both $$f(x)$$ and $$g(x)$$ (blue and yellow curves, respectively) on a logarithmic scale:

LogPlot[{f[x],g[x]}, {x, 2, 30}, Frame -> True, Axes -> False]