A question about numerical-integration.lisp

Alasdair McAndrew amca01 at gmail.com
Sun Nov 1 22:31:45 UTC 2015


Thank you very much!  It seems that grid (antik) is automatically loaded
with gsll by quicklisp.  But that doesn't seem to be the problem: both

(grid:copy-to (vector 0.0d0 1.0d0 (sqrt 2.0d0) 3.0d0))

and

(vector 0.0d0 1.0d0 (sqrt 2.0d0) 3.0d0)

seem to give the same result - which should be the endpoints and
singularities for computation of a numerical integral by use of the GSL
QUADPACK routine QAGP, implemented in gsll as integration-qagp.  But the
command

(gsll:integration-QAGp 'integration-test-f454 (grid:copy-to (vector 0.0d0
1.0d0 (sqrt 2.0d0) 3.0d0)) 0.0d0 1.0d-3 1000))

fails with a slew of errors.  The debugger's first backtrace is

 ((:METHOD NO-APPLICABLE-METHOD (T)) #<STANDARD-GENERIC-FUNCTION
GRID:FOREIGN-POINTER (1)> #(0.0 1.0 1.4142135623730951 3.0)) [fast-method]

Given that the grid command above works without any errors, I don't
understand this at all.  But then, as I say, I seem to have programmed in
many languages over the years - with the lamentable absence of lisp.  So if
my questions seem trivial and naive, my apologies!

Thanks again,
Alasdair

On Mon, Nov 2, 2015 at 12:15 AM, David Catteeuw <davidcatteeuw at gmail.com>
wrote:

> Hi Alasdair,
>
> I guess grid refers to Antik's grids, a data type for matrices:
> https://www.common-lisp.net/project/antik/
> <https://www.common-lisp.net/project/antik/#documentation>
>
> Regards,
> david.
>
> <https://www.common-lisp.net/project/antik/#documentation>
>
> On Sunday, 1 November 2015, Alasdair McAndrew <amca01 at gmail.com> wrote:
>
>> Hello,
>>
>> I am using the excellent gsll package (in the first instance), to provide
>> an interface to quadpack for the mathematics system FriCAS.  I'm slowly
>> going through calculus/numerical-integration.lisp one function at a time
>> and writing each one into FriCAS as I go.  This means writing functions in
>> FriCAS's own language SPAD which interface with gsll.
>>
>> This is made harder by me being a lisp newbie.
>>
>> However, I've come to integration-QAGP, and I've tried to run the test
>> command (having first defined the function it calls).  However, all I get
>> is errors.
>>
>> I'm using SBCL in emacs-slime, and I have installed gsll with quicklisp,
>> so that I can call an integration routine with
>>
>> * (gsll:integration-qng (lambda (x) (exp (- (* x x)))) 0.0 1.0)
>>
>> But the commands
>>
>> * (defun integration-test-f454 (x)
>>   (* (expt x 3) (* (log (abs (* (- (expt x 2) 1.0d0) (- (expt x 2)
>> 2.0d0)))))))
>>
>> * (gsll:integration-QAGp
>>   'integration-test-f454
>>   (grid:copy-to (vector 0.0d0 1.0d0 (sqrt 2.0d0) 3.0d0))
>>   0.0d0 1.0d-3 1000)
>>
>> just produces a long list of errors. Is "grid" a standard library, or
>> does it need to be loaded first?  (Told you I was a newbie...)
>>
>> Thanks
>> Alasdair
>> --
>> [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>
>>
>


-- 
[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>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/gsll-devel/attachments/20151102/d351ac67/attachment.html>


More information about the gsll-devel mailing list