[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Axiom-developer] Question concerning types...
From: |
Ralf Hemmecke |
Subject: |
Re: [Axiom-developer] Question concerning types... |
Date: |
Sat, 16 Sep 2006 22:03:23 +0200 |
User-agent: |
Thunderbird 1.5.0.5 (X11/20060719) |
HI Cliff,
On 09/16/2006 07:18 PM, C Y wrote:
--- Martin Rubey <address@hidden> wrote:
Currently, you can't. Note that you promise axiom that a1 is a
Quaternion Fraction Integer. However, you don't hold your promise...
How do I not hold it? I never told it anything about a1 except what
type it is - were did I contradict this?
I don't know exactly what Martin meant with the promise, but think of
the following.
MachineInteger is in libaldor what SingleInteger is in Axiom. For a
particular element of that type you have exactly 32 bits.
Let's appreviate "macro I == MachineInteger;". Now, if you say
m: I;
in the interpreter, the interpreter has to take care of the fact that
this m does not have a value, since any of the 32 bits is reserved for
holding a true MachineInteger. Now assume you do simply
n: I := m + m;
then n does not have a value. However, there is a relation between m and
n. Where do you store that information? Certainly not in MachineInteger.
And hopefully also NOT in the interpreter. There should be a general
domain that handles such things. Something like a typed expression tree
which then could be used by the interpreter to figure out what you mean.
But to write such a domain, is another story.
BTW, why would you want typed variables in the first place?
What you wrote that looked to me like you want to replace the a_i later
with concrete values.
But looking at
m := matrix[[a1,a2],[a3,a4]]
maybe you want
Q == Quaternion Fraction Integer;
m(a1: Q, a2: Q, a3: Q, a4: Q): Matrix Q := matrix[[a1,a2],[a3,a4]];
???
If you want general solving facilities then you actually want m as a
variable and you need to tell the solver what your solution space is.
What you want is to make a1 a variable. Currently, there is no domain
of "Variables, which can take values only in Quaternion Fraction
Integer".
Um. That's surprising, at least to me. (I suppose it wouldn't be if I
understood...) Intuitively I would expect Variable to mean simply "an
unspecified specific instance of a Domain/Type/what have you" with ALL
domains being possible - just so long as you specify the type of the
variable, e.g.:
a1 : Variable(Matrix Quaternion Fraction Integer)
Ask yourself who should take care about the type knowledge that you give
here. Where would you store that information?
A specific example might be with working in dimensional types: If I
define F as type Force, m as type Mass, and a as type Length/Time^2 I
want to be able to define m1 as type Mass and enter the expression
m*a/m1 into the interperter to return a of type Length/Time^2 without
having to ever specify any particular mass or acceleration. But I want
that type information to be carried and used in the calculations - in
fact, it is essential.
Yes, that is possible. You know, we have discussed that already. We just
do not yet have proper code. The "dimension.as" file that I sent to the
list on 29-Aug-2006 is a first attempt but not as fully functional as
you would like. But don't worry, we come to that. However, I think that
it is not going to work in SPAD.
Ralf
- [Axiom-developer] Question concerning types..., C Y, 2006/09/16
- Re: [Axiom-developer] Question concerning types..., Martin Rubey, 2006/09/16
- Re: [Axiom-developer] Question concerning types..., C Y, 2006/09/16
- Re: [Axiom-developer] Question concerning types...,
Ralf Hemmecke <=
- Re: [Axiom-developer] Question concerning types..., Gabriel Dos Reis, 2006/09/16
- Re: [Axiom-developer] Question concerning types..., C Y, 2006/09/16
- Re: [Axiom-developer] Question concerning types..., Martin Rubey, 2006/09/16
- Re: [Axiom-developer] Question concerning types..., Ralf Hemmecke, 2006/09/16
- Re: [Axiom-developer] Question concerning types..., Gabriel Dos Reis, 2006/09/16
- Re: [Axiom-developer] Question concerning types..., Gabriel Dos Reis, 2006/09/16
- Re: [Axiom-developer] Question concerning types..., C Y, 2006/09/16
- Re: [Axiom-developer] Question concerning types..., Gabriel Dos Reis, 2006/09/16
- Re: [Axiom-developer] Question concerning types..., C Y, 2006/09/16
- Re: [Axiom-developer] Question concerning types..., Gabriel Dos Reis, 2006/09/17