I am studying a set of functions (many of which I know only as a definite integral) and I have assembled into a list. Here is a sample:
Clear[functionsToPlot, totalFunctions]
functionsToPlot[x_] := {
(*1*) NIntegrate[0.3/(z + 2) Sqrt[z^2 + 2.0 z + 0.7]/((z - 1)^2 + 1.1), {z, 0, x}],
(*2*) NIntegrate[.03/(z + 2) Sqrt[z^2 + 2.5 z + 1.50 x]/((z - 1)^2 + .03), {z, 0, x}],
(*3*) 0.5*Sqrt[x + 0.5]/x
};
What I need is to make a plot of each curve divided by the total:
totalFunctions[x_] := Total[functionsToPlot[x]]
Plot[Evaluate[functionsToPlot[x]/totalFunctions[x]], {x, 0, 3}]
But the problem is that it takes forever. I'm certain the Plot
routine is doing the numerical integrals twice (once in the numerator, and again for the denominator). Is there a way to teach Mathematica to form the total as it computes the various curves in the numerator as it produces the plot in realtime (or to make the task run more efficiently)?