Find a constant c from PDF
I have a problem as the following, the question is to solve for c.
I let the equation below equal to 1
and got c = 0.02*exp(0.02)
I checked my work by some lines of code
c = 0.02*exp(0.02)
P = 0
for (i in 1:999){
P = P + c * exp(-i/50)}
The result was 1.01003333098722 but I expected 1. Where did I go wrong?
Solution 1:
I think you should handle basic integrations by hand and not rely on computers.
$\int_{0}^{\infty}ce^{-\frac{x}{50}}dx =1\implies -50c(e^{-\infty}-e^{0})=1$.
But $e^{-\infty}=0$ and $e^{0}=1$ .
$50c=1\implies c=\frac{1}{50}$ .
(Normally you are not even allowed to write $\infty$ like that . You have to take limits.) .
For more information look at this .