I observed that there is no Q-function representation in Mathematica. The definition of Q-Function is:

Q(x)=1√2π∫∞xe−u22du=12erfc(x√2)\begin{align}

Q(x) &= \frac{1}{\sqrt{2\pi}} \int_x^\infty e^{-\frac{u^2}{2}}du \\

&=\frac{1}{2} \mathrm{erfc}(\frac{x}{\sqrt{2}})

\end{align}

a nother representation of Q-function is:

Q(x)=1π∫π20e(−x22sin2ϕ)dϕ\begin{align}

Q(x) = \frac{1}{\pi} \int_0^{\frac{\pi}{2}} e^{\left(\frac{-x^2}{2\sin^2{\phi}} \right)}d\phi

\end{align}

there is only Complementary Error Function representation Erfc.

erfc(x)=2√π∫∞xexp(−t2)dt\mathrm{erfc}(x) = \frac{2}{\sqrt{\pi}} \int_{x}^{\infty} \exp(-t^2) dt

Is there any possiblity that define a new function in Mathematica? so that it will be a permanent function.

Note:

In statistics, the Q-function is the tail probability of the standard normal distribution. In other words, Q(x) is the probability that a normal (Gaussian) random variable will obtain a value larger than x standard deviations above the mean.

=================

2

How about: q[x_] := Erfc[x/Sqrt[2]]/2;

– bill s

Oct 17 ’13 at 15:05

5

or even q[x_] := SurvivalFunction[NormalDistribution[0,1],x]

– chuy

Oct 17 ’13 at 17:42

=================

2 Answers

2

=================

There are two parts to your question: how to define the function and how to make it persist between sessions. I suggested

q[x_] := Erfc[x/Sqrt[2]]/2;

though chuy’s suggestion looks fine too.To make it persist, you can place this function definition in an initialization cell, and then this will run whenever the notebook is opened. You can find instructions for this here and other information here about running the cell on startup.

is it possible in the future versions in Mathematica contain this function? I mean can you tell them or suggest this to them?

– sky-light

Oct 17 ’13 at 23:40

1

I guess you might want to ask Wolfram about that. On the support page wolfram.com/support/contact/email you can email them about bugs or with suggestions.

– bill s

Oct 18 ’13 at 0:06

If this the function that you use daily, you can put it into you initialization file. Use the command in a notebook:

$UserBasedDirectory

Usually there is a ./Kernel/init.m file. It is evaluated when Mathematica kernel starts. You can put these line in it:

q::usage=”q[x] is my Q-function. You cannot modify it, aha!”

q[x_:0] := Erfc[x/Sqrt[2]]/2

Protect[q]

Then you will have several good features: