Re: Quadrature problem
- From: "John D'Errico" <woodchips@xxxxxxxxxxxxxxxx>
- Date: Sun, 10 Feb 2008 18:59:02 +0000 (UTC)
roberson@xxxxxxxxxxxxxxxxxx (Walter Roberson) wrote in message
<fonfre$r42$1@xxxxxxxxxxxxxxxxxxxxxxx>...
In article <fonf2t$sdu$1@xxxxxxxxxxxxxxxxxx>,
Dmitriy <dmuravy2@xxxxxxxx> wrote:
Code below seems don't work any more
f = inline('r.*exp(-r.^2).*exp(r)')
[int,tol] = gaussq(f,0,inf,[.0000001,8])
??? Matrix index is out of range for deletion.
Error in ==> gaussq at 142
P0(1:istart)=[];
The context for this seems to have disappeared; perhaps it is
a very old thread.
Is there a particular reason you are using exp(-r.^2).*exp(r)
instead of the equivilent exp(-r) ? Assuming, that is,
Um, it is not true that
exp(-r.^2).*exp(r) == exp(-r)
There is a difference, and it is not just at
the LSB level. Please read through this
reference for a decent explanation of the
exponential function.
http://en.wikipedia.org/wiki/Exponential_function
that r is not in the range that you *want* -r^2 or exp(-r^2)
to underflow to 0 where exp(-r) would not?
Also, is there a particular reason (e.g., using an older Matlab)
that you are using inline instead of an anonymous function?
(If you were to change these two things, I would not expect
the error to go away; I do not know what the error is caused by.)
The poster wishes to compute a moment,
in this case, the first moment, of a gaussian
function, over a half infinite interval. The
approach was to use a numerical integration,
a Gauss-Laguerre method for integration
over the half infinite domain [0,inf].
John
.
- Follow-Ups:
- Re: Quadrature problem
- From: Walter Roberson
- Re: Quadrature problem
- References:
- Re: Quadrature problem
- From: Dmitriy
- Re: Quadrature problem
- From: Walter Roberson
- Re: Quadrature problem
- Prev by Date: Re: Fortran MEX - Visul Studio Linker
- Next by Date: Re: Fortran MEX - Visul Studio Linker
- Previous by thread: Re: Quadrature problem
- Next by thread: Re: Quadrature problem
- Index(es):
Relevant Pages
|