Hello,
If i understood the Sage's developer guide, this is the place to propose
new features.
So, my name is Matthieu Dien, I am student in first year of master. During
this year, with Marguerite Zamansky, we develop an implementation of formal
multivariate power series (based on LazyPowerSeries) in order to provide a
future implementation of
Gfunhttp://perso.ens-lyon.fr/bruno.salvy/?page_id=48features (in a
multivariate way) for Sage.
Currently, there is only basic operator on formal multivariate power series
: addition, subtraction, multiplication, derivation, composition of series
and the sequence operator.
I precise that the implementation is really naive.
The next step should be the computing of the recurrence equation of a
series' term.
So, I join you the class (and some examples). You can test and make comment
about it.
If some people are interested by this and want to talk about it, I will be
here at Sage days.
Regards
Matthieu Dien
--
You received this message because you are subscribed to the Google Groups
sage-combinat-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email
to sage-combinat-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-combinat-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Formal Multivariate Power Series
This files provides an implementation of Formal Multivariate Power
Series. The implementation is based on the LazyPowerSeriesRing and
LazyPowerSeries class. The internal data structure uses the stream class where
each case is a list of term of the same total degree. The terms are represented
by a 2-tuple with a coefficient from the base ring and a list of integer of
the same length that the number of variable, which is the monomonial
associated to the coefficient in the serie.
The mecanism is the same that for the Lazy Power Series.
This code is based on the work of Ralf Hemmecke and Martin Rubey's, developed
by Marguerite Zamansky and Matthieu Dien.
#*
# Copyright (C) 2013 Matthieu Dien matthieu.d...@gmail.com,
#
# Distributed under the terms of the GNU General Public License (GPL)
#
#This code is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
#General Public License for more details.
#
# The full text of the GPL is available at:
#
# http://www.gnu.org/licenses/
#*
from series import LazyPowerSeriesRing, LazyPowerSeries, uninitialized
from stream import Stream, Stream_class
from series_order import bounded_decrement, increment, inf, unk
from sage.rings.all import Integer, prod
from functools import partial
from sage.misc.misc import repr_lincomb, is_iterator
from sage.algebras.algebra import Algebra
from sage.algebras.algebra_element import AlgebraElement
import sage.structure.parent_base
from sage.categories.all import Rings
class FormalMultivariatePowerSeriesRing(LazyPowerSeriesRing):
def __init__(self, R, element_class = None, names = None):
#Make sure R is a ring with unit element
if not R in Rings():
raise TypeError, Argument R must be a ring.
try:
z = R(Integer(1))
except StandardError:
raise ValueError, R must have a unit element
#Take care of the names
if names is None:
names = ['z']
self._ngens = len(names)
self._element_class = element_class if element_class is not None else FormalMultivariatePowerSeries
self._order = None
self._names = names
self._gens = [None]*self._ngens
#TODO : LazyPowerSeriesRing herits from Algebra that use old style parent class
sage.structure.parent_base.ParentWithBase.__init__(self, R)
def ngens(self):
EXAMPLES::
sage: R.u,v,w,z = FormalMultivariatePowerSeriesRing(QQ)
sage: R.ngens()
4
return self._ngens
def gen(self,i=0):
EXAMPLES::
sage: R.u,v,w,z = FormalMultivariatePowerSeriesRing(QQ)
sage: R.gen(2)
w
TESTS::
sage: R.u,v,w,z = FormalMultivariatePowerSeriesRing(QQ)
sage: R.gen(4)
Traceback (most recent call last):
...
ValueError: Generator not defined
if i 0 or i = self._ngens:
raise ValueError(Generator not defined)
if self._gens[i] == None :
self._gens[i] = self.term(1,[int(j==i) for j in range(self