Re: qsimp, qromb, qromo [message #39621] |
Thu, 03 June 2004 14:17  |
mmeron
Messages: 44 Registered: October 2003
|
Member |
|
|
In article <b3eff7b0.0406031146.1be4bb29@posting.google.com>, gnarloo@libero.it (michele) writes:
> Dear all,
> I'm new to this newsgroup so first of all, hello everybody!
>
> The problem i encountered is the following:
>
> I tried to use
> qsimp and qromb to integrate a couple of functions (scattering
> problems, nothing special) but the system crashes..
>
> I tried to integrate cos(x) between 0 and pi (the result is obviously
> zero)
> and these functions give out some kind of error message but not the
> result..
>
> so i turned to write the code myself as i used to do when i was an
> undrgraduate student using old riemann sums and old fortran, but as
> this approach is a bit time-consuming i have one question:
>
> is there any trick I can use or these functions only sometimes work?
> (for example if you integrate sin(x) on the same interval as above
> they give out
> the right result.
>
> Personally I can't believe the problem is in the algorithm (Simpson
> rule works, Romberg method I don't know it)...
>
I'm not much familiar with IDL's implementation of Romberg's method
since I'm using my own. So, from my own experience, I can attest that
Romberg, when properly implemented, works beautifully.
Mati Meron | "When you argue with a fool,
meron@cars.uchicago.edu | chances are he is doing just the same"
|
|
|
Re: qsimp, qromb, qromo [message #39625 is a reply to message #39621] |
Thu, 03 June 2004 13:29   |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
gnarloo@libero.it (michele) writes:
> Dear all,
> I'm new to this newsgroup so first of all, hello everybody!
>
> The problem i encountered is the following:
>
> I tried to use
> qsimp and qromb to integrate a couple of functions (scattering
> problems, nothing special) but the system crashes..
I've never found the IDL integration routines to be particular useful.
You might try my adaptive routine, QPINT1D. Which is based on the
tried and trusted library called Quadpack.
> I tried to integrate cos(x) between 0 and pi (the result is obviously
> zero)
> and these functions give out some kind of error message but not the
> result..
Example:
print, qpint1d('cos(x)', /expression, 0d, !dpi)
4.7089631e-17
...which is as close to zero as you are practically going to get.
Of course, you can also integrate pure IDL functions rather than IDL
expressions, but the /EXPRESSION option can be very useful at the
command line.
Craig
http://cow.physics.wisc.edu/~craigm/idl/idl.html (under Mathematics)
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
Re: qsimp, qromb, qromo [message #39795 is a reply to message #39621] |
Thu, 10 June 2004 11:21  |
gnarloo
Messages: 14 Registered: June 2004
|
Junior Member |
|
|
dear craig thanks very much for your answer
and for all the routines you made available on your web site.
just one more favour,
do you know an alternative to IDL standard routine to find eigenvectors and
eigenvalues of a complex symmetric matrix (real on the diagonal and
complex conjugate elsewhere??)
it sometimes crashes...
thanks in advance.
michael
|
|
|