[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Axiom-developer] about Expression Integer
From: |
Martin Rubey |
Subject: |
Re: [Axiom-developer] about Expression Integer |
Date: |
17 Feb 2006 09:35:53 +0100 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 |
Part of this email will become part of MathAction in a minute...
> 1/ Can I (or cannot) remain Expressions as
>
> x+1/(y+1)
> y+1/(x+1)
>
> and do not have a single denominator.
Well, I need to explain several things here:
* How can I affect the way Axiom displays its results?
Whenever Axiom needs to write an element of a domain, i.e., an expression from
Expression Integer, a number from PrimeField 5, a factored polynomial from
Factored Polynomial Fraction Integer, etc., to the screen, it calls the
operation with the signature 'coerce: % -> OutputForm' from that domain.
For example, to output a polynomial in factored form, the "real" way to do it
is to coerce it into the domain Factored Polynomial Integer:
Type: Boolean
(6) -> x^2-y^2
2 2
(6) - y + x
Type: Polynomial Integer
(7) -> (x^2-y^2)::Factored Polynomial Integer
(7) - (y - x)(y + x)
Type: Factored Polynomial Integer
Thus, philosophically, the way things are output depends only on the domain,
and if we want to implement a different way, we need to implement a new
domain. This is very easy, see SandBoxDistributedExpression.
* How does this work in Polynomial Integer, Expression Integer?
The domain EXPR INT contains expressions in the form p/q where p and q are
polynomials -- with the variables being the "kernels" -- and the polynomials
are displayed in the same form as in POLY INT, which is unfortunately slightly
confusing. Roughly: "larger" variables are factored out:
(29) -> z*x+x
(29) x z + x
Type: Polynomial Integer
(30) -> z*x+z
(30) (x + 1)z
Type: Polynomial Integer
since "z" is "larger" than "x". Of course, "larger" is simply a rather
arbitrary, but fortunately fixed internal order of the variables. For
Expressions, this order is not even fixed, I think, but I might be wrong here.
In fact, this ordering is the thing about axiom that I hate most, I don't
really want it to say:
(4) -> tan x > sin x
(4) true
Type: Boolean
(5) -> tan x > sin y
(5) true
Type: Boolean
although I got used to it...
* Can I go back from (xy+x+1)/(y+1) to x+1/(y+1) ? Other cas have normal or
partfrac fuction, or remain fraction as.
As follows from the above, this currently cannot be done within the domain EXPR
INT. I think that there are several possibilities, which I will explain on an
old example, the problem of displaying expressions in "fully expanded" form:
* one can write a domain which only overrides the output functionality, and
applies the simplifications every time the element is written on the
screen. That's what I have done for DistributedExpression. This is the quick
and dirty way.
* one writes a new domain with a new representation. For
'DistributedExpression' I failed to do so, since the proper representation
would be 'DMP', but this only accepts a 'List Symbol' as variables, for
expressions I need to allow an arbitrary 'OrderedSet' however.
* one abstracts the form and writes a new functor, as for example
'Factored'. I'm not quite sure, but it may be that a functor 'Distributed'
would be the best solution. I would have to look why the original developers
chose to implement 'DistributedMultivariatePolynomials' instead.
So, the conclusion is that you might want to write a function first that takes
- for example - an expression and returns a list of expressions. It would be
easy to make this into a new domain "MyExpression". I vaguely recall that
Maxima has such a function.
> 3/ When I expand a trig formula I cut x+1/(y+1) in x and 1/(y+1)
> not in xy/(y+1) and x/(y+1) and 1/(y+1).
>
> But perhaps my ideas aren't right ?
>
> 4/ I'm not sure that the results (xy+x+1)/(y+1) and ((x+1)y+1)/(x+1)
> are fine :
> First the order of the variable is important, and the user (almost) can't
> force it, if he uses "n" and "x" variables. Second the result is longer if
> the denominator is big.
yes, I also think that the way POLY INT works is unsatisfactory. However, there
is DMP, which remedies the situation.
> 5/ Of corse there is no problem in expand (cos (4*x+5y)),
> but small problems appear with expand (cos (4*x+5*y/2))
> and a lot with expand (cos (4*x+5*y/(2+t+t^2+t^3))).
>
> What is the better expand in the 3 cases.
> Perhaps cos^4 x ... cos^5 y ...
> cos^4 x ... cos^5 (y/2) ...
> cos^4 x ... cos^5 (y/(2+t+t^2+t^3)) ... but I'm not sure.
I believe that usually, it is difficult to decide what's "better". I'd rather
have various operations or domains which all have a clear effect. So, maybe you
just write one operation that fully expands, another one that does something
else, and so on.
The very best thing would be, in my opinion, if you'd devise a domain which
is specially suited for trigonometric functions. I think that devising a really
good expression domain is very complex. Although I must say that I like MuPAD's
very much.
Martin
- [Axiom-developer] about Expression Integer, Francois Maltey, 2006/02/16
- Re: [Axiom-developer] about Expression Integer,
Martin Rubey <=
- RE: [Axiom-developer] about Expression Integer, Bill Page, 2006/02/17
- Re: [Axiom-developer] about Expression Integer, Martin Rubey, 2006/02/18
- Re: [Axiom-developer] about Expression Integer, Ralf Hemmecke, 2006/02/19
- RE: [Axiom-developer] about Expression Integer, Bill Page, 2006/02/19
- Re: [Axiom-developer] about Expression Integer, Martin Rubey, 2006/02/19
- RE: [Axiom-developer] about Expression Integer, Bill Page, 2006/02/19
- Re: [Axiom-developer] about Expression Integer, Martin Rubey, 2006/02/19
- DMP([x], DMP([x], Integer)) (was Re: [Axiom-developer] about Expression Integer), Ralf Hemmecke, 2006/02/20
- RE: [Axiom-developer] about Expression Integer, Bill Page, 2006/02/20