axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] [Axiom-mail] beginner question about sum(...)


From: Bill Page
Subject: [Axiom-developer] [Axiom-mail] beginner question about sum(...)
Date: Sun, 23 Jan 2005 13:21:07 -0600

Kostas,

On Sunday, January 23, 2005 11:08 AM you wrote:
> 
> I am trying to make Axiom evaluate sum(1/k^2, k=1..n).  It 
> returns the sum unevaluated.  I suspect that I should be
> using the sum functions defined in package SUMRF,
> RationalFunctionSum, but how do I make Axiom use those
> functions?  For example, I tried
> 
> (1) -> sum(1/k^2, k=1..n)$SUMRF
> 
>   Although RationalFunctionSum is the name of a constructor,
>   a full type must be specified in the context you have used
>   it. Issue
>        )show RationalFunctionSum for more information.
> (1) ->
> 
> I don't understand what I have to do here.

You should follow the instructions that Axiom gives you. :)

)show RationalFunctionSum

says:

(2) -> )show RationalFunctionSum
 RationalFunctionSum R: Join(IntegralDomain,OrderedSet,
    RetractableTo Integer) is a package constructor
 Abbreviation for RationalFunctionSum is SUMRF
 This constructor is exposed in this frame.
 Issue )edit C:/Program Files/axiom/mnt/windows/../../src/algebra/SUMRF.spad
 to see algebra source code for SUMRF

------------------------------- Operations --------------------------------
 sum : (Polynomial R,Symbol) -> Fraction Polynomial R
 sum : (Fraction Polynomial R,Symbol) ->
       Union(Fraction Polynomial R,Expression R)
 sum : (Polynomial R,SegmentBinding Polynomial R) ->
       Fraction Polynomial R
 sum : (Fraction Polynomial R,SegmentBinding Fraction Polynomial R) ->
        Union(Fraction Polynomial R,Expression R)

--------

If you look carefully you will see that RationalFunctionSum requires
a paramter R that is one of IntegralDomain, OrderedSet, or at least
RetractableTo Integer

 RationalFunctionSum R: Join(IntegralDomain,OrderedSet,
                             RetractableTo Integer)

So try this:

(1) -> sum(1/k^2, k=1..n)$SUMRF INT

         n
        --+    1
   (1)  >     --
        --+    2
        k= 1  k
                                 Type: Union(Expression Integer,...)
(2) ->




>  My understanding of Axiom's types, domains, and packages is
> limited, but shouldn't sum(...) be smart enough by itself to
> invoke the right "sum"?

First, it is important to remember that Axiom types often have
parameters. SUMRF is a "constructor" - that means that it is a
"function" that expects to take as a parameter another type,
e.g. RationalFunctionSum(Integer), and returns a new type.

Second, there are many different "sum" functions in Axiom,
each with a different signature. Sometimes you have to specify
exactly which one you mean.

(2) -> )display op sum

There are 6 exposed functions called sum :
   [1] (D1,Symbol) -> D1 from FunctionSpaceSum(D3,D1)
            if D3 has Join(IntegralDomain,OrderedSet,RetractableTo
            Integer,LinearlyExplicitRingOver Integer) and D1 has Join(
            FunctionSpace D3,CombinatorialOpsCategory,
            AlgebraicallyClosedField,TranscendentalFunctionCategory)

   [2] (D1,SegmentBinding D1) -> D1 from FunctionSpaceSum(D3,D1)
            if D1 has Join(FunctionSpace D3,CombinatorialOpsCategory,
            AlgebraicallyClosedField,TranscendentalFunctionCategory)
            and D3 has Join(IntegralDomain,OrderedSet,RetractableTo
            Integer,LinearlyExplicitRingOver Integer)
   [3] (Polynomial D4,Symbol) -> Fraction Polynomial D4
            from RationalFunctionSum D4
            if D4 has Join(IntegralDomain,OrderedSet,RetractableTo
            Integer)
   [4] (Fraction Polynomial D4,Symbol) -> Union(Fraction Polynomial D4,
            Expression D4)
            if D4 has Join(IntegralDomain,OrderedSet,RetractableTo
            Integer)
   [5] (Polynomial D4,SegmentBinding Polynomial D4) -> Fraction
            Polynomial D4
            from RationalFunctionSum D4
            if D4 has Join(IntegralDomain,OrderedSet,RetractableTo
            Integer)
   [6] (Fraction Polynomial D4,SegmentBinding Fraction Polynomial D4)
             -> Union(Fraction Polynomial D4,Expression D4)
            from RationalFunctionSum D4
            if D4 has Join(IntegralDomain,OrderedSet,RetractableTo
            Integer)

There are 5 unexposed functions called sum :
   [1] (D2,D3,Segment D2) -> Record(num: D2,den: Integer)
            from InnerPolySum(D5,D3,D6,D2)
            if D2 has POLYCAT(D6,D5,D3) and D5 has OAMONS and D3 has
            ORDSET and D6 has INTDOM
   [2] (D2,D3) -> Record(num: D2,den: Integer) from InnerPolySum(D4,D3,
            D5,D2)
            if D4 has OAMONS and D3 has ORDSET and D5 has INTDOM and D2
            has POLYCAT(D5,D4,D3)
   [3] (OutputForm,OutputForm,OutputForm) -> OutputForm from OutputForm

   [4] (OutputForm,OutputForm) -> OutputForm from OutputForm
   [5] OutputForm -> OutputForm from OutputForm
(2) ->

----------

But if you don't need to specify which one, Axiom can often make
a reasonable choice based on default assumptions about types.

(2) -> sum(1/k^2, k=1..n)

         n
        --+    1
   (2)  >     --
        --+    2
        k= 1  k
                                          Type: Union(Expression
Integer,...)
(3) ->

-----------

Regards,
Bill Page.



_______________________________________________
Axiom-mail mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/axiom-mail

--
forwarded from http://page.axiom-developer.org/zope/mathaction/address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]