Im trying to plot a probability function in tikz, but the line plotted isn't even close to how the function should look. Im new to using latex and I have no idea why this isnt working, unless tikz just cant handle this function. Here is my code:
\documentclass{article}
\usepackage{pgfplots}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[
declare function={Probability(\n,\k) = 1-((\n!)/((\n^(\k))*((\n-
\k)!)));}
]
\begin{axis}[
no markers, domain=0:15, samples=2500,
axis lines=left, xlabel=$k$, ylabel=$y$,
every axis y label/.style={at=(current axis.above origin),anchor=east},
every axis x label/.style={at=(current axis.right of origin),anchor=north},
height=10cm, width=15cm,
xtick={0,2,4,6,8,10,12,14},
ytick={0.1,0.2,0.3,0.4,0.5,.6,.7,.8,.9,1},
enlargelimits=false, clip=false, axis on top,
grid = major,
xmax=15
]
\addplot [very thin,cyan!20!black] {Probability(10,x)};
\end{axis}
\end{tikzpicture}
\end{document}
This is what the function should look like,
And this is what tikz is plotting
I would appreciate it if someone could point me in the right direction. Thanks
Probability
in terms of factorial! What you might not know is that factorial is also defined for non integers -hence your result. en.wikipedia.org/wiki/Factorial#Factorial_of_a_non-integer