0
$\begingroup$

I try to make the plot of an integral function in the trial version of Mathematica. I write the following code:

r[x_, y_, s_] := (Sqrt[4/(1 - x) + y*x - 4/(1 - s) - y*s]);
Ip[x_, y_] := NIntegrate[1/(r[x, y, s]), {s, 0, y}];
Plot3D[Ip[x, y], {x, 0, 1}, {y, -3, 4}];

But it appears this kind of error:

NIntegrate::inumr: The integrand 1/r[0.0000715,-2.9995,s] has evaluated to non-numerical values for all sampling points in the region with boundaries {{0,-2.9995}}

and similar ones.

So I would like to plot this integral function with x,y parameters in order to have a graph made by {Ip[x,y], x, y}, but I can't manage it. Could someone help me?

$\endgroup$

closed as off-topic by Henrik Schumacher, Johu, m_goldberg, José Antonio Díaz Navas, J. M. is away Oct 21 '18 at 10:38

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Henrik Schumacher, Johu, m_goldberg, José Antonio Díaz Navas, J. M. is away
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ It should be Ip[x_?NumericQ, y_?NumericQ] := NIntegrate[1/(r[x, y, s]), {s, 0, y}]; $\endgroup$ – mattiav27 Oct 18 '18 at 7:00
3
$\begingroup$

"NIntegrate::inumr: The integrand 1/r[0.0000715,-2.9995,s] has evaluated to non-numerical values for all sampling points in the region with boundaries {{0,-2.9995}}"

You are getting this error because you have not written the code in a proper format.

See this:

r[x_, y_, s_] := (Sqrt[4/(1 - x) + y*x - 4/(1 - s) - y*s]);
Ip[x_, y_] := NIntegrate[1/(r[x, y, s]), {s, 0, y}];
Plot3D[Ip[x, y], {x, 0, 1}, {y, -3, 4}]

enter image description here

Your function is singular at some values. you will see some warnings about the singularity while evaluating the numerical integration.

$\endgroup$
  • 1
    $\begingroup$ I can't find a difference to OP's coding? $\endgroup$ – Ulrich Neumann Oct 18 '18 at 7:19
  • $\begingroup$ @UlrichNeumann, Now You are seeing the updated version of OP's coding. $\endgroup$ – math Oct 18 '18 at 8:54
  • $\begingroup$ @ SachinKumar Thanks $\endgroup$ – Ulrich Neumann Oct 18 '18 at 9:13

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