[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Axiom-developer] Question concerning types...
From: |
C Y |
Subject: |
Re: [Axiom-developer] Question concerning types... |
Date: |
Sat, 16 Sep 2006 13:54:24 -0700 (PDT) |
--- Ralf Hemmecke <address@hidden> wrote:
> HI Cliff,
Hey Ralf.
> 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.
Wouldn't that information be associated with the variable n?
> 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.
I must be thinking about this incorrectly. I was thinking along these
lines:
m : I; -- Creates a Variable with type MachineInteger. m doesn't
-- reserve space for a value in this form because there is
-- no value - not until an actual value is assigned is the
-- space needed.
m := 3; -- Assigns a specific value to m. m internally is coerced
-- to a structure which holds not only the type information
-- as above but also a specific value
n: I := m + m; -- If m is defined only as m : I, this creates a
-- variable with type MachineInteger and a value that
-- is a function of m
> BTW, why would you want typed variables in the first place?
The use that came up on IRC was working with Quaternion matrix elements
and solving a matrix system to find equations, IIRC. More generally,
mightn't one expect that things like solve algorithms and integration
would be able to use specific type information on variables to arrive
at more specific solutions than more general algorithms could find?
> What you wrote that looked to me like you want to replace the a_i
> later with concrete values.
Possible, but also the intent might be to solve for a general symbolic
equation.
> 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]];
>
> ???
Depending on the application, that is another potential use - when I
tried those two lines though, here's what happened:
AXIOM Computer Algebra System
Version: Axiom (September 2006)
Timestamp: Saturday September 9, 2006 at 11:29:25
-----------------------------------------------------------------------------
Issue )copyright to view copyright notices.
Issue )summary for a summary of useful system commands.
Issue )quit to leave AXIOM and return to shell.
-----------------------------------------------------------------------------
Re-reading compress.daase Re-reading interp.daase
Re-reading operation.daase
Re-reading category.daase
Re-reading browse.daase
(1) ->
(1) -> Q == Quaternion Fraction Integer;
Type: Void
(2) -> m(a1: Q, a2: Q, a3: Q, a4: Q): Matrix Q :=
matrix[[a1,a2],[a3,a4]];
2) ->
Q is not a valid type.
(2) -> Q
Compiling body of rule Q to compute value of type Domain
Loading /usr/local/axiom/mnt/linux/algebra/INT.o for domain Integer
Loading /usr/local/axiom/mnt/linux/algebra/FRAC.o for domain
Fraction
Loading /usr/local/axiom/mnt/linux/algebra/QUAT.o for domain
Quaternion
>> System error:
Caught fatal error [memory may be damaged]
(2) -> m(a1: Q, a2: Q, a3: Q, a4: Q): Matrix Q :=
matrix[[a1,a2],[a3,a4]];
2) ->
Q is not a valid type.
> 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.
The problem, as described to me, was having three matrices A, B and C.
C is known. The goal was to choose the elements of one of A or B then
look for equations coming from AB-BA = C. The elements of A and B are
quaternion.
The person who asked the original question subscribed to the list, so
perhaps they can supply more details.
> > 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?
As part of the structure associated with the variable name a1. Perhaps
I am thinking about Variable incorrectly?
> Yes, that is possible. You know, we have discussed that already. We
> just do not yet have proper code.
Yes. I was just using it as an illustration because that is the
problem domain where I am most familiar with the issue ;-). There are
probably other cases besides that one where such logic would be useful.
> 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.
I'm inclined to agree. Anyway, that was just an illustration of a more
general question. Maybe another case would be integration - if you
know you are only dealing with positive integers as opposed to all
integers couldn't you deal with some integrals that you couldn't
otherwise deal with, in cases where the function isn't well behaved in
the negative numbers but is in the positive?
Cheers,
Cliff
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
- [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, 2006/09/16
- Re: [Axiom-developer] Question concerning types..., Gabriel Dos Reis, 2006/09/16
- Re: [Axiom-developer] Question concerning types...,
C Y <=
- 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
- Re: [Axiom-developer] Question concerning types..., Martin Rubey, 2006/09/17
- Re: [Axiom-developer] Question concerning types..., Vanuxem GrĂ©gory, 2006/09/16