I'm trying to calculate the upper bound of an integral. My current code is
f[r_?NumericQ] =
(1/(Pi*a^3))*4*Pi*(r^2)*E^(-r/a);
Plot[f[r], {r, 0, 1}]
When I evaluate this, the graph is incorrect. The current graph and error I'm getting are
last night, however, I was able to get the graph to look like this
What changed? Why isn't the current code working? Alternatively, are there other ways to do this calculation?
EDIT: Using the code given I redid my calculations. The new code is
a = 5.291*10^-11;
f[r_] = (1/(Pi*a^3))*4*Pi*(r^2)*E^(-r/a);
Plot[f[r], {r, 0, 1}]
clear[b]
g[b_] = Integrate[f[r], {r, 0, b}]
sol = g[b] /. sol
NSolve[{g[b] == 1/2, b > 0}, b][[1]]
the output is
- +(-8.-1.512*10^11 b-1.42884*10^21 b^2) E^(-1.89*10^10 b) ReplaceAll::reps: {sol} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing. $RecursionLimit::reclim2: Recursion depth of 1024 exceeded during evaluation of >8. +(-8.-1.512*10^11 b-1.42884*10^21 b^2) E^(-1.89*10^10 b). Hold[8. +(-8.-1.512*10^11 b-1.42884*10^21 b^2) E^(-1.89*10^10 b)/. sol]