How to plot the normal distribution?
$begingroup$
According to 'An Introduction to Probability Theory and Its Applications', Vol. 1 by Feller the number of inversions in a random permutations at large numbers satisfy CLT with dedicated mean and variance.
However, I am practically intrested in how to plot the figure of the normal distribution (what to calculate for it)?
I understand that the figure may depends on the fact of how large the numbers are. Any explanations to clarify the topic are highly welcomed. Thank you in advance.
probability-theory probability-distributions
$endgroup$
add a comment |
$begingroup$
According to 'An Introduction to Probability Theory and Its Applications', Vol. 1 by Feller the number of inversions in a random permutations at large numbers satisfy CLT with dedicated mean and variance.
However, I am practically intrested in how to plot the figure of the normal distribution (what to calculate for it)?
I understand that the figure may depends on the fact of how large the numbers are. Any explanations to clarify the topic are highly welcomed. Thank you in advance.
probability-theory probability-distributions
$endgroup$
$begingroup$
Do you want to plot the PDF $frac{1}{sigmasqrt{2pi}}exp-frac{(x-mu)^2}{2sigma^2}$ or the CDF $frac{1}{2}left[1+operatorname{erf}left(frac{x-mu}{sigmasqrt{2}}right)right]$? Either way, the case $mu=0,,sigma=1$ is worth using for definiteness.
$endgroup$
– J.G.
Dec 20 '18 at 19:52
$begingroup$
The PDF one, which depends on the number of elements
$endgroup$
– Mikhail Gaichenkov
Dec 20 '18 at 20:06
add a comment |
$begingroup$
According to 'An Introduction to Probability Theory and Its Applications', Vol. 1 by Feller the number of inversions in a random permutations at large numbers satisfy CLT with dedicated mean and variance.
However, I am practically intrested in how to plot the figure of the normal distribution (what to calculate for it)?
I understand that the figure may depends on the fact of how large the numbers are. Any explanations to clarify the topic are highly welcomed. Thank you in advance.
probability-theory probability-distributions
$endgroup$
According to 'An Introduction to Probability Theory and Its Applications', Vol. 1 by Feller the number of inversions in a random permutations at large numbers satisfy CLT with dedicated mean and variance.
However, I am practically intrested in how to plot the figure of the normal distribution (what to calculate for it)?
I understand that the figure may depends on the fact of how large the numbers are. Any explanations to clarify the topic are highly welcomed. Thank you in advance.
probability-theory probability-distributions
probability-theory probability-distributions
asked Dec 20 '18 at 19:43
Mikhail GaichenkovMikhail Gaichenkov
6610
6610
$begingroup$
Do you want to plot the PDF $frac{1}{sigmasqrt{2pi}}exp-frac{(x-mu)^2}{2sigma^2}$ or the CDF $frac{1}{2}left[1+operatorname{erf}left(frac{x-mu}{sigmasqrt{2}}right)right]$? Either way, the case $mu=0,,sigma=1$ is worth using for definiteness.
$endgroup$
– J.G.
Dec 20 '18 at 19:52
$begingroup$
The PDF one, which depends on the number of elements
$endgroup$
– Mikhail Gaichenkov
Dec 20 '18 at 20:06
add a comment |
$begingroup$
Do you want to plot the PDF $frac{1}{sigmasqrt{2pi}}exp-frac{(x-mu)^2}{2sigma^2}$ or the CDF $frac{1}{2}left[1+operatorname{erf}left(frac{x-mu}{sigmasqrt{2}}right)right]$? Either way, the case $mu=0,,sigma=1$ is worth using for definiteness.
$endgroup$
– J.G.
Dec 20 '18 at 19:52
$begingroup$
The PDF one, which depends on the number of elements
$endgroup$
– Mikhail Gaichenkov
Dec 20 '18 at 20:06
$begingroup$
Do you want to plot the PDF $frac{1}{sigmasqrt{2pi}}exp-frac{(x-mu)^2}{2sigma^2}$ or the CDF $frac{1}{2}left[1+operatorname{erf}left(frac{x-mu}{sigmasqrt{2}}right)right]$? Either way, the case $mu=0,,sigma=1$ is worth using for definiteness.
$endgroup$
– J.G.
Dec 20 '18 at 19:52
$begingroup$
Do you want to plot the PDF $frac{1}{sigmasqrt{2pi}}exp-frac{(x-mu)^2}{2sigma^2}$ or the CDF $frac{1}{2}left[1+operatorname{erf}left(frac{x-mu}{sigmasqrt{2}}right)right]$? Either way, the case $mu=0,,sigma=1$ is worth using for definiteness.
$endgroup$
– J.G.
Dec 20 '18 at 19:52
$begingroup$
The PDF one, which depends on the number of elements
$endgroup$
– Mikhail Gaichenkov
Dec 20 '18 at 20:06
$begingroup$
The PDF one, which depends on the number of elements
$endgroup$
– Mikhail Gaichenkov
Dec 20 '18 at 20:06
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
Here is how to plot the density function of $N(0,1)$:
$$
f(x) = frac{e^{-frac{x^2}{2}}}{sqrt{2 pi}} .
$$
In Mathematica, a one-liner:
Plot[PDF[NormalDistribution, x], {x, -4, 4}]
In Python, slightly more verbose:
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(-4, 4, 101)
y = np.exp(-x*x/2) / np.sqrt(2*np.pi)
plt.plot(x, y)
plt.show()
$endgroup$
$begingroup$
Thank you, Federico! How can I get the N(0,1) if there are mean and variance which depend on the number of elements?
$endgroup$
– Mikhail Gaichenkov
Dec 20 '18 at 19:56
$begingroup$
Translate and rescale: if $Zsim N(mu,sigma)$, then $(Z-mu)/sigmasim N(0,1)$.
$endgroup$
– Federico
Dec 20 '18 at 19:58
$begingroup$
Could you add the figures here for mean=n(n-1)/4, variance=(2n^3+3n^2-5n)/72 at n=10, 100, 1000?
$endgroup$
– Mikhail Gaichenkov
Dec 20 '18 at 20:04
$begingroup$
They don't look any different from the one I plotted. They are just translated and stretched. Only the numbers on the axes change
$endgroup$
– Federico
Dec 20 '18 at 20:08
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3047905%2fhow-to-plot-the-normal-distribution%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Here is how to plot the density function of $N(0,1)$:
$$
f(x) = frac{e^{-frac{x^2}{2}}}{sqrt{2 pi}} .
$$
In Mathematica, a one-liner:
Plot[PDF[NormalDistribution, x], {x, -4, 4}]
In Python, slightly more verbose:
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(-4, 4, 101)
y = np.exp(-x*x/2) / np.sqrt(2*np.pi)
plt.plot(x, y)
plt.show()
$endgroup$
$begingroup$
Thank you, Federico! How can I get the N(0,1) if there are mean and variance which depend on the number of elements?
$endgroup$
– Mikhail Gaichenkov
Dec 20 '18 at 19:56
$begingroup$
Translate and rescale: if $Zsim N(mu,sigma)$, then $(Z-mu)/sigmasim N(0,1)$.
$endgroup$
– Federico
Dec 20 '18 at 19:58
$begingroup$
Could you add the figures here for mean=n(n-1)/4, variance=(2n^3+3n^2-5n)/72 at n=10, 100, 1000?
$endgroup$
– Mikhail Gaichenkov
Dec 20 '18 at 20:04
$begingroup$
They don't look any different from the one I plotted. They are just translated and stretched. Only the numbers on the axes change
$endgroup$
– Federico
Dec 20 '18 at 20:08
add a comment |
$begingroup$
Here is how to plot the density function of $N(0,1)$:
$$
f(x) = frac{e^{-frac{x^2}{2}}}{sqrt{2 pi}} .
$$
In Mathematica, a one-liner:
Plot[PDF[NormalDistribution, x], {x, -4, 4}]
In Python, slightly more verbose:
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(-4, 4, 101)
y = np.exp(-x*x/2) / np.sqrt(2*np.pi)
plt.plot(x, y)
plt.show()
$endgroup$
$begingroup$
Thank you, Federico! How can I get the N(0,1) if there are mean and variance which depend on the number of elements?
$endgroup$
– Mikhail Gaichenkov
Dec 20 '18 at 19:56
$begingroup$
Translate and rescale: if $Zsim N(mu,sigma)$, then $(Z-mu)/sigmasim N(0,1)$.
$endgroup$
– Federico
Dec 20 '18 at 19:58
$begingroup$
Could you add the figures here for mean=n(n-1)/4, variance=(2n^3+3n^2-5n)/72 at n=10, 100, 1000?
$endgroup$
– Mikhail Gaichenkov
Dec 20 '18 at 20:04
$begingroup$
They don't look any different from the one I plotted. They are just translated and stretched. Only the numbers on the axes change
$endgroup$
– Federico
Dec 20 '18 at 20:08
add a comment |
$begingroup$
Here is how to plot the density function of $N(0,1)$:
$$
f(x) = frac{e^{-frac{x^2}{2}}}{sqrt{2 pi}} .
$$
In Mathematica, a one-liner:
Plot[PDF[NormalDistribution, x], {x, -4, 4}]
In Python, slightly more verbose:
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(-4, 4, 101)
y = np.exp(-x*x/2) / np.sqrt(2*np.pi)
plt.plot(x, y)
plt.show()
$endgroup$
Here is how to plot the density function of $N(0,1)$:
$$
f(x) = frac{e^{-frac{x^2}{2}}}{sqrt{2 pi}} .
$$
In Mathematica, a one-liner:
Plot[PDF[NormalDistribution, x], {x, -4, 4}]
In Python, slightly more verbose:
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(-4, 4, 101)
y = np.exp(-x*x/2) / np.sqrt(2*np.pi)
plt.plot(x, y)
plt.show()
answered Dec 20 '18 at 19:49
FedericoFederico
5,124514
5,124514
$begingroup$
Thank you, Federico! How can I get the N(0,1) if there are mean and variance which depend on the number of elements?
$endgroup$
– Mikhail Gaichenkov
Dec 20 '18 at 19:56
$begingroup$
Translate and rescale: if $Zsim N(mu,sigma)$, then $(Z-mu)/sigmasim N(0,1)$.
$endgroup$
– Federico
Dec 20 '18 at 19:58
$begingroup$
Could you add the figures here for mean=n(n-1)/4, variance=(2n^3+3n^2-5n)/72 at n=10, 100, 1000?
$endgroup$
– Mikhail Gaichenkov
Dec 20 '18 at 20:04
$begingroup$
They don't look any different from the one I plotted. They are just translated and stretched. Only the numbers on the axes change
$endgroup$
– Federico
Dec 20 '18 at 20:08
add a comment |
$begingroup$
Thank you, Federico! How can I get the N(0,1) if there are mean and variance which depend on the number of elements?
$endgroup$
– Mikhail Gaichenkov
Dec 20 '18 at 19:56
$begingroup$
Translate and rescale: if $Zsim N(mu,sigma)$, then $(Z-mu)/sigmasim N(0,1)$.
$endgroup$
– Federico
Dec 20 '18 at 19:58
$begingroup$
Could you add the figures here for mean=n(n-1)/4, variance=(2n^3+3n^2-5n)/72 at n=10, 100, 1000?
$endgroup$
– Mikhail Gaichenkov
Dec 20 '18 at 20:04
$begingroup$
They don't look any different from the one I plotted. They are just translated and stretched. Only the numbers on the axes change
$endgroup$
– Federico
Dec 20 '18 at 20:08
$begingroup$
Thank you, Federico! How can I get the N(0,1) if there are mean and variance which depend on the number of elements?
$endgroup$
– Mikhail Gaichenkov
Dec 20 '18 at 19:56
$begingroup$
Thank you, Federico! How can I get the N(0,1) if there are mean and variance which depend on the number of elements?
$endgroup$
– Mikhail Gaichenkov
Dec 20 '18 at 19:56
$begingroup$
Translate and rescale: if $Zsim N(mu,sigma)$, then $(Z-mu)/sigmasim N(0,1)$.
$endgroup$
– Federico
Dec 20 '18 at 19:58
$begingroup$
Translate and rescale: if $Zsim N(mu,sigma)$, then $(Z-mu)/sigmasim N(0,1)$.
$endgroup$
– Federico
Dec 20 '18 at 19:58
$begingroup$
Could you add the figures here for mean=n(n-1)/4, variance=(2n^3+3n^2-5n)/72 at n=10, 100, 1000?
$endgroup$
– Mikhail Gaichenkov
Dec 20 '18 at 20:04
$begingroup$
Could you add the figures here for mean=n(n-1)/4, variance=(2n^3+3n^2-5n)/72 at n=10, 100, 1000?
$endgroup$
– Mikhail Gaichenkov
Dec 20 '18 at 20:04
$begingroup$
They don't look any different from the one I plotted. They are just translated and stretched. Only the numbers on the axes change
$endgroup$
– Federico
Dec 20 '18 at 20:08
$begingroup$
They don't look any different from the one I plotted. They are just translated and stretched. Only the numbers on the axes change
$endgroup$
– Federico
Dec 20 '18 at 20:08
add a comment |
Thanks for contributing an answer to Mathematics Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3047905%2fhow-to-plot-the-normal-distribution%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
$begingroup$
Do you want to plot the PDF $frac{1}{sigmasqrt{2pi}}exp-frac{(x-mu)^2}{2sigma^2}$ or the CDF $frac{1}{2}left[1+operatorname{erf}left(frac{x-mu}{sigmasqrt{2}}right)right]$? Either way, the case $mu=0,,sigma=1$ is worth using for definiteness.
$endgroup$
– J.G.
Dec 20 '18 at 19:52
$begingroup$
The PDF one, which depends on the number of elements
$endgroup$
– Mikhail Gaichenkov
Dec 20 '18 at 20:06