# Writing integrals in terms of the error function

• WWCY
In summary: Also: for most of the common functions (sin, cos, tan, arcsin,arccos, arcsin,cot,ln,log,max,min,lim,exp) and several others, it is enough to just put a "\" in front, so you get ##\sin \theta## (which looks good) instead of ##sin \theta## (which looks ugly and is hard to... read?).
WWCY

## Homework Statement

I have the following integral,

$$\frac{1}{\sigma \sqrt{2\pi} t} \int_{-\infty}^{0} \exp[\frac{-1}{2\sigma ^2} (\frac{x-x_0}{t} - p_0)^2]dx$$
that I wish to write in terms of the error function,
$$erf(x) = \frac{2}{\sqrt{\pi}} \int_{0}^{x} e^{-g^2}dg$$
However, I can't seem to make my limits fit that of ##erf(x)## despite trying a change of variables like letting ## g = \frac{-1}{\sqrt{2\sigma ^2}} (\frac{x-x_0}{t} - p_0)##

This is my first time dealing with such a function, and pointers are greatly appreciated.

WWCY said:

## Homework Statement

I have the following integral,

$$\frac{1}{\sigma \sqrt{2\pi} t} \int_{-\infty}^{0} \exp[\frac{-1}{2\sigma ^2} (\frac{x-x_0}{t} - p_0)^2]dx$$
that I wish to write in terms of the error function,
$$erf(x) = \frac{2}{\sqrt{\pi}} \int_{0}^{x} e^{-g^2}dg$$
However, I can't seem to make my limits fit that of ##erf(x)## despite trying a change of variables like letting ## g = \frac{-1}{\sqrt{2\sigma ^2}} (\frac{x-x_0}{t} - p_0)##

This is my first time dealing with such a function, and pointers are greatly appreciated.

## The Attempt at a Solution

PF rules really do require you to tell us more. Show your actual work; where does it fail?

For constants ##a,b,c,k,w## (with ##c > 0##), can you express
$$\int_a^b k e^{-c(x-w)^2} \, dx$$
in terms of ##\text{erf}( \cdot)##?

Thanks for the response

Ray Vickson said:
PF rules really do require you to tell us more. Show your actual work; where does it fail?
For constants ##a,b,c,k,w## (with ##c > 0##), can you express
$$\int_a^b k e^{-c(x-w)^2} \, dx$$
in terms of ##\text{erf}( \cdot)##?

Using the integral given as an example, I tried a change of variables ##f = \sqrt{c}(x - w)^2##,
which led to
$$\frac{k}{\sqrt{c}} \int_{f_1}^{f_2}e^{-f^2}df$$
I can't tell if this was the right "first-step" to take.

May I know what are the concepts in play? For example, is this just an issue of changing variables, or is there more to it?

Rewrite the integral as two integrals from ##_-\infty## to some upper limit.

Thanks for the response

Orodruin said:
Rewrite the integral as two integrals from ##_-\infty## to some upper limit.

Do you mean something like this?
$$\frac{k}{\sqrt{c}} (\int_{-\infty}^{f_2}e^{-f^2}df - \int_{-\infty}^{f_1}e^{-f^2}df)$$

If so, how do I continue? Thank you for assisting.

Sorry, I meant from ##0## to some upper limit ...

Edit: Also, your rewriting is not correct. There is a minor error in it. Try to find it.

Orodruin said:
Sorry, I meant from ##0## to some upper limit ...

Edit: Also, your rewriting is not correct. There is a minor error in it. Try to find it.

Oops, I believe I have spotted it.

$$\frac{k}{\sqrt{c}} (\int_{0}^{f_2}e^{-f^2}df - \int_{0}^{f_1}e^{-f^2}df)$$
where ##f_1 = \sqrt{c} (a - w), f_2 = \sqrt{c} (b - w)##

Is this correct? And how do I proceed?

Thanks!

Uhhhmm... Apply the definition of the error function?

I got,
$$\frac{k}{2} \sqrt{\frac{\pi}{c}}[erf(f_2) - erf(f_1)]$$

Orodruin said:
Uhhhmm... Apply the definition of the error function?

Apologies, I meant to ask how I would fit in the limits of ##-\infty## and ##0## as per my original question.

For ##b = 0, a = -\infty##,
$$\frac{k}{2} \sqrt{\frac{\pi}{c}}[erf(- \sqrt{c} w) - \frac{2}{\sqrt{\pi}} \int_{0}^{-\infty}e^{-f^2}df]$$
$$\frac{k}{2} \sqrt{\frac{\pi}{c}}[erf(- \sqrt{c} w) + 1]$$

Am I doing it right? Thank you!

WWCY said:
I got,
$$\frac{k}{2} \sqrt{\frac{\pi}{c}}[erf(f_2) - erf(f_1)]$$
Apologies, I meant to ask how I would fit in the limits of ##-\infty## and ##0## as per my original question.

For ##b = 0, a = -\infty##,
$$\frac{k}{2} \sqrt{\frac{\pi}{c}}[erf(- \sqrt{c} w) - \frac{2}{\sqrt{\pi}} \int_{0}^{-\infty}e^{-f^2}df]$$
$$\frac{k}{2} \sqrt{\frac{\pi}{c}}[erf(- \sqrt{c} w) + 1]$$

Am I doing it right? Thank you!

Yes, except that you are not writing "erf" correctly in LaTeX. You should say "##\text{erf}(f_2)##" instead of "##erf(f_2)##". Right-click on the expressions to see the difference.

Ray Vickson said:
Yes, except that you are not writing "erf" correctly in LaTeX. You should say "##\text{erf}(f_2)##" instead of "##erf(f_2)##". Right-click on the expressions to see the difference.

Thank you, I'll keep that in mind!

WWCY said:
Thank you, I'll keep that in mind!

Also: for most of the common functions (sin, cos, tan, arcsin,arccos, arcsin,cot,ln,log,max,min,lim,exp) and several others, it is enough to just put a "\" in front, so you get ##\sin \theta## (which looks good) instead of ##sin \theta## (which looks ugly and is hard to read).

WWCY
Ray Vickson said:
Also: for most of the common functions (sin, cos, tan, arcsin,arccos, arcsin,cot,ln,log,max,min,lim,exp) and several others, it is enough to just put a "\" in front, so you get ##\sin \theta## (which looks good) instead of ##sin \theta## (which looks ugly and is hard to read).
When the command does not have a "\" form, we need to manually force a non-math-italic font by putting the command inside a "\text{ }" construct, so we get ##P(2\; \text{heads}) = 1/4## instead of ##P(2\; heads) = 1/4##. That is why we needed to say \text{erf}(x): the function "erf" is not on the list of commands/functions having a short "\" form.

Last edited:
WWCY
Actually, the \text command does not really do the same thing as the typical function commands. The spacing will be off. The appropriate way of putting new function commands into LaTeX is to use the \DeclareMathOperator command. If you just need it once, you should use \operatorname, i.e., ##\operatorname{erf}(x)##. Compare the \operatorname solution to "a erf(x)" with the \text solution:
$$a \operatorname{erf}(x) \quad \mbox{vs} \quad a \text{erf}(x)$$

WWCY
I have attempted working out my initial problem in the same manner as above, could someone give the working a look? Thanks in advance!
$$I = \frac{1}{\sigma \sqrt{2\pi} t} \int_{-\infty}^{0} \exp[\frac{-1}{2\sigma ^2} (\frac{x-x_0}{t} - p_0)^2]dx$$
Let ##g = \frac{1}{\sigma \sqrt{2}} ( \frac{x - x_0}{t} -p_0 ) ## and ##dg = \frac{1}{\sigma t \sqrt{2}} dx##
$$I = \frac{1}{\sqrt{\pi}} \int_{g_2}^{g_1} e^{-g^2}dg$$
$$I = \frac{1}{\sqrt{\pi}} [ \int_{0}^{g_2} e^{-g^2}dg - \int_{0}^{g_1} e^{-g^2}dg]$$
$$I = \frac{1}{\sqrt{\pi}} \frac{\sqrt{\pi}}{2}[\operatorname{erf(g_2)} - \frac{2}{\sqrt{\pi}} \int_{0}^{-\infty} e^{-g^2}dg ]$$
$$I = \frac{1}{2} [ \operatorname{erf}(\frac{1}{\sigma \sqrt{2}} [-\frac{x_0}{t} - p_0] ) + 1]$$
$$I = \frac{1}{2} [ \operatorname{erf}(-\frac{1}{\sigma \sqrt{2}} [\frac{x_0}{t} + p_0] ) + 1]$$

Orodruin said:
Actually, the \text command does not really do the same thing as the typical function commands. The spacing will be off. The appropriate way of putting new function commands into LaTeX is to use the \DeclareMathOperator command. If you just need it once, you should use \operatorname, i.e., ##\operatorname{erf}(x)##. Compare the \operatorname solution to "a erf(x)" with the \text solution:
$$a \operatorname{erf}(x) \quad \mbox{vs} \quad a \text{erf}(x)$$

Thanks: I did not know that. However, I would rather type " a \: \text{erf}(x)" than "a \operatorname{erf}(x)". I have long been aware of that spacing problem and have used spacers to compensate.

Now that I know about "\operatorname" I can see defining a short form of it in the document preamble.

Last edited:
Ray Vickson said:
Thanks: I did not know that. However, I would rather type " a \: \text{erf}(x)" than "a \operatorname{erf}(x)". I have long been aware of that spacing problem and have used spacers to compensate.

Now that I know about "\operatorname" I can see defining a short form of it in the document preamble.
If you are going to use a single function often, I strongly reccomend \DeclareMathOperator instead.

Could someone assist regarding post 15? Many thanks.

## 1. What is the error function and how is it related to integrals?

The error function, also known as the Gauss error function, is a mathematical function that describes the area under a Gaussian curve. It is often used to express integrals in terms of this function because it can be evaluated numerically and has many useful properties.

## 2. How do you write an integral in terms of the error function?

To write an integral in terms of the error function, you must first rewrite the integrand in the form of a Gaussian function. Then, you can use properties of the error function to simplify the integral and express it in terms of the error function.

## 3. Can the error function be used to approximate integrals?

Yes, the error function can be used to approximate integrals. This is because the error function can be evaluated numerically and has a known relationship to Gaussian functions, making it a useful tool for approximating the area under a curve.

## 4. Are there any limitations to using the error function to write integrals?

While the error function is a powerful tool for expressing and approximating integrals, it does have some limitations. It may not be applicable to all types of integrals and may not provide an exact solution in some cases.

## 5. Are there any real-world applications for writing integrals in terms of the error function?

Yes, there are many real-world applications for writing integrals in terms of the error function. Some examples include solving problems in physics, engineering, and statistics, such as calculating the probability of a certain event occurring or finding the area under a normal distribution curve.

• Calculus and Beyond Homework Help
Replies
5
Views
691
• Calculus and Beyond Homework Help
Replies
2
Views
1K
• Calculus and Beyond Homework Help
Replies
1
Views
464
• Calculus and Beyond Homework Help
Replies
6
Views
2K
• Calculus and Beyond Homework Help
Replies
1
Views
295
• Calculus and Beyond Homework Help
Replies
9
Views
304
• Calculus and Beyond Homework Help
Replies
3
Views
1K
• Calculus and Beyond Homework Help
Replies
3
Views
747
• Calculus and Beyond Homework Help
Replies
3
Views
667
• Calculus and Beyond Homework Help
Replies
9
Views
1K