axiom-developer
[Top][All Lists]
Advanced

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

Re: [Axiom-developer] Question concerning types...


From: Gabriel Dos Reis
Subject: Re: [Axiom-developer] Question concerning types...
Date: 17 Sep 2006 07:12:54 +0200

C Y <address@hidden> writes:

| --- Gabriel Dos Reis <address@hidden> wrote:
| 
| > | > But you want it to hold a token of some type.  That is a
| > | > different story.
| > | 
| > | Surely that isn't a surprising way to want to use a CAS?
| > 
| > Not really.  You did not say you wanted "n" to be a symbol; you want
| > it to designate some *value*.
| 
| Yes and no.  I want it to be a variable, but a variable of a specific
| type. 

You have to distinguish between "variable of specific type" from
"symbol substituable with values of specifc type".  The former
designates values -- i.e. computations are really done -- whereas the
later has to indicate to the compiler or interpreter to "remember" --
i.e. construct suspession -- for the computation.

| So rather than just saying x is "something" I say it is "some
| integer" or "some float".  I thought I was saying that, but apparently
| not - do I understand correctly that what I thought I was saying in
| fact cannot be said in Axiom at this time?

That is my understanding.

| > There is a difference between a symbol and an Integer.
| > 
| > What you want, if I understand your manipulation correctly, is to use
| > symbols, and only later subsitute some values for those symbols.
| 
| Right.
| 
| > And you want to make sure that the symbols are interpreted in some
| > ways. But, you can't say that directly in the Axiom type system. 
| > Because Axiom does not attach advanced types to symbols.
| 
| Is there a reason it does not, or is just something that hasn't been
| implemented?

I don't know whether there is a good reason why it has been
implemented -- I can explain why it does not work the way you want,
but I have not investigated the feasability of the "solution."

| > Yes.  Notice that in that context "x" is interpreted as *symbol*, not
| > as a value.  Your declaration of "n" said it should be interpreted as
| > standing for a value, but you did not say which.
| 
| So what I want then, using your terminology, would be a way to declare
| a symbol to have a Type.  The reason a1 : MachineInteger produces the
| expectation of a value is that Axiom simply doesn't support a symbol
| with a Type, and so that assignment carries with it the assumption that
| a1 now has some specific value?

a1 : MachineInteger tells Axiom that somewhere down a1 will designate
an object allocated to hold value of type MachineInteger.  There is 
the domain constructor Expression which you could try to use.
However, I seem to remember Ralf telling people that they should never
ever enter EXPR T in Axiom; so without knowing what you do futher with
your matrix I can't say the EXPR domain constructor is a good way to go;
you have to try.

Going back to your original example, here is what I have:


(3) -> a1 : EXPR Quaternion Fraction Integer
                                                                   Type: Void
(4) -> a2 : EXPR Quaternion Fraction Integer
                                                                   Type: Void
(5) -> a3 : EXPR Quaternion Fraction Integer
                                                                   Type: Void
(6) -> a4 : EXPR Quaternion Fraction Integer
                                                                   Type: Void
(7) -> m := matrix[[a1,a2], [a3, a4]]       
   Loading /usr/local/axiom/mnt/linux/algebra/MATRIX.o for domain 
      Matrix 
   Loading /usr/local/axiom/mnt/linux/algebra/VECTOR.o for domain 
      Vector 
   Loading /usr/local/axiom/mnt/linux/algebra/IIARRAY2.o for domain 
      InnerIndexedTwoDimensionalArray 
   Loading /usr/local/axiom/mnt/linux/algebra/MATCAT-.o for domain 
      MatrixCategory& 

   Loading /usr/local/axiom/mnt/linux/algebra/ARR2CAT-.o for domain 
      TwoDimensionalArrayCategory& 
   Loading /usr/local/axiom/mnt/linux/algebra/UDPO.o for package 
      UserDefinedPartialOrdering 
   Loading /usr/local/axiom/mnt/linux/algebra/SUP2.o for package 
      SparseUnivariatePolynomialFunctions2 
   Loading /usr/local/axiom/mnt/linux/algebra/UPOLYC2.o for package 
      UnivariatePolynomialCategoryFunctions2 
        +a1  a2+
   (7)  |      |
        +a3  a4+
                          Type: Matrix Expression Quaternion Fraction Integer



HTH.

| Ouch.  There are many cases where one tries to solve a problem to
| arrive at a symbolic equation, not a value.

Yes.

| If Axiom makes this difficult that's going to be a real problem.

I thought that was supposed to be the _strenght_ of Axiom :-/
(see related recent discussion with Bill on this list)

| As long as I'm asking basic questions, just how would I go about
| defining a function f(x) that took the expression produced by
| integrating(1/(1+x^4),x) and numerically evaluated it for the given
| value of x?  

eval()

-- Gaby




reply via email to

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