1
$\begingroup$

This question already has an answer here:

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)=\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}]
$\endgroup$

marked as duplicate by Sjoerd C. de Vries, MarcoB, dr.blochwave, Michael E2 plotting Jul 28 '15 at 23:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 3
    $\begingroup$ Would you have a specific example of $F(x)$ in mind? Could you present it in Mathematica code for people to play with? $\endgroup$ – MarcoB Jul 28 '15 at 17:24
  • 2
    $\begingroup$ Welcome to Mathematica.SE! I would use Plot and define F in the form F[x_?NumericQ] := .... See mathematica.stackexchange.com/questions/18393/…. $\endgroup$ – Michael E2 Jul 28 '15 at 17:32
  • 4
    $\begingroup$ As noted, it's hard to say anything useful if we don't see the function concerned; different integrands call for different strategies. At the lowest level, you should follow @Michael's prescription, but otherwise there is nothing to say until you edit. $\endgroup$ – J. M. will be back soon Jul 28 '15 at 17:39
  • 2
    $\begingroup$ People here generally like users to post code as Mathematica code instead of images or TeX, so they can copy-paste it. It makes it convenient for them and more likely you will get someone to help you. You may find this this meta Q&A helpful $\endgroup$ – Michael E2 Jul 28 '15 at 19:39
4
$\begingroup$

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]

Mathematica graphics

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)$.

$\endgroup$
  • $\begingroup$ Thanks. Well errors might be caused by mild singularity in one of the integrands. $\endgroup$ – BigM Jul 28 '15 at 20:46
  • $\begingroup$ @BigM You are very welcome. $\endgroup$ – MarcoB Jul 28 '15 at 20:47

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