[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [Axiom-developer] Question concerning types...
From: |
Bill Page |
Subject: |
RE: [Axiom-developer] Question concerning types... |
Date: |
Sun, 17 Sep 2006 01:00:06 -0400 |
On September 16, 2006 12:41 PM C Y wrote:
> ...
> a1 is declared as being in Quaternion Fraction Integer
> but has not been given a value.
> (5) ->
>
> Why isn't this allowed? I want a1->a4 to be variables without
> assigned value, and I want to create a symbolic matrix where all
> I know about the entries is their type, in order to do general
> solving operations. How would I set this up correctly in Axiom?
>
This subject has come up before.
Tim Daly has referred to this sort of thing as "indefinites". See
for example the email messages in this thread deal specifically
with the issue you raise above:
http://lists.nongnu.org/archive/html/axiom-developer/2004-06/msg00212.html
It is also mentioned here:
http://lists.nongnu.org/archive/html/axiom-developer/2004-12/msg00520.html
And here:
http://wiki.axiom-developer.org/84
and
http://lists.nongnu.org/archive/html/axiom-mail/2005-05/msg00037.html
On September 16, 2006 12:51 PM Martin Rubey wrote:
> ...
> Note that you promise axiom that a1 is a Quaternion Fraction Integer.
> However, you don't hold your promise...
>
> 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".
>
> In fact, it is (or should be) a FAQ. See MathAction.
>
> The point of Axioms type system is that any identifier has a
> typed value. There is no such thing as a identifier that does
> not have a value.
>
Martin's point is important. This *is* a Frequently Asked Question
about Axiom - particularly by anyone who has used any of the more
"symbolic" and less "computer algebra-oriented" systems such as
Maxima, Maple or Mathematica. There really should be a discussion
of it here:
http://wiki.axiom-developer.org/FAQ
But sense there is not, now would be a good time to at least as
the question. Just click on the link above, read or skip to the
end and "Be Bold" - add a comment that asks the question. Later
someone can add the answer. That is how this wiki FAQ is supposed
to work.
On September 16, 2006 1:19 PM C Y wrote:
> ...
> 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)
>
Suppose there was such a domain constructor named Variable(D: domain)
which had the properties you suggest. What operations would you expect
this domain to export? Would it have the same operations as D? For
example '+'. Given two objects from the domain Variable(Integer),
say 'x' and 'y', what is the type of the result of 'x+y'? Is it
still in Variable(Integer)?
As Tim Daly said in his original replies to me in the email thread
mentioned above, this gets pretty complicated rather quickly.
On September 16, 2006 4:21 PM Gabriel Dos Reis wrote:
>
> Ralf Hemmecke writes:
>
> [...]
> | 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.
>
> Why Expression(I) could not be made to work with that?
>
Expression(R: OrderedSet) is a domain constructor that is intended
to implement many of these sort of expression manipulations
where the *coefficients* of the expressions come from domain R.
For example
(1) -> (a1,a2,a3,a4):Expression Quaternion Fraction Integer
Type: Void
(2) -> m := matrix[[a1,a2],[a3,a4]]
+a1 a2+
(2) | |
+a3 a4+
Type: Matrix Expression Quaternion Fraction Integer
We did not specify any values for a1, a2, a3, a4, but in the
domain 'Expression Quaternion Fraction Integer' we can use
them to form new expressions of the type and use them in other
types.
Unfortunately something very important that should work here:
(3) -> quatern(1/2,1/4,1/8,1/16)::Expression Quaternion Fraction Integer
Internal Error
The function coerce with signature hashcode is missing from domain
Expression(Quaternion (Fraction (Integer)))
doesn't work due to a bug in the current algebra code. :-(
I guess I had better submit this as a bug to IssueTracker...
> More generally, I would like to see support for symbolic
> expressions in Axiom.
>
Do you mean domains such as InputForm? Many purely symbolic
manipulations (in the sense of Lisp S-expressions) can be
performed in this domain (and related Sexpression). Most Axiom
domains have a coercion to InputForm. I think it is unfortunate,
though that the coercion to OutputForm from InputForm actually
displays these expressions as S-expressions, rather than in
Axiom's usual input notation.
> Yesterday, it took me very time lines to code some simple
> symbolic expression manipulation in Mathematica. The thing
> in Axiom would have eaten my evening :-(
>
I think very likely this is mostly a result of very poor or
missing documentation about what is possible in Axiom rather
than a fundamental limitation.
On September 16, 2006 11:57 PM C Y wrote:
>
> --- Gabriel Dos Reis wrote:
> ...
> > 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 do not think that is correct. If Axiom does not attach types to
symbols, what would you say the following expression means?
(4) -> a1+a2
(4) a2 + a1
Type: Expression Quaternion Fraction Integer
where a1, a2 are defined in (1) above.
> > 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.
>
No, the situation is more complicated than that as the example (4)
above shows. Note in particular that in (4) a1 and a2 *do not*
have any values (other than the symbol which they implicitly
represent).
When I write:
a1:Expression Quaternion Fraction Integer
I am saying that a1 is a symbolic expression which includes the
possibility that it be a specific 'Quaternion Fraction Integer' or
some symbol or even some symbolic expression.
This is different than if I wrote:
a1:Quaternion Fraction Integer
when does not admit that possibility that a1 could be a symbolic
expression.
> 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?
>
> Ouch. There are many cases where one tries to solve a problem to
> arrive at a symbolic equation, not a value. If Axiom makes this
> difficult that's going to be a real problem.
I do not think that Axiom makes this particularly difficult but it
certainly does things in a way quite different than Mathematica,
Maxima or Maple.
But don't get me wrong. There are some serious limitations on the
ways things of type Expression ... in Axiom can be manipulated when
compared to the 3M's. We have had discussions about this in this
list from time to time over the last few years.
>
> 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?
>
Cliff, why not give Axiom a try sometime instead of just talking
about it? ;)
(1) -> integrate(1/(1+x^4),x)
(1)
+-+ +-+ 2 +-+ +-+ 2
\|2 log(x\|2 + x + 1) - \|2 log(- x\|2 + x + 1)
+
+-+ 1 +-+ 1
- 2\|2 atan(---------) - 2\|2 atan(---------)
+-+ +-+
x\|2 - 1 x\|2 + 1
/
8
Type: Union(Expression Integer,...)
(2) -> subst(%,x=1.1)
(2)
0.1767766952 966368811 log(3.7656349186 104045537)
+
- 0.1767766952 966368811 log(0.6543650813 895954463)
+
- 0.3535533905 932737622 atan(1.7997429004 298623617)
+
- 0.3535533905 932737622 atan(0.3912921962 0451024907)
Type: Expression Float
(3) -> numeric(%)
Loading c:/Program Files/axiom/mnt/windows/algebra/NUMERIC.o for
package Numeric
(3) - 0.1985595415 9339336209
Type: Float
------------
Regards,
Bill Page.
- Re: [Axiom-developer] Question concerning types..., (continued)
- 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
- RE: [Axiom-developer] Question concerning types..., Bill Page, 2006/09/17
- Re: [Axiom-developer] Question concerning types..., Ralf Hemmecke, 2006/09/16
- RE: [Axiom-developer] Question concerning types...,
Bill Page <=
- Re: [Axiom-developer] Question concerning types..., Gabriel Dos Reis, 2006/09/17
- Re: [Axiom-developer] Question concerning types..., Ralf Hemmecke, 2006/09/17
- Re: [Axiom-developer] Question concerning types..., Gabriel Dos Reis, 2006/09/17
- Re: [Axiom-developer] Question concerning types..., Ralf Hemmecke, 2006/09/17
- Re: [Axiom-developer] Question concerning types..., Gabriel Dos Reis, 2006/09/17
- Re: [Axiom-developer] Question concerning types..., Ralf Hemmecke, 2006/09/18
- Re: [Axiom-developer] Question concerning types..., Gabriel Dos Reis, 2006/09/18
- Re: [Axiom-developer] Question concerning types..., Ralf Hemmecke, 2006/09/18
- [Axiom-developer] equal or unequal (was: Question concerning types...), Ralf Hemmecke, 2006/09/18
- [Axiom-developer] Re: equal or unequal (was: Question concerning types...), Gabriel Dos Reis, 2006/09/18