# Thread: [maxima] approaching integral values

1. ## [maxima] approaching integral values

Hi !

I just needed to compute (get an approximating value) $\displaystyle \frac 23 \left(\int_0^1 x e^{x^2} ~dx+\int_1^2 e^{x^2} ~dx\right)$

I've taken a class in Maxima, but erm... either we didn't do integrals, either I forgot what we did lol!
(the second option may be the more relevant ^^)

I typed this (for the second one)
Code:
integrate(exp(x^2)*2/3, x, 1, 2)
and it gives something with the erf function (nothing surprising)
and when adding the float(...), it gives the erf function as well...

And it looks like it works with Maple, but I don't have Maple, I'm a poor student... xD

Anyway, do you know some good (and free) website where it is possible to compute such things ?

Thanks

2. Originally Posted by Moo
Hi !

I just needed to compute (get an approximating value) $\displaystyle \frac 23 \left(\int_0^1 x e^{x^2} ~dx+\int_1^2 e^{x^2} ~dx\right)$

I've taken a class in Maxima, but erm... either we didn't do integrals, either I forgot what we did lol!
(the second option may be the more relevant ^^)

I typed this (for the second one)
Code:
integrate(exp(x^2)*2/3, x, 1, 2)
and it gives something with the erf function (nothing surprising)
and when adding the float(...), it gives the erf function as well...

And it looks like it works with Maple, but I don't have Maple, I'm a poor student... xD

Anyway, do you know some good (and free) website where it is possible to compute such things ?

Thanks
There is nothing wrong with the Maxima solution, its just that Maxima does not know enough about erfi to simplify it any further or eveluate it numerically.

QuickMath will simplify it somewhat (not much though) but still leave an answer in terms of erfi.

So if you are interested in a numerical value you may as well just go the whole hog and eveluate it as a numerical integral:

Code:
>lo=1;
>hi=2;
>
>dx=(hi-lo)/1000;
>
>x=lo+dx/2:dx:hi;
>
>ii=(2/3)*exp(x^2);
>
>II=sum(ii)*dx
10.9684
>
CB

3. Yep, I had guessed that Maxima couldn't handle erfi.
But I wanted to be sure, if there wasn't a way to make it calculate.

As for the code... Actually, I was looking for a precise value (like it's given in Maple), because I wrote a code for estimating this value, with the Monte-Carlo method, and wanted to be sure I had the correct answer.
So since I don't have maple, I wanted to try it with maxima

or is there a table of approximated values for the erfi function, like for the z-table erf function ?

4. Originally Posted by Moo
Yep, I had guessed that Maxima couldn't handle erfi.
But I wanted to be sure, if there wasn't a way to make it calculate.

As for the code... Actually, I was looking for a precise value (like it's given in Maple), because I wrote a code for estimating this value, with the Monte-Carlo method, and wanted to be sure I had the correct answer.
So since I don't have maple, I wanted to try it with maxima

or is there a table of approximated values for the erfi function, like for the z-table erf function ?

You do realise that a table of erfi will have been derived using a numerical technique (probably more elegant that the mid-point rule).

I will look erfi up in Abramowitz and Stegun when I get back to where my copy is stashed (or you could look for the online version for yourself).

CB

5. Originally Posted by Moo
Yep, I had guessed that Maxima couldn't handle erfi.
But I wanted to be sure, if there wasn't a way to make it calculate.

As for the code... Actually, I was looking for a precise value (like it's given in Maple), because I wrote a code for estimating this value, with the Monte-Carlo method, and wanted to be sure I had the correct answer.
So since I don't have maple, I wanted to try it with maxima

or is there a table of approximated values for the erfi function, like for the z-table erf function ?

In a word (two actually but who's counting) "Dawson's Integral" (it's tabulated in Abramowitz and Stegun (which is available online, you will need to Google for it)).

$\displaystyle F(x)=e^{-x^2}\int_0^x e^{\xi^2}~d\xi$

CB

6. Originally Posted by CaptainBlack
You do realise that a table of erfi will have been derived using a numerical technique (probably more elegant that the mid-point rule).

I will look erfi up in Abramowitz and Stegun when I get back to where my copy is stashed (or you could look for the online version for yourself).

CB
I know, I just wanted sure ways of approximating it.
Because our method consists in simulating random variables and then use the large of law numbers.
So we wanted to know if there was any flaw in our program ^^

In a word (two actually but who's counting) "Dawson's Integral" (it's tabulated in Abramowitz and Stegun (which is available online, you will need to Google for it)).

F(x)=e^{-x^2}\int_0^x e^{\xi^2}~d\xi

CB
Thanks