Re: Unexpected results w.r.t. exponential operation of LODO (with july2008 release)
Martin Rubey <[email protected]> 29 Aug 2008 10:46:58 +0200
| Newsgroups | gmane.comp.mathematics.axiom.user |
|---|---|
| Message-ID | <[email protected]> |
Dear Liu, "Liu Xiaojun" <[email protected]> writes: > Hi, > > Does exponential operation (^ or **) of a differential operator, say L, > means repeating multiplications of L in Axiom ? If so, it seems the following > code produced an unexpected result: > > (1) -> Dx: LODO(EXPR INT, f+->D(f,x)) := D() > (2) -> u := operator 'u > (3) -> L := Dx + u(x) > (4) -> L**2 = L*L > > 2 2 2 , 2 > (4) D + 2u(x)D + u(x) = D + 2u(x)D + u (x) + u(x) > > L^2 produces the same result as l.h.s. of (4) shows. However, it does not > equal to the r.h.s. generally, and r.h.s. should be correct answer. Quite right, it's a bug. COuld you please file it with the example above on MathAction/IssueTracker (click on "Bug Reports" on the Frontpage of Mathaction)? > I checked the .spad file, it seems the exponential operation of LODO (or its > parent OREUP) is missed (or I guess it is directly inherited as usual > polynomial operation). You are completely right: SparseUnivariateSkewPolynomial(R:Ring, sigma:Automorphism R, delta: R -> R): UnivariateSkewPolynomialCategory R with outputForm: (%, OutputForm) -> OutputForm ++ outputForm(p, x) returns the output form of p using x for the ++ otherwise anonymous variable. == SparseUnivariatePolynomial R add ... (and ** does not appear below) The rules for inheritance spelt out for our situation are as follows: MyCat: Category with foo: % -> % bar: % -> % xxx: % -> % add foo a == xxx a bar a == xxx a MyDom1: MyCat == add xxx a == ... -- define xxx bar a == ... -- override bar from MyCat MyDom2: MyCat == MyDom1 add xxx a == ... -- give a definition different from the one in MyDom1 Now, foo$MyDom2 will give the same result as xxx$MyDom2, but bar$MyDom2 will use the definition given in MyDom1! Thus, since ** is inherited from SparseUnivariatePolynomial, and it is redefined there, we have a bug. In my experience, reusing *all* definitions from another domain as in MyDom2: MyCat == MyDom1 add has to be done *very* carefully. (But it is a nice feature, still!) In our case, we may want to do SparseUnivariateSkewPolynomial(R:Ring, sigma:Automorphism R, delta: R -> R): UnivariateSkewPolynomialCategory R with outputForm: (%, OutputForm) -> OutputForm ++ outputForm(p, x) returns the output form of p using x for the ++ otherwise anonymous variable. == SparseUnivariatePolynomial R add -- We have to define ^ and **, because taking it from SUP R is wrong. It is -- sufficient to do it for PositiveInteger, since for n=0 the definitions -- agree. However, there might be a faster definition. import RepeatedSquaring(%) _^(x:%, n:PositiveInteger):% == x ** n x:% ** n:PositiveInteger == expt(x,n) ... Liu, could you (in return :-) write a tiny testcase for each of the exported functions of SparseUnivariateSkewPolynomial (or, if you prefer, for LinearOrdinaryDifferentialOperator). For example: )expose UnittestCount UnittestAux Unittest testsuite "LODO" testcase "exponentiation" Dx: LODO(EXPR INT, f+->D(f,x)) := D() u := operator 'u L := Dx + u(x) testEquals("L*L*L", "L^3") testEquals("L*L", "L**2") testcase "leftQuotient" ... Martin