Writing integrals in terms of the error function

  • #1
479
12

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

 

Answers and Replies

  • #2
Ray Vickson
Science Advisor
Homework Helper
Dearly Missed
10,706
1,722

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)##?
 
  • #3
479
12
Thanks for the response

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?
 
  • #4
Orodruin
Staff Emeritus
Science Advisor
Homework Helper
Insights Author
Gold Member
17,167
6,973
Rewrite the integral as two integrals from ##_-\infty## to some upper limit.
 
  • #5
479
12
Thanks for the response

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.
 
  • #6
Orodruin
Staff Emeritus
Science Advisor
Homework Helper
Insights Author
Gold Member
17,167
6,973
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.
 
  • #7
479
12
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!
 
  • #8
Orodruin
Staff Emeritus
Science Advisor
Homework Helper
Insights Author
Gold Member
17,167
6,973
Uhhhmm... Apply the definition of the error function?
 
  • #9
479
12
I got,
$$\frac{k}{2} \sqrt{\frac{\pi}{c}}[erf(f_2) - erf(f_1)]$$

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
Ray Vickson
Science Advisor
Homework Helper
Dearly Missed
10,706
1,722
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
479
12
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
Ray Vickson
Science Advisor
Homework Helper
Dearly Missed
10,706
1,722
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).
 
  • #13
Ray Vickson
Science Advisor
Homework Helper
Dearly Missed
10,706
1,722
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:
  • #14
Orodruin
Staff Emeritus
Science Advisor
Homework Helper
Insights Author
Gold Member
17,167
6,973
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)
$$
 
  • #15
479
12
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
Ray Vickson
Science Advisor
Homework Helper
Dearly Missed
10,706
1,722
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
Orodruin
Staff Emeritus
Science Advisor
Homework Helper
Insights Author
Gold Member
17,167
6,973
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
479
12
Could someone assist regarding post 15? Many thanks.
 

Related Threads on Writing integrals in terms of the error function

  • Last Post
Replies
4
Views
2K
  • Last Post
Replies
11
Views
2K
Replies
7
Views
6K
  • Last Post
Replies
9
Views
659
Replies
5
Views
749
Replies
1
Views
2K
Replies
28
Views
4K
  • Last Post
Replies
2
Views
2K
  • Last Post
Replies
4
Views
2K
  • Last Post
Replies
4
Views
757
Top