QROMB crashes IDL [message #13631] |
Sun, 22 November 1998 00:00 |
kjetikj
Messages: 2 Registered: March 1998
|
Junior Member |
|
|
Dear all!
I have an integral that I want to check if it converges or diverges,
and of course, if it converges, I want the value. They say it must be
evaluated numerically, so I figured I would try to solve it in IDL,
and see what happens.
Unfortunately, it seems that when the integral diverges, IDL crashes
with the following message:
% Program caused arithmetic error: Floating illegal operand
Floating exception
True, QROMB documentation says that: "It must be defined over the
closed interval [A, B].", and obviously, my integral is not defined
over the interval for some values. It would have been much nicer,
though, if it just gave me NaN or something instead of dying... :-)
What I am trying to do, is this (I have a bit more code, but this is
the minimal):
function Func, v
common cosmopar, sigma0, q0
return, 1.0/(sqrt(2 * sigma0 * v^3 + (1 + q0 - 3 * sigma0) * v^2 + sigma0 - q0))
end
function distanceint, A, B, sigma0, q0
common cosmopar, sigma, q
sigma = sigma0
q = q0
return, sqrt(abs(1.0 + q0 - 3 * sigma0)) * qromb('Func', A, B)
end
Running
IDL> print, distanceint(0,1,0,2)
should cause the error.
Don't know if there is anything that can be done about it, and I
haven't got very much experience or knowledge with IDL.
It is not _that_ difficult to analyze the problem, to find the areas
of convergence, but I was hoping IDL could solve the entire problem
for me... :-)
Anyway, I thought I should post a message about it, and any advice
is appreciated.
--
Vennlig Tiddeli-bom,
Kjetil
--
Kjetil Kjernsmo
Graduate astronomy-student Problems worthy of attack
University of Oslo, Norway Prove their worth by hitting back
E-mail: kjetikj@astro.uio.no - Piet Hein
Homepage <URL:http://www.astro.uio.no/~kjetikj/>
Webmaster@skepsis.no
|
|
|