The attached worksheet describes the issue.
The numerical integrated value does not match the values in the plotted graphic over the same range.
I am likely making a novice mistake, but any help would be appreciated.
The attached worksheet describes the issue.
The numerical integrated value does not match the values in the plotted graphic over the same range.
I am likely making a novice mistake, but any help would be appreciated.
y1 = 0; y2 = 1;
n = 50;
y = Range[y1,y2, (y2-y1)/(n-1.)];
f[x_, y_] := y Sin[x]
If your function is Listable you can do this
points = {y, NIntegrate[f[x, y], {x, 0, Pi}]} // Transpose;
ListLinePlot[points]
If your function is not Listable:
points = Map[{#, NIntegrate[f[x, #], {x, 0, Pi}]} &, y]
ListLinePlot[points]
enter image description here
Not sure what you are repling to.
If I integrate my expression, I get an analytical function that has a value of 3 when the variable goes to zero, but the ListPlotTable[NIntegrate]] for that same integrated function shows the correct value…0…when the variable goes to zero. The analytical function is biased upward by 3 units…and the curve that is generated is the same as the ListPlot only biased upward by 3 units.
My conclusion is that Mathematica has incorrectly performed the integration on the function and has given me an incorrect analytical expression. I can live with the numerical integration but the disconnect with the analytical expression was unexpected.
You may have forgotten to subtract the value of f1 at b=0:
Clear[f1];
f1[b_] = Integrate[(b Sqrt[1 - b^2])/(1 - b)^2, b];
ListPlot[Table[f1[b], {b, 0, .13, .01}]]
ListPlot[Table[f1[b] - f1[0], {b, 0, .13, .01}]]
You are absolutely correct! See, I told you I probably did something stupid.
Thanks for your help. I get in a hurry and skip steps I know not to skip.