Alasdair,
Here is one solution:
(1) -> )r alas1.input
mult(xs:List Expression Integer):Expression Integer == reduce(*,[x-z for z
in xs])
Function declaration mult : List(Expression(Integer)) -> Expression(
Integer) has been added to workspace.
Type:
Void
intm(xs,a,b) == integrate(mult(xs),x=a..b)
Type:
Void
(3) -> mult([x1,x2])
Compiling function mult with type List(Expression(Integer)) ->
Expression(Integer)
2
(3) (x1 - x)x2 - x x1 + x
Type:
Expression(Integer)
(4) -> intm([x1,x2,x3],1,2)
Compiling function intm with type (List(OrderedVariableList([x1,x2,
x3])),PositiveInteger,PositiveInteger) -> Union(f1:
OrderedCompletion(Expression(Integer)),f2: List(OrderedCompletion
(Expression(Integer))),fail: failed,pole: potentialPole)
((- 12x1 + 18)x2 + 18x1 - 28)x3 + (18x1 - 28)x2 - 28x1 + 45
(4) -----------------------------------------------------------
12
Type: Union(f1:
OrderedCompletion(Expression(Integer)),...)
Bill Page.
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?
>
> 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>
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/fricas-devel.
> For more options, visit https://groups.google.com/d/optout.
>
_______________________________________________
Axiom-mail mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/axiom-mail