0

There is a command to calculate the probability distribution function.

I need to calculate the probability distribution density, for which I have to numerically find the integral of the first function. How can I record this in a new command?

\newcommand\PDF[2]{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))}

\newcommand\PDD[2]{int {1/(#2sqrt(2pi))exp(-((x-#1)^2)/(2#2^2))}} % ??? \newcommand\PDD[2]{int PDF} % ???

  • 3
    AFAIK, Latex is not suitable for calculating these kinds of functions. Better use a dedicated CAS software for that purpose. – Dr. Manuel Kuehner Oct 30 '22 at 06:39
  • can I use a package "numerica" for this? – Антон Oct 30 '22 at 06:58
  • Evaluating the normal or Gaussian integral directly is not easy, as there is no known closed form soiution for the associated integral equation. As a way out, consider using a series approximation. In this answer, I suggest using the approximation proposed by Abramovity and Stegun (1964) to calculate the entries in a table of cdf (cumulative distribution function) values. (The A&S approximation evaluates a polynomial of order 5.) – Mico Oct 30 '22 at 09:09
  • Taking a look at the function it is rather well-behaved for b > 0, so as long as you don't want to integrate along b with values nearing zero you'd be fine with the \integrate macro presented in my answer there: https://tex.stackexchange.com/a/662100/117050 – Skillmon Oct 30 '22 at 11:50
  • Skillmon, I copied your code completely, but it doesn't work. Error in line "\usepackage{expkv-cs}" – Антон Oct 31 '22 at 04:06

0 Answers0