Alasdair McAndrew wrote:
>
> I am enlarging Kurt and Bill's gsl.* function to include the gsl/gsll
> function integration-qag. This can be invoked, for example as
>
> )lisp (gsll:integration-qag (lambda (x) (exp (- (* x x)))) 0.0 1.0 :gauss21)
>
> where the final :gauss21 is one of a number of parameters which define the
> integration rule to be used.
>
> In my gsl.lisp file I have
>
> (defvar intrules (list ':gauss15 ':gauss21 ':gauss31 ':gauss41 ':gauss51
> ':gauss61))
>
> (defun integration-qag-list (f a b n)
> (multiple-value-list (integration-qag f a b (eval (nth n intrules)))))
>
> and in my corresponding gsl.spad:
>
> gslIntegrationQag(f,a,b,n) ==
> r:List DF:=INTEGRATION_-QAG_-LIST(mkLispFunction1(f@
> (DF->DF))$Lisp,a,b,n)$Lisp
> [r(1),r(2),r(3) pretend Integer]
>
> This all compiles OK. But in FriCAS:
>
> (1) -> gslIntegrationQag(x+->exp(-x^2),0.0,1.0,2)
>
> >> Error detected within library code:
> index out of range
>
> so clearly I've not set something up correctly - I suspect it's my
> cack-handed defvar list of parameters and my use of (nth n intrules). But
> I don't know why this isn't working, and what I should be doing instead.
Note that number 2 corresponds to :GAUSS31:
)lisp (defvar intrules (list ':gauss15 ':gauss21 ':gauss31 ':gauss41 ':ga)lisp
(defvar intrules (list ':gauss15 ':gauss21 ':gauss31 ':gauss41 ':gauss51
':gauss61))
Value = INTRULES
(1) -> )lisp (nth 2 intrules)
Value = :GAUSS31
AFAICS 'eval' in 'integration-qag-list' is not needed. But I do
not think this is reason for error. I would rather supect that
'integration-qag' returns less values than you expect. Anyway
in such situation I would do
)set break break
run the offending command
and then at Lisp debugger prompt (to avoid potentially too large
debugging printouts):
(setf sb-ext:*debug-print-variable-alist*
'((*print-array* . nil) (*print-length* . 10)))
Next:
backtrace
shows active calls and (if available) their arguments
--
Waldek Hebisch
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.