Using a polynomial inside a function
Alasdair McAndrew <[email protected]> Tue, 17 Nov 2015 11:39:53 +1100
| Newsgroups | gmane.comp.mathematics.axiom.user |
|---|---|
| Message-ID | <CAPGiC76-KQYDpjRed5S_mhpuP2fjJVrFDoOx0mxT0r6C6Khnxw@mail.gmail.com> |
--===============6557924328243380974== Content-Type: multipart/alternative; boundary=001a11438160a683270524b1c377 --001a11438160a683270524b1c377 Content-Type: text/plain; charset=UTF-8 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? ever confused, 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> --001a11438160a683270524b1c377 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div><div><div><div><div><div><div><div><div><div><div>Her= e's a minimum (non)-working example: I have a function which returns a = polynomial:<br><br></div>mult(xs)=3D=3D<br></div>=C2=A0 return(reduce(*,[x-= z for z in xs]))<br><br></div>and I have another function which needs such = a polynomial:<br><br></div>intm(xs,a,b)=3D=3D<br></div>=C2=A0 g:=3D(x:Float= ):Float+->mult(xs)<br></div>=C2=A0 return(numeric(integrate(g(x),x=3Da..= b)))<br><br></div>which doesn't work.=C2=A0 I've tried replacing th= e second line with<br><br></div>=C2=A0 function(mult(xs),g,x)<br><br></div>= which works on the command line, but not in a function.=C2=A0 Any ideas as = to how I can get over this hump?<br><br></div>ever confused,<br></div>Alasd= air<br clear=3D"all"><div><div><div><div><div><div><div><div><div><div><div= ><div><br>-- <br><div class=3D"gmail_signature"><div dir=3D"ltr"><a href=3D= "http://www.facebook.com/alasdair.mcandrew" target=3D"_blank"><img alt=3D"h= ttp://www.facebook.com/alasdair.mcandrew" src=3D"https://dl.dropboxusercont= ent.com/u/2796170/facebook.png"></a> <a href=3D"https://plus.google.com/+Al= asdairMcAndrew/posts" target=3D"_blank"><img alt=3D"https://plus.google.com= /+AlasdairMcAndrew/posts" src=3D"https://dl.dropboxusercontent.com/u/279617= 0/f-gplus_256-48.png"></a> <a href=3D"https://www.linkedin.com/pub/alasdair= -mcandrew/a/178/108" target=3D"_blank"><img alt=3D"https://www.linkedin.com= /pub/alasdair-mcandrew/a/178/108" src=3D"https://dl.dropboxusercontent.com/= u/2796170/linkedin.png"></a> <a href=3D"https://twitter.com/amca01" target= =3D"_blank"><img alt=3D"https://twitter.com/amca01" src=3D"https://dl.dropb= oxusercontent.com/u/2796170/twitter.png"></a> <a href=3D"http://numbersands= hapes.net" target=3D"_blank"><img alt=3D"http://numbersandshapes.net" src= =3D"https://dl.dropboxusercontent.com/u/2796170/wordpress.png"></a><br></di= v></div> </div></div></div></div></div></div></div></div></div></div></div></div></d= iv> --001a11438160a683270524b1c377-- --===============6557924328243380974== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Axiom-mail mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/axiom-mail --===============6557924328243380974==--