Writing integrals in terms of the error function

Click For Summary
The discussion revolves around rewriting a specific integral in terms of the error function (erf). The integral presented involves an exponential function with limits from negative infinity to zero, and participants are exploring variable substitutions to align it with the erf definition. A change of variables is suggested, leading to the formulation of the integral in terms of erf, but there are challenges with the limits of integration. Participants emphasize the importance of correctly applying the error function and LaTeX formatting for clarity. The conversation highlights the mathematical intricacies involved in transforming integrals and the need for precise notation.
WWCY
Messages
476
Reaction score
15

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.

Homework Equations

The Attempt at a Solution

 
Physics news on Phys.org
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.

Homework Equations

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 ... :rolleyes:

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 ... :rolleyes:

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!
 
  • #10
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.
 
  • #11
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!
 
  • #12
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).
 
  • Like
Likes WWCY
  • #13
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:
  • Like
Likes WWCY
  • #14
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)
$$
 
  • Like
Likes WWCY
  • #15
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]$$
 
  • #16
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:
  • #17
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.
 
  • #18
Could someone assist regarding post 15? Many thanks.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 5 ·
Replies
5
Views
2K
Replies
4
Views
2K
  • · Replies 105 ·
4
Replies
105
Views
6K
Replies
4
Views
2K
  • · Replies 19 ·
Replies
19
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 6 ·
Replies
6
Views
1K