Hi Martin, I haven't really looked at these things so don't take my comment too seriously.
On 11/10/2008 10:04 AM, Martin Rubey wrote: > Currently, MTSCAT MultivariateTaylorSeriesCategory(Coef: Ring,Var: OrderedSet) > exports > > coefficient : (%,List(Var),List(NonNegativeInteger)) -> % > coefficient : (%,Var,NonNegativeInteger) -> % > coefficient : (%,IndexedExponents(Var)) -> Coef > > and TaylorSeries(Coef: Ring) exports > > coefficient : (%,NonNegativeInteger) -> Polynomial(Coef). > > > I believe that the intention of > > coefficient : (%,Var,NonNegativeInteger) -> % > > returning a TaylorSeries was to view the Taylor series as a univariate Taylor > series, and then return the coefficient of v^n. For example, after > > (1) -> X := x::TS(FRAC INT); Y := y::TS(FRAC INT); > > Type: TaylorSeries(Fraction(Integer)) > (2) -> s := (1/(1-X-Y))::TS(FRAC INT) > > (2) > 2 2 3 2 2 3 > 1 + (y + x) + (y + 2x y + x ) + (y + 3x y + 3x y + x ) > + > 4 3 2 2 3 4 > (y + 4x y + 6x y + 4x y + x ) + O(5) > Type: TaylorSeries(Fraction(Integer)) > > coefficient(s, y, 1) should probably give > > 1 + 2 x + 3 x^2 + ... I'd guess. > This was never implemented. Sound's like a bug in the SPAD compiler. It should catch that something is not implemented if it is exported. > I think that this was a bad idea anyway, since it is confusing to have also > the > coefficient function from AbelianMonoidRing(R: Ring,E: OrderedAbelianMonoid) > where > > coefficient(s, monomial(2, y)$IndexedExponents(Var)) yields just 1. I.e., the > coefficient of y^2 x^0. > > (not implemented either) I do not really consider it bad (except from not being implemented at all). The function signatures are different, so it should be clear what one gets for either function call. > I think it would be better to have a coercion, like perhaps > > coerce: % -> UTS(%, var, 0) I believe, I've seen something like that also in SparseMultivariatPolynomial in the algebra library of Aldor. It's something connected to the functions "univariate" and "multivariate" in "alg_smp.as". I guess Axiom's algebra library also has your equivalent for polynomials. > One could then say > > s::UTS(TaylorSeries(Fraction(Integer)), y, 0) and get something similar to > > (3) -> series(str)$UTS(UTS(EXPR INT, x, 0), y, 0) > > (3) > 1 3 5 1 2 1 4 5 1 1 3 5 > 2 > x - - x + O(x ) + (1 - - x + -- x + O(x ))y + (- - x + -- x + O(x ))y > 6 2 24 2 12 > + > 1 1 2 1 4 5 3 1 1 3 5 4 5 > (- - + -- x - --- x + O(x ))y + (-- x - --- x + O(x ))y + O(y ) > 6 12 144 24 144 > Type: > UnivariateTaylorSeries(UnivariateTaylorSeries(Expression(Integer),x,0),y,0) That should be fine, I'd say. > Note however, that "coefficient : (%,Var,NonNegativeInteger) -> %" and > "coefficient: (%,List(Var),List(NonNegativeInteger))" would be (if > implemented) > slightly more general, since, in the example (2) above, we could also ask for > coefficient(s, y, 2) which should probably give > > 1 + 3 x + 6 x^2 + ... > > With my proposed semantics, this could be done via a mapping function (which > does not exist yet, I think...) > > (27) -> map(c +-> coefficient(c, y, 2), [coefficient(s, n) for n in 0..]) > > 2 > (27) [0,0,1,3x,6x ,...] > Type: Stream(Polynomial(Fraction(Integer))) Agreed. But why do you say, it is your "proposed semantics". Isn't that already specified through TaylorSeries(Coef): Exports == Implementation where Coef : Ring ... Exports ==> MultivariateTaylorSeriesCategory(Coef,Symbol) with ... in mts.spad? Ralf --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/fricas-devel?hl=en -~----------~----~----~----~------~----~------~--~---
