The axiom command: fricas (1) -> x^1 abc[y]
Type: Fraction(Polynomial(Integer))
does not produce any syntax error while fricas x abc[y] does produce an error message. It seems that fricas 1 abc[y]
Type: UnivariatePolynomial(abc[y],
What is To explain this, you have to understand several syntax conventions in Axiom.
When two expressions are separated by a space, it means "apply" as in
So fricas abc [y]
Type: Symbol
fricas x [1,
Type: Symbol
Now if fricas 1 (b::Symbol)
Type: UnivariatePolynomial(b,
This is the same as fricas elt(1::UP(b,
Type: UnivariatePolynomial(b,
The results reported above are therefore all obtained by the these rules. The input 'x abc[y]' produces an error because this apply can only take place in UP (the fact that UP has only one variable makes the substitution unambiguous) and although it actually makes sense under suitable domains, the interpreter is not smart enough to find it. fricas (x::UP(x,
Type: UnivariatePolynomial(x,
and actually, the construction UP(x, POLY INT) is not kosher, but somehow the extra parentheses helped. fricas x::UP(x,
closed without further discussion. Maybe
I would agree with a status of pending but I think it would
at least be courteous to identify oneself by clicking preferences
before changing a status. That way at least I know who to blame. ;)
Maybe we should make it so that a user id must be specified in order
to click the Change button?
Second, it is clear from the original description that it is "not a syntax error". The bug report said: "should be a syntax error". So maybe you mean "should not be a syntax error"? Third most of your "explanation" is quite easy to find in the Axiom book (see page 818) "Univariate polynomials can also be used as if they were functions." but the fact that abc[y]? when appearing in a Type is displayed as
But I am not at all convinced that Axiom should behave in this strange manner. The idea that: 1 x[k] is the unit of the domain of univariate polynomials over the variable x[k]? is extraordinarily obscure and does not seem to have any obvious application to me. Further the fact that: 1 x is not defined (because the type of x is of type *Variable x and not Symbol and for some reason the interpreter does not consider the obvious coercion of x to Symbol while something more complicated like 'x[k]?' is of type Symbol by defautl) is at best very awkward and bordering on the bizarre. I am not sure whether to blame the interpreter (which is apparently
only following a fairly well defined search strategy) or perhaps better
to blame the implementation of UnivariatePolynomial for allowing this
form of abbreviated [#99 x^1 abc[y]? should be a syntax error] annoying --William Sit, Thu, 17 Feb 2005 19:19:21 -0600 reply Bill Page wrote:
Sorry, Bill. I was too hasty in closing it. But I don't see why anyone should be "annoyed". If you don't think it is right, just change it back to "open". Isn't that the reason for Wiki?
Third most of your "explanation" is quite easy to find in the Axiom book (see page 818) "Univariate polynomials can also be used as if they were functions." I was at first very puzzled by how the outputs in the original post are obtained. Perhaps if whoever posted it knew how the outputs came about, that should be included in the post so others do not have to waste time figuring that out. I interpreted the heading (ok wrongly) as some of the expressions have syntax error. I figured that they do not. Rather, it is the inability of the interpreter to coerce some parameters to the "correct" type and find a reasonable signature. But this is nothing new and short of analyzing the interpreter code to make it even smarter, what can we do in the meantime? That is why I thought "case closed". but the fact that abd[y]? when appearing in a Type is displayed as I disagree with your objection to On the otherhand, one can use easily fricas t:=1 x[y[z]]
Type: UnivariatePolynomial(x[y[z]],
fricas dom:=typeOf t
Type: Type
fricas h:dom:=monomial(2,
Type: UnivariatePolynomial(x[y[z]],
In fact, precisely because Axiom wants to preserve this structural information on the variable that it outputs it this way! Had it used a two dimensional method, it would not be able recapture the type information.
You must have a pretty bad day? (three "blame" words in one message? :-) I agree 100% with you that one should distinguish polynomials or expressions
from functions. But that is on the mathematics or theory level. In computing, we
need to be able to make substitutions (compose if you like under certain cases)
into the polynomials or expressions -- even if you use eval, you are still
considering the polynomials as functions without any change in domain or
representation. It would be another nightmare of coercion if a polynomial has
to be coerced into a function before any evaluation. Moreover, if a polynomial
can be thought of as a function, then ground elements are constant functions.
Axiom is consistent in this interpretation and any one writing While it may be unintuitive why anyone would perform an operation like The interpreter succeeds in seemingly more complicated The Wiki pages are supposed to be for experts as well as for novices. When simple input like this causes some apparent problem that is "unexpected", we should explain it. For some this may sound trivial, but for others, it may not. William fricas )clear all Today I felt like taking what I think might be the point of view of a new user of Axiom. I agree completely that the Wiki pages are supposed to be for experts as well as for novices and when simple input like this causes some apparent problem that is "unexpected", that we should explain it. I think you did a good job of that. But in my opinion the explanation is rather bizarre (especially from the point of view of a new user). So this is were the experts come in: How can we make Axiom's behaviour less bizarre to new users? I originally saw this behaviour in an simple test in the SandBox where a new user wrote something like this fricas integrate(z^2 ln[z],
Type: Union(Expression(Integer),
I was quite sure that what they intended to compute was fricas integrate(z^2*log(z),
Type: Union(Expression(Integer),
but I had a hard time understanding the original answer and I wondered why Axiom did not at least produce some kind of syntax error. About the status: Perhaps I was too direct in using the word "annoyed" since I am well aware that it is very hard to correctly interpret other peoples' motives and emotional state when reading what they wrote alone. I was annoyed :) but if you had seen me in person you would have noticed that I also smiled when I said that. Of course I used the word "blame" in the same way. I did not mean it to sound like I was "finding fault" with anyone, only that I wanted to identify what might be changed to make Axiom's behaviour more intuitive. About 'preferences': It seems that "wiki people" generally would
like to avoid any perceived "login barrier". Setting preferences
is just a matter of saying how you would like to be identified
(and a few other details) - it is not supposed to be like
"logging in". And you are right that in principle this only
needs to be done once. Setting preferences sends some cookies
to your browser which, depending on whether you have set your
browser security to permit it or not, will allow the system
to remember your preferences the next time you connect to the
wiki. But maybe you are right that there might be a better
label than About the use of fricas 1 t[x,
but I still don't see why, if there is a need for some linear syntax, there would be any objection to using the same syntax as the input. Surely: Type: UnivariatePolynomial(t[x,y,z], Integer) would be self explanatory, no? About functions and expressions. There is no problem making substitutions into polynomials like this: fricas subst((1+b^2)::UP(b,
Type: UnivariatePolynomial(t,
or even this fricas subst((1+c*b^2)::MPOLY([b,
We can also explicitly use Finally, could you explain further your reasoning about why the
interpreter should not coerce Or is it the case that the interpreter never tries harder than just one coercion? BTW, I tried specifying fricas )expose Variable but I did not see any change in Axiom's behaviour. fricas 1 x --------- Bill Page
This is a tall order even though I would agree that such bizarre results may drive many away.
I originally saw this behaviour in an simple test in the SandBox where a new user wrote something like this A new user has to learn the basic operations and syntax. The above user may be used to Mathematica and Maple or just simply use intuition. I have the same experience myself: I am used to Mathematica and I can't stand the syntax and especially the worksheet interface of Maple (my prejudice). I made so many mistakes and got frustrated every time. But this is not to say Maple is not great for a lot of other people. I was quite sure that what they intended to compute was I did not find it easy either. Just because it can be explained does not mean the problem is not there. On the other hand, Axiom was designed for mathematicians and perhaps there is some assumption built in that the users would follow the rules and would realize what their mistakes are. This "apply" notion permeates all levels of Axiom and I believe it would be impossible to modify it without causing a lot of other failures, creating more problems. About the status: Agreed. I will not close any discussion from now on. One cannot foresee the implications sometimes when the examples illustrating the bugs are already traced to such a low level. I decided to close it because the example x^1 abc[y]? was clearly artificial; had I seen this one on integration, I probably wouldn't have. Perhaps in addition to a pin-point example, there should also be the other examples on a more complex level to illustrate the implications. For example, I would classify the problem with '1 x[y]?' as not a severe problem, but 'integrate(z^2 ln[z]?, z)' as severe, even though the cause is the same. And the two should be combined into one page, may be with a heading: Beware of Functional Applications. Perhaps I was too direct in using the word "annoyed" since I am well aware that it is very hard to correctly interpret other peoples' motives and emotional state when reading what they wrote alone. I was annoyed :) but if you had seen me in person you would have noticed that I also smiled when I said that. Of course I used the word "blame" in the same way. I did not mean it to sound like I was "finding fault" with anyone, only that I wanted to identify what might be changed to make Axiom's behaviour more intuitive. While this is a worthwhile goal, it may be too late in the game because these issues should have been resolved from the moment the system was designed. The interpreter is already quite different from the compiler in its handling of user input. Increasing its user friendliness will only make it even harder to learn to use the compiler, especially if the grammar is changed. Right now, I think all the interpreter does is performing coercions, lifting domains, and matching signatures. I don't believe you would get any of these problems with a compiled package because one is forced by the compiler to know exactly what one is computing. So if the "behavior" of Axiom is to be changed, one has to rewrite the interpreter, making Axiom even more different than the compiler version. It is probably easier to change user behavior :-). I remember how new students
using Mathematica forget to start the trig functions (or any built-in function)
with a capital letter and enter On the other hand, I think no software system can stand a deliberate scrutiny on all possible input errors (not to mention those that are syntactically correct but with wishful semantics). It is similar to anticipating all student errors in mathematics or their wishful laws on algebraic operations. We can't and instead we teach students the correct ways. I recommend strongly that when users find "strange behavior" in the interpreter
version that they try to analyse it by using About 'preferences': It seems that "wiki people" generally would like to avoid any perceived "login barrier". Setting preferences is just a matter of saying how you would like to be identified (and a few other details) - it is not supposed to be like "logging in". And you are right that in principle this only needs to be done once. Setting preferences sends some cookies to your browser which, depending on whether you have set your browser security to permit it or not, will allow the system to remember your preferences the next time you connect to the wiki. But maybe you are right that there might be a better label than That sounds like a better label. May be "Who Are You"? "whoami" is a Unix command for a different purpose. But of course, I know now where to do it. For new comers, that would certainly help. About the use of I suppose, I was only guessing at some logic behind this "design". And actually Axiom does use your suggested notation too (indeed, mixed), and so it is again not that consistent. fricas integrate(z^2*x[z],
Type: Polynomial(Fraction(Integer))
fricas 1 x[%]
Type: UnivariatePolynomial(x[(1/3)*x[z]*z^3],
Here in the Type message, x(z) is used instead of *01x z. You will see Axiom
tries very hard to work out the type of the last one if you had
Univariate polynomials are just like finite sequences (streams would be infinite
sequences) and all are just functions in the sense the domain is the set of
indices (subscripts, exponents or more complicated scripting at times). Axiom is
just treating them uniformly. In using fricas )clear all
Type: Expression(Integer)
fricas subst(1+c(b^2), whereas in Mathematica, Finally, could you explain further your reasoning about why the interpreter should not coerce Nope, because I was wrong! I thought it might create an infinite mutual coercion, but that is apparently not the case. I don't have any documentation on the interpreter. Like what physicists practice, the theory must follow the experiments and will change when new evidence shows up. So I now find out a situation where the interpreter actually does the coercion from Variable(x) to Symbol. (So my previous statement that claim the interpreter does not do this conversion in my last message is wrong -- I was misguided by the hyperdoc documentation that the convert and variable functions are unexposed, even if Variable() is). See IssueTracker #110.
Or is it the case that the interpreter never tries harder than just one coercion? No, the interpreter tries very hard sometimes. See above symbol with a complicated subscript. BTW, I tried specifying I don't know. According to hyperdoc, even if Variable() is exposed, the two operations convert and variable are still unexposed. But I now do not think that is the problem. Apparently, the interpreter is able to use them when it wants to. --------- Bill Page -- forwarded from "99X1AbcYShouldBeASyntaxError#msg20050217221454-0600@page.axiom-developer.org:99X1AbcYShouldBeASyntaxError#msg20050217221454-0600@page.axiom-developer.org William
|