Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-11-13 Thread Waldek Hebisch
Ralf Hemmecke wrote: > > Well, if it were Aldor, you would have "keyword arguments". > See Section 6.3 of http://www.aldor.org/docs/aldorug.pdf . > I don't think that works in SPAD (yet). AFAIK this is quite different that Lisp "keyword arguments": in particular in Lisp everything is done at

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-11-12 Thread Mark Clements
A further change could be to integrate for an Expression using a SegmentBinding: )co gsl EF ==> Expression Float DF ==> DoubleFloat integrationQng(expr : EF, sb : SegmentBinding(EF)) : Record(result: DF, abserr: DF, neval: Integer) == (var, a, b) := (variable sb, lo segment sb, hi segment

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-11-04 Thread Ralf Hemmecke
Well, if it were Aldor, you would have "keyword arguments". See Section 6.3 of http://www.aldor.org/docs/aldorug.pdf . I don't think that works in SPAD (yet). However, what does the underlying GSL actually do? Do they allow optional parameters? Or have they different function(name)s? I actually

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-11-03 Thread Alasdair McAndrew
A few thoughts: 1. How do we allow for optional parameters (epsabs, epsrel, limit etc)? The approach taken by GSLL, and therefore by me in my version of gsl.spad was to overload the integration function, and to give values for the extra parameters when they weren't given by the user.

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-11-02 Thread Ralf Hemmecke
On 11/03/2015 12:51 AM, Alasdair McAndrew wrote: > By the way, where is "per" defined? >> (defun gslintegrationqng (per f a b) >> (apply (|mkLispFunction3| per) (multiple-value-list >> (gsl:integration-qng (|mkLispFunction1| f) a b >> ... >> >> -- gsl.spad >> ... >> integrationQng: (DF

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-11-02 Thread Alasdair McAndrew
Very nice! I have been trying to extend your (Bill's) original programs (with "pretend Integer") but these seem much nicer - although I don't fully understand how they work (nothing like starting from the bottom, is there?). You can also implement qagp - which requires a user-given list of

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-11-02 Thread Bill Page
On 2 November 2015 at 18:51, Alasdair McAndrew wrote: > > Very nice! I have been trying to extend your (Bill's) original programs (with > "pretend Integer") but these seem much nicer - Although there is no explicit use of 'pretend' there is still some implicit "pretending"

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-11-02 Thread Alasdair McAndrew
Yep: integrationQagp(x+->x^3*log(abs((x^2-1)*(x^2-2))),[0.0,1.0,sqrt(2.0),3.0]) returns the answer [result= 52.74074838347258,abserr= 1.3130161420349395e-6] Type: Record(result: DoubleFloat,abserr: DoubleFloat) which is correct. Note that the absolute error is set in

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-11-01 Thread Bill Page
Alasdair, Kurt and Waldek, I think I have found a reasonable way to avoid making too many assumptions in the Lisp code concerning the representation of data. The basic idea is the pass a function written in Spad to each Lisp wrapper function. I refer to this function as 'per' after the macros

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-31 Thread Alasdair McAndrew
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 wrote: > Alasdair McAndrew wrote: > > > > I am enlarging Kurt and Bill's gsl.* function to

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-30 Thread Waldek Hebisch
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

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-30 Thread Alasdair McAndrew
II am hoping for advice from folk higher up the food chain than me; I have an error message which is not helpful enough. 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)

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-29 Thread Bill Page
On 29 October 2015 at 05:17, Ralf Hemmecke wrote: > (7) -> PRETTYPRINT(r)$Lisp > #(2.0 3.0 17) > it looks as if a record is internally stored as a lisp vector, no? No not quite. That is a literal vector in Lisp. But you are right that this is the actual internal

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-29 Thread Bill Page
Sorry. Previous email should say: On 29 October 2015 at 12:20, Bill Page wrote: > On 29 October 2015 at 05:17, Ralf Hemmecke wrote: > >> (7) -> PRETTYPRINT(r)$Lisp >> #(2.0 3.0 17) >> it looks as if a record is internally stored as a lisp vector,

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-29 Thread Ralf Hemmecke
>> ; Return multiple values as a vector (can be interpreted as Axiom >> Record) (defun integration-qng-vector (f a b) (apply #'vector >> (multiple-value-list (integration-qng f a b > Yes. Let me just remark that the code above is fine for > experimantation. In long term we should not

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-29 Thread Alasdair McAndrew
A quick note: gsl.lisp and gsl.spad were originally written by Bill Page and made available on his site. So the fact that they work is entirely due to him. I have attempted to make some changes, but rather like barnacles on a ship's hull they don't do much except make the code more confusing. So

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-29 Thread Waldek Hebisch
Bill Page wrote: > > On 29 October 2015 at 05:17, Ralf Hemmecke wrote: > > > (7) -> PRETTYPRINT(r)$Lisp > > #(2.0 3.0 17) > > it looks as if a record is internally stored as a lisp vector, no? > > No not quite. That is a literal vector in Lisp. But you are right > that

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-29 Thread Bill Page
On 29 October 2015 at 18:56, Alasdair McAndrew wrote: > > A quick note: gsl.lisp and gsl.spad were originally written by Bill Page > and made available on his site. So the fact that they work is entirely due > to him. I have attempted to make some changes, but rather like

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-29 Thread Ralf Hemmecke
>> U==>Union(DoubleFloat, Integer) > (9) -> PRETTYPRINT(2::U)$Lisp > (0 . 2.0) > >(9) () > Type: SExpression When I look at this (1) -> DF==>DoubleFloat;Z==>Integer (2) -> R==>Record(result:DF, abserr:DF, neval:Integer) (6) -> r:

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-29 Thread Kurt Pagani
LOL, Alisdair was right: cui honorem, honorem My humble contribution is common lore ... the back-breaking work lies before you :) Am 30.10.2015 um 02:02 schrieb Bill Page: > On 29 October 2015 at 18:56, Alasdair McAndrew wrote: >> >> A quick note: gsl.lisp and gsl.spad were

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-29 Thread Alasdair McAndrew
Actually I don't know that gsll does fully solve the type problem. Gsll calls an FFI "groveller" method which does what it says: it "grovels" about and matches up types. So in a sense FFI does a great deal of the hard work and gsll is mainly a front end (although from my poking about the gsll

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-29 Thread Alasdair McAndrew
Good to see you know your Vulgate. I like a little historical literacy in a news group. On Fri, Oct 30, 2015 at 2:56 PM, Kurt Pagani wrote: > > LOL, Alisdair was right: cui honorem, honorem > My humble contribution is common lore ... the back-breaking work lies > before you

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-29 Thread Alasdair McAndrew
Yes, in fact the chain of programming goes Kurt, Bill, me. On a side issue, I note that gsll works by providing a wrapper for gsl using the Foreign Function Interface (which is why we need the ffi libraries). This means that the SPAD function in gsl.spad calls a lisp function in gsl.lisp which

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-29 Thread Bill Page
On 29 October 2015 at 21:31, Alasdair McAndrew wrote: > > On a side issue, I note that gsll works by providing a wrapper for gsl using > the Foreign Function Interface (which is why we need the ffi libraries). > This means that the SPAD function in gsl.spad calls a lisp function

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-29 Thread Waldek Hebisch
Bill Page wrote: > > On 29 October 2015 at 21:31, Alasdair McAndrew wrote: > > > > On a side issue, I note that gsll works by providing a wrapper for gsl using > > the Foreign Function Interface (which is why we need the ffi libraries). > > This means that the SPAD function in

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-28 Thread Ralf Hemmecke
> Does SPAD support optional arguments to functions? Aldor does, but to my knowledge SPAD does not. But you can overload function names, see below. Does that help? Ralf -- foo.spad )abbrev package FOO Foo Foo(T: Ring): with foo: T -> T foo: (T, T) -> T == add foo(x: T, y: T): T

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-28 Thread Alasdair McAndrew
I tried to define U==>Union(DoubleFloat, Integer) and then have the return list r to be of type U: r:List U:=... Then I thought r could happily include both DF's and integers. But it doesn't work in the way I hoped it would. Drat. On Wed, Oct 28, 2015 at 1:11 PM, Bill Page

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-27 Thread Alasdair McAndrew
Orright... two questions about https://github.com/billpage/gsla/blob/master/gsl.spad, and in particular the final three lines: gslIntegrationQng(f,a,b) == r:List DF:=INTEGRATION_-QNG_-LIST(mkLispFunction1(f@(DF->DF))$Lisp,a,b)$Lisp [r(1),r(2),r(3) pretend Integer] First the use of "pretend". As

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-27 Thread Waldek Hebisch
Alasdair McAndrew wrote: > > Orright... two questions about > https://github.com/billpage/gsla/blob/master/gsl.spad, and in particular > the final three lines: > > gslIntegrationQng(f,a,b) == > r:List DF:=INTEGRATION_-QNG_-LIST(mkLispFunction1(f@(DF->DF))$Lisp,a,b)$Lisp > [r(1),r(2),r(3) pretend

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-27 Thread Alasdair McAndrew
A quickie: ")read /home/amca/quicklisp/setup.lisp" works in FriCAS, but not in efricas. Why not? Also, the history mechanism in FriCAS in a console seems a bit odd: sometimes (well, often), a previous command, obtained using the arrow keys, will have extra characters, or chanrecters missing (I'm

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-27 Thread Bill Page
On 27 October 2015 at 19:55, Alasdair McAndrew wrote: > > Orright... two questions about > https://github.com/billpage/gsla/blob/master/gsl.spad, > and in particular the final three lines: > > gslIntegrationQng(f,a,b) == > r:List

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-27 Thread Bill Page
On 27 October 2015 at 20:41, Alasdair McAndrew wrote: > > A quickie: ")read /home/amca/quicklisp/setup.lisp" works in FriCAS, but not > in efricas. Why not? Hmmm, not sure. I usually don't use efricas (emacs drives me crazy). Maybe it is better to use something like )lisp

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-27 Thread Alasdair McAndrew
Does SPAD support optional arguments to functions? The default absolute error (as defined in gsll: calculus/numerical-integration.lisp) is only 1.0d-5. We might wish to decrease this error. In which case the definition of gslIntegrationQng in gsl.spad needs to include some optional arguments

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-27 Thread Waldek Hebisch
Alasdair McAndrew wrote: > > spad/boot/lisp insofar as they relate to PanAxiom development? I've been > looking over Kurt's gsl.lisp and gsl.spad and there are quite a few things > which confuse me. I won't list them, as it would be a depressingly long > list for two very short files... Why

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-27 Thread Bill Page
Alasdair, There is stuff to read such as Ralf suggests but in my opinion just hitting your head against something relevant hard enough for long enough is much more effective :) Kurt's example code is short enough not to cause much harm, so why not start just by asking one to two questions rather

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-26 Thread Kurt Pagani
That's very "ok" :) Unfortunately I have little time to contribute to this topic, but you know much more about these things anyway. I also had a glance over the FFI of OpenAxiom which Alfredo Portes posted recently here. Looks quite interesting but here too, I have to avoid frittering ;) I'll

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-26 Thread Kurt Pagani
Hello Bill, that's great. There is a lot in Lisp which is a "black spot" to me, especially this "multiple value" stuff. Since this also seems to be solved I think this could be a starting point. Thank you and best regards Kurt Am 26.10.2015 um 05:14 schrieb Bill Page: > Alasdair and Kurt, >

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-26 Thread Alasdair McAndrew
Now that Karl has provided a fantastic working template for an integration routine from QUADPACK/GSL/GSLL it should be possible to extend those files to incorporate some of the other routines. For the next few days I'll not have much time, but I'll aim to fiddle later in the week. And I might

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-26 Thread Bill Page
Here is a little design issue concerning names. Right now we have the example of 'gslIntegrationQng' and I have started to fill in some miscellaneous functions such as gslLookup: String -> Symbol ++ \spad{\gslLookup} finds GSLL function by GSL name and ++ displays some

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-26 Thread Bill Page
I just dropped this "proof-of-concept" level code into a repository at: https://github.com/billpage/gsla Title: GNU Scientific Library for Axiom (and FriCAS and OpenAxiom) I hope there are no objections or let me know. Please check it out and test it. Feel free to fork it, make changes, etc.

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-25 Thread Alasdair McAndrew
Sweet! Works beautifully (once I set my SBCL_HOME variable); one line will do it: (2) -> gslIntegrationQng(x+->exp(-x^2),0.0,1.0) And I suppose adding other routines is just a matter of more (include ...) lines in gsl.input and corresponding lines in gsl.spad? With regard to arbitrary

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-25 Thread Bill Page
You are FAST! That's amazing. Works exactly as advertised. Re qng: "The function returns the final approximation, result, an estimate of the absolute error, abserr and the number of function evaluations used, neval."

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-24 Thread Alasdair McAndrew
The more I read about Lisp the more difficult it seems. It would probably be just as easy for me to write a integrate.input file from scratch containing the Gauss-Kronrod code, rather than wrestling with a language of which I have little understanding, and no competence! On Sat, Oct 24, 2015 at

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-23 Thread Alasdair McAndrew
Well, I was just experimenting with one of the numerical integration routines from GSLL, the Lisp wrapper library for GSL: Gnu Scientific Laboratory. In plain lisp, I can, for example enter: *(ql:quickload "gsll") *(gsll:integration-qng (lambda (x) (exp (- (* x x 0.0 1.0) which produces

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-23 Thread Kurt Pagani
I'm trying to explain it as good as I can (experts will correct me): I see three different methods: 1. start your Lisp REPL (pref. SBCL) and try to load QuickLisp, FriCAS: - (load "~/quicklisp/setup.lisp") - (load "load-fricas.lisp") - (ql:quickload ... whatever you want to via QuickLisp) -

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-23 Thread Alasdair McAndrew
Just as an experiment I'm taking the quadpack.lisp file from the Maxima distribution, to see if I can install it and have it working under FriCAS. However, as a total Lisp newbie, I'm continuously stumped by trivial errors. For example, quadpack.lisp uses the f2cl-lib package. I can install this

Re: [fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-23 Thread Kurt Pagani
Hello Alasdair What I have completely forgotten to mention in the last post: In the fricas/contrib folder there is a file load-fricas.lisp which allows you to use FriCAS as a cl library itself. This way you can mix in any kind of library as long there is no interference to the "boot" package

[fricas-devel] Linking (lisp) libraries to FriCAS?

2015-10-22 Thread Alasdair
I was looking at some lisp numeric libraries: gsll at https://common-lisp.net/project/gsll/ (which is a wrapper for the Gnu Scientific Library GSL), as well as mjrcalc at http://www.mitchr.me/SS/mjrcalc/. I imagined that as these were Lisp libraries, there would be some way of integrating