James Amundson wrote:
> On Tue, 08 Jan 2008 12:22:29 -0500
> raymond.toy at ericsson.com (Raymond Toy (RT/EUS)) wrote:
>
>> I was wondering about implementing a keyword argument scheme.
>> Something like
>>
>> quad_qags(f,x,a,b, epsrel=1d-8, epsabs=1d-8, limit=500)
>
> I think that's a great idea. I've wanted that for a long time. It seems
> to me that
Hello, James! Long time no see!
Just a note that, as I have it implemented today, this is only supported
in Lisp. (Maxima functions can parse out the keywords itself.)
Basically quad_qags(f,x,a,b,epsrel=1d-8) is wrapper which eventually does
(apply 'quad-qags-internal f x a b $epsrel 1d-8)
and quad-qags-internal is a Lisp function:
(defun quad-qags-internal (f x a b &key (($epsrel epsrel) 1d-8))
<real implementation>)
So if call quad_qags(f,x,a,b,foobar=27), you get a Lisp error about an
unknown keyword $foobar. This could be changed so quad-qags-internal
allows other keywords but ignores them. This isn't so nice. Or a check
could be done (probably should be done) for valid keywords and a maxima
error is thrown instead of a Lisp error.
Oh, and you, of course, get weird results if you actually have a
variable called epsabs. Then you have to do quad_qags(..., 'epsabs = 1d-8).
Of course, my proposal changes the interface to the quadpack routines.
That's not usually a very nice thing to do to people. I assume,
however, that most people don't use the extra arguments today anyway,
but I could be wrong.
Ray