How to plot a function defined by an expression containing integrals [duplicate]

This question already has an answer here:

Plotting multivariable integration

3 answers

It seems Mathematica does not like it when it is given a function defined by an integral to plot.

How would one plot a function F(x)=∫x0∫x0f(t,s)dtdsF(x)=∫x0∫x0f(t,s)dtdsF(x)=\int_0^x\int_0^xf(t,s)dtds on a given interval?

Edit

In particular I’d like to see how the graph of the following looks like:

F[x_] :=
2 x^2 ((Log[x])^2 – 3 Log [x] + 7/2) +
2 (1 – x)^2 ((Log[1 – x])^2 – 3 Log[1 – x] + 7/2) +
2 Integrate[(Log[t^2 + s^2])^2, {t, 0, x}, {s, 0, 1 – x}] +
1/2 Integrate[(Log[(1 – x)^2 + (t – s)^2])^2, {t, 0, x}, {s, 0, x}] +
1/2 Integrate [(Log[x^2 + (t – s)^2])^2, {t, 0, 1 – x}, {s, 0, 1 – x}]

=================

=================

1 Answer
1

=================

Here is a quick modification that uses numerical integration: since you are interested in plotting the function, numerical results should be just as acceptable:

Clear[F]

F[x_?NumericQ] :=
2 x^2 ((Log[x])^2 – 3 Log[x] + 7/2) + 2 (1 – x)^2 ((Log[1 – x])^2 – 3 Log[1 – x] + 7/2) +
2 NIntegrate[(Log[t^2 + s^2])^2, {t, 0, x}, {s, 0, 1 – x}] +
1/2 NIntegrate[(Log[(1 – x)^2 + (t – s)^2])^2, {t, 0, x}, {s, 0, x}] +
1/2 NIntegrate[(Log[x^2 + (t – s)^2])^2, {t, 0, 1 – x}, {s, 0, 1 – x}]

Plot[F[x], {x, 0, 1}, PlotPoints -> 10, MaxRecursion -> 2]

Please note, however, that NIntegrate complains considerably during this calculation; you will want to carefully define the domain over which you want to see the plot of F(x)F(x).

  

 

Thanks. Well errors might be caused by mild singularity in one of the integrands.
– BigM
Jul 28 ’15 at 20:46

  

 

@BigM You are very welcome.
– MarcoB
Jul 28 ’15 at 20:47