Martin Rubey wrote:
>
> Waldek Hebisch <[EMAIL PROTECTED]> writes:
> > > +-- coefficient(p, lv, ln) views the polynomial p as a polynomial
> > > +-- in the variables of lv and returns the coefficient of the term
> > > +-- \spad{lv**ln}, i.e. \spad{prod(lv_i ** ln_i)}.
> > > +
> > > + coefficient(s: %, lv: List Var, ln: List NNI): % ==
> > > + map(coefficient(#1, lv, ln), s)
> >
> > It looks that terms of resulting series have wrong degree.
>
> Are you sure?
>
In SparseMultivariateTaylorSeries we have:
++ This domain provides multivariate Taylor series with variables
++ from an arbitrary ordered set. A Taylor series is represented
++ by a stream of polynomials from the polynomial domain SMP.
++ The nth element of the stream is a form of degree n. SMTS is an
^^^^^^^^^^^ ^^^^^^^^
++ internal domain.
Now, I did not check which map you use, but my guess is that it
maps nth term of source series to nth term of target sequence.
However coefficient lowers degree -- that is why I suspect that
this implementation breaks invariant.
> (9) -> coefficient(sin(X+Y), [x], [1])
>
> 1 2
> (9) 1 - - y + O(5)
> 2
> Type: TaylorSeries(Fraction(Integer))
That confirms problem:
(3) -> series(sin(x), x=0)
1 3 1 5 1 7 1 9 1 11 12
(3) x - - x + --- x - ---- x + ------ x - -------- x + O(x )
6 120 5040 362880 39916800
(4) -> (x+y)^5
5 4 2 3 3 2 4 5
(4) y + 5x y + 10x y + 10x y + 5x y + x
so we should also have y^4/24 in the result.
Another test may be:
coefficient(coefficient(sin(X+Y), [x], [1]), 2)
--
Waldek Hebisch
[EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---