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, > > Here is one way to deal with multiple return values: > > (1) -> )co gsl > Compiling FriCAS source code from file /home/wspage/gsl.spad using > old system compiler. > ------------------------------------------------------------------------ > gsl is now explicitly exposed in frame frame1 > gsl will be automatically loaded when needed from > /home/wspage/GSL.NRLIB/GSL > > (1) -> )r gsl-test > DF ==> DoubleFloat > > Type: Void > f:=(x:DF):DF+->exp(-x^2) > > > (2) theMap(*1;anonymousFunction;0;frame1;internal) > Type: (DoubleFloat -> DoubleFloat) > gslIntegrationQng(f,0.0::DF,1.0::DF) > > > (3) [result= 0.7468241328124271,abserr= 8.291413475940725e-15,neval= 21] > Type: Record(result: DoubleFloat,abserr: DoubleFloat,neval: Integer) > (4) -> > > --- > > In the revised files attached 'integration-qng-list' is a wrapper > routine that just returns the multiple values as a list of values. > Since lists are homogeneous in FriCAS we then have to sort out the > actual types of the result for SPAD in gslIntegrationQng and in this > example return it as a record. > > --- > > Yes, adding other routines should be easy. The hard part of passing > FriCAS functions was done by Kurt (he just made it look easy! :) > > I agree that arbitrary precision is indeed another issue and in my > opinion, in general not so interesting. > > More tomorrow when I get a chance. I am wondering now about how best > to make GSL a permanent addition to FriCAS. Perhaps Waldek can advise. > > Bill. > > On 25 October 2015 at 23:10, Alasdair McAndrew <amc...@gmail.com> wrote: >> 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 precision, that might be another issue. However, I >> was recommended that it may be better to "roll our own" in which case the >> method of choice is probably tanh-sinh integration, which has all of the >> advantages of Gauss Kronrod (nested rules for error analysis) and is far >> easier to implement. See >> http://crd-legacy.lbl.gov/~dhbailey/dhbpapers/dhb-tanh-sinh.pdf for some >> details. >> >> On Mon, Oct 26, 2015 at 1:54 PM, Bill Page <bill.p...@newsynthesis.org> >> wrote: >>> >>> 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." >>> >>> >>> https://www.gnu.org/software/gsl/manual/html_node/QNG-non_002dadaptive-Gauss_002dKronrod-integration.html >>> >>> This is great. >>> >>> Bill. >>> > -- 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.