# Sketch Probability density function [closed]

My question is :

Suppose that the PDF of a random variable X is as follows: \begin{equation*} f(x) = \begin{cases} ce^{-2x} & \text {$x > 0$}\\ 0 & \text {otherwise}\\ \end{cases} \end{equation*} (a) Find the value of the constant c and sketch the PDF.

I am able to calculate value of c = 2. But when I try to plot PDF on mathematica using below code, it throws me below error.

{xlow, xhigh} = {0, Infinity};
Clear[pdf, x, t];
pdf[x_] := 2 e^(-2x)
pdfplot = Plot[pdf[x], {x, xlow, xhigh},
PlotStyle -> {{Thickness[0.01], Purple}},
AxesLabel -> {"x", "pdf[x]"}, AspectRatio - > 1/GoldenRatio]


Error:

Plot::plln: Limiting value Infinity in {x, xlow, xhigh} is not a machine-sized real number.   Plot::plln: Limiting value Infinity in {x, xlow, xhigh} is not a machine-sized real number.   Plot::plln:Limiting value Infinity in {x, xlow, xhigh} is not a machine-sized real number.

• Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. – bbgodfrey Feb 3 '15 at 16:07
• Euler's number is written with a capital E in mathematica, or as esc-ee-esc. – Sjoerd C. de Vries Feb 3 '15 at 19:53

Use E rather than e

{xlow, xhigh} = {0, Infinity};
Clear[pdf, x, t];
pdf[x_] := 2 E^(-2 x)


You can use xhigh (i.e., Infinity) in a function like Integrate

Integrate[pdf[x], {x, xlow, xhigh}]


1

However, a Plot must be on a finite domain

Plot[pdf[x], {x, xlow, 6}, PlotStyle -> {{Thickness[0.01], Purple}},
AxesLabel -> {"x", "pdf[x]"}, AspectRatio -> 1/GoldenRatio] • My graph is not touching on Y axis with your code. How do you mention the X/Y axis steps in between the plotted points of 0.5, 1.0, 1.5, 2.0 etc – mike99999 Feb 3 '15 at 16:47
• See the documentation on Ticks to specify tick number, subdivisions, styling, and so on. – David G. Stork Feb 3 '15 at 17:19