Oops - yes you are quite right!  The function integration-qag only returns
two values, not three.

Thanks very much!

-Alasdair

On Sat, Oct 31, 2015 at 3:58 PM, Waldek Hebisch <hebi...@math.uni.wroc.pl>
wrote:

> 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 a topic in the
> Google Groups "FriCAS - computer algebra system" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/fricas-devel/q18Av7P3jnM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> fricas-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to fricas-devel@googlegroups.com.
> Visit this group at http://groups.google.com/group/fricas-devel.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
[image: http://www.facebook.com/alasdair.mcandrew]
<http://www.facebook.com/alasdair.mcandrew> [image:
https://plus.google.com/+AlasdairMcAndrew/posts]
<https://plus.google.com/+AlasdairMcAndrew/posts> [image:
https://www.linkedin.com/pub/alasdair-mcandrew/a/178/108]
<https://www.linkedin.com/pub/alasdair-mcandrew/a/178/108> [image:
https://twitter.com/amca01] <https://twitter.com/amca01> [image:
http://numbersandshapes.net] <http://numbersandshapes.net>

-- 
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 fricas-devel+unsubscr...@googlegroups.com.
To post to this group, send email to fricas-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to