Skip to content

Commit 10cfc11

Browse files
committed
derivative for LazySymmetricFunctions
1 parent 50ce450 commit 10cfc11

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

src/sage/rings/lazy_series.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3992,6 +3992,66 @@ def revert(self):
39923992
plethystic_inverse = revert
39933993
compositional_inverse = revert
39943994

3995+
def derivative_with_respect_to_p1(self, n=1):
3996+
r"""
3997+
Return the symmetric function obtained by taking the
3998+
derivative of ``self`` with respect to the power-sum
3999+
symmetric function `p_1` when the expansion of ``self`` in
4000+
the power-sum basis is considered as a polynomial in `p_k`'s
4001+
(with `k \geq 1`).
4002+
4003+
This is the same as skewing ``self`` by the first power-sum
4004+
symmetric function `p_1`.
4005+
4006+
INPUT:
4007+
4008+
- ``n`` -- (default: 1) nonnegative integer which determines
4009+
which power of the derivative is taken
4010+
4011+
4012+
EXAMPLES:
4013+
4014+
The species `E` of sets satisfies the relationship `E' = E`::
4015+
4016+
sage: h = SymmetricFunctions(QQ).h()
4017+
sage: T = LazySymmetricFunctions(h)
4018+
sage: E = T(lambda n: h[n])
4019+
sage: E - E.derivative_with_respect_to_p1()
4020+
O^6
4021+
4022+
The species `C` of cyclic orderings and the species `L` of linear
4023+
orderings satisfy the relationship `C' = L`::
4024+
4025+
sage: p = SymmetricFunctions(QQ).p()
4026+
sage: C = T(lambda n: (sum(euler_phi(k)*p([k])**(n//k) for k in divisors(n))/n if n > 0 else 0))
4027+
sage: L = T(lambda n: p([1]*n))
4028+
sage: L - C.derivative_with_respect_to_p1()
4029+
O^6
4030+
4031+
TESTS::
4032+
4033+
sage: T = LazySymmetricFunctions(p)
4034+
sage: a = T(p([1,1,1]))
4035+
sage: a.derivative_with_respect_to_p1()
4036+
(3*p[1,1]) + O^9
4037+
sage: a.derivative_with_respect_to_p1(1)
4038+
(3*p[1,1]) + O^9
4039+
sage: a.derivative_with_respect_to_p1(2)
4040+
6*p[1] + O^8
4041+
sage: a.derivative_with_respect_to_p1(3)
4042+
6*p[] + O^7
4043+
"""
4044+
P = self.parent()
4045+
if P._arity != 1:
4046+
raise ValueError("arity must be equal to 1")
4047+
4048+
coeff_stream = Stream_shift(Stream_map_coefficients(self._coeff_stream,
4049+
lambda c: c.derivative_with_respect_to_p1(n),
4050+
P._laurent_poly_ring),
4051+
-n)
4052+
return P.element_class(P, coeff_stream)
4053+
4054+
39954055
def _format_series(self, formatter, format_strings=False):
39964056
r"""
39974057
Return nonzero ``self`` formatted by ``formatter``.

0 commit comments

Comments
 (0)