)clear all mult(xs:LIST(INT)):EXPR(FLOAT)==reduce(*,[x-z for z in xs::LIST(INT)])
t4:=mult([20,5,1]) integ(f:EXPR(FLOAT),s:Segment(FLOAT)):FLOAT == -- simpsons a:=low(s) b:=high(s) fa:=eval(f,[x],[a]) fb:=eval(f,[x],[b]) fmid:=eval(f,[x],[(a+b)/2.]) result:=(b-a)/6.0 * (fa+4*fmid+fb) return result integ(t4,1.0..5.0) intm(xs:LIST(INT),a:FLOAT,b:FLOAT):FLOAT == g:=mult(xs) t1:=integ(g,a..b) return(t1) intm([20,5,1],1.0,5.0) Tim =============================================================== On 16 November 2015 at 19:39, Alasdair McAndrew <[email protected]> wrote: > Here's a minimum (non)-working example: I have a function which returns a > polynomial: > > mult(xs)== > return(reduce(*,[x-z for z in xs])) > > and I have another function which needs such a polynomial: > > intm(xs,a,b)== > g:=(x:Float):Float+->mult(xs) > return(numeric(integrate(g(x),x=a..b))) > > which doesn't work. I've tried replacing the second line with > > function(mult(xs),g,x) > > which works on the command line, but not in a function. Any ideas as to > how I can get over this hump? _______________________________________________ Axiom-developer mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/axiom-developer
