- 26 Aug, 2016 5 commits
-
-
Frédéric Chapoton authored
-
Frédéric Chapoton authored
-
Frédéric Chapoton authored
-
Frédéric Chapoton authored
-
Volker Braun authored
-
- 24 Aug, 2016 6 commits
-
-
Release Manager authored
`@coerce_binop` is an important decorator used on binary operators to automagically apply the coercion framework on its arguments. It's widely used on e.g. `gcd` operations (`_add_`, `_sub_` etc. have coercion handled with another mechanism). The current `@coerce_binop` has the following dangerous behaviour, where, if the decorated method is given an extra unnamed argument, the `self`-argument is swallowed: {{{ sage: P.<x> = GF(5)[] sage: f = x^2 sage: g = x sage: f.gcd(g) x sage: f.gcd(g, 1) 1 }}} The reason is that `@coerce_binop` included a hack to allow calls such as `Polynomial.gcd(f,g)` where `f` and `g` are polynomials and the `gcd` method is decorated with `@coerce_binop`. The reason that this required a hack at all is that `@coerce_binop` was implemented as a class: it seems that creating decorators as classes implies a very unfortunate behaviour: {{{ class MyDec: def __init__(self, f): self.f = f def __call__(self, x): print "decorated: ", self , x self.f(x) mydec = MyDec class A: def __init__(self, a): self.a = a @mydec def met(self, x): print "x:", x myA = A(1) myA.met(5) }}} the above prints something like {{{ decorated: <__main__.MyDec instance at 0x7f63c5ab6c20> 5 }}} and then crashes with {{{ AttributeError: MyDec instance has no attribute 'a' }}} This is because the `self` in `__call__` of `MyDec` becomes the `MyDec` instance -- the `A` instance is never passed to the decorating class instance! The solution here is to rewrite `coerce_binop` as a function. At the same time, we can use `@sage_wraps` which ensures proper documentation (e.g. source file and line which was not retained in the previous `coerce_binop`). URL: https://trac.sagemath.org/21322 Reported by: jsrn Ticket author(s): Johan Rosenkilde, Xavier Caruso Reviewer(s): Miguel Marco
-
Release Manager authored
as a step towards py3, use six to get rid of itervalues in this ticket, only for the combinat folder URL: https://trac.sagemath.org/21310 Reported by: chapoton Ticket author(s): Frédéric Chapoton Reviewer(s): Jori Mäntysalo
-
Release Manager authored
the magnitude function is some kind of generalized Euler characteristic defined for metric spaces in particular, graphs can be seen as metric spaces with edges of length one. Let us implement the magnitude function for graphs. URL: https://trac.sagemath.org/21308 Reported by: chapoton Ticket author(s): Frédéric Chapoton Reviewer(s): Jori Mäntysalo
-
Release Manager authored
If `E` is an elliptic curve then `E.abelian_variety()` will return `E` as a modular abelian variety. URL: https://trac.sagemath.org/21298 Reported by: klui Ticket author(s): Kevin Lui Reviewer(s): Aly Deines
-
Xavier Caruso authored
-
Xavier Caruso authored
-
- 23 Aug, 2016 8 commits
-
-
Johan S. R. Nielsen authored
-
Release Manager authored
This is to make QQ behave more like a number_field. This will return a sequence containing just the identity morphism. {{{ sage: QQ.automorphisms() [ Ring endomorphism of Rational Field Defn: 1 |--> 1 ] }}} URL: https://trac.sagemath.org/21300 Reported by: klui Ticket author(s): Kevin Lui Reviewer(s): Travis Scrimshaw
-
Release Manager authored
in particular in the word "because" URL: https://trac.sagemath.org/21299 Reported by: chapoton Ticket author(s): Frédéric Chapoton Reviewer(s): Jori Mäntysalo
-
Release Manager authored
Implement functions to compute the blow up of an affine curve at a point, and to construct a nonsingular model for the curve by blowing up its singular points. These functions should describe the blow up/nonsingular model in terms of affine patches. URL: https://trac.sagemath.org/21085 Reported by: gjorgenson Ticket author(s): Grayson Jorgenson Reviewer(s): Ben Hutz
-
Release Manager authored
with an eye towards python3 similar as #21296 (and more tickets to come) URL: https://trac.sagemath.org/21304 Reported by: chapoton Ticket author(s): Frédéric Chapoton Reviewer(s): Jori Mäntysalo
-
kevin lui authored
-
Frédéric Chapoton authored
-
Frédéric Chapoton authored
-
- 22 Aug, 2016 11 commits
-
-
Release Manager authored
{{{ sage: CFiniteSequence(x/(1-x^2)).closed_form() -1/2*(-1)^n + 1/2 sage: CFiniteSequence(x*(x^2+4*x+1)/(1-x)^5).closed_form() 1/4*n^4 + 1/2*n^3 + 1/4*n^2 sage: CFiniteSequence((1+2*x-x^2)/(1-x)^4/(1+x)^2).closed_form() 1/12*n^3 - 1/8*(-1)^n*(n + 1) + 3/4*n^2 + 43/24*n + 9/8 sage: CFiniteSequence(1/(1-x)/(1-2*x)/(1-3*x)).closed_form() 1/2*3^(n + 2) - 2^(n + 2) + 1/2 sage: CFiniteSequence(x/(1-x^3)).closed_form() 1/9*sqrt(3)*(sqrt(3) + 6*sin(2/3*pi*n)) sage: CFiniteSequence(x/(1-x^4)).closed_form() 1/2*I*(-I)^n - 1/2*I*(-1)^(1/2*n) - 1/4*(-1)^n + 1/4 sage: CFiniteSequence(x/(1-x-x^2)).closed_form() -1/5*sqrt(5)*((-2/(sqrt(5) + 1))^n - (2/(sqrt(5) - 1))^n) sage: CFiniteSequence(x/(1+x^4)).closed_form() -(0.1767766952966369? - 0.1767766952966369?*I)*(0.7071067811865475? + ... }}} URL: https://trac.sagemath.org/18709 Reported by: rws Ticket author(s): Ralf Stephan, Armin Straub Reviewer(s): Ralf Stephan, Armin Straub
-
Release Manager authored
With sage-4.7.2 and {{{sage -i dot2tex}}} installed : {{{ sage: m = WordMorphism('a->abb,b->ba') sage: w = m.fixed_point('a') sage: prefix = Word(list(w[:100])) sage: pals = prefix.palindromes() sage: poset = Poset((pals, lambda x,y: x.is_factor(y))) sage: H = poset.hasse_diagram() sage: H.layout_graphviz() #require dot2tex ERROR Failed to process input Traceback (most recent call last): ... ValueError: invalid literal for int() with base 10: '249.88' ------------------------------------------------------- Traceback (most recent call last): ... AttributeError: 'str' object has no attribute 'iteritems' }}} This came up in #12351. URL: https://trac.sagemath.org/12364 Reported by: slabbe Ticket author(s): Sébastien Labbé Reviewer(s): Travis Scrimshaw
-
Release Manager authored
Karl-Dieter Crisman (at Sage Edu Days 3) points out that the documentation of the zeta method for a modular integer ring is a bit misleading. {{{ sage: R = IntegerModRing(11) sage: R.zeta(5, all=True) [9, 5, 4, 3] }}} All well and good, but the documentation says: {{{ Return an n-th root of unity in self if there is one, or raise an ArithmeticError otherwise. INPUT: * ``n`` -- positive integer * ``all`` -- bool, default: False. If True, return a list of all n-th roots of 1. }}} The point is that "n-th root of 1" should be "primitive n-th root of 1". URL: https://trac.sagemath.org/11516 Reported by: kedlaya Ticket author(s): Kiran Kedlaya Reviewer(s): Aly Deines
-
Release Manager authored
The logic for `OptionalExtension` only checks whether ''some'' version of the package is installed, which might not be the latest version. This problem is causing failures with bliss on the sage4 patchbot. URL: https://trac.sagemath.org/21288 Reported by: jdemeyer Ticket author(s): Jeroen Demeyer Reviewer(s): Matthias Koeppe
-
Frédéric Chapoton authored
-
Frédéric Chapoton authored
-
Frédéric Chapoton authored
-
Sébastien Labbé authored
-
Frédéric Chapoton authored
-
Kiran Kedlaya authored
-
kevin lui authored
-
- 21 Aug, 2016 10 commits
-
-
kevin lui authored
-
Frédéric Chapoton authored
-
Release Manager authored
Add the `algorithm`-keyword to canonical labeling of posets and forward the argument to the same function in graphs. URL: https://trac.sagemath.org/21293 Reported by: jmantysalo Ticket author(s): Jori Mäntysalo Reviewer(s): Martin Rubey
-
Release Manager authored
the following does not work {{{ K.<a> = QuadraticField(-1) A.<x,y> = AffineSpace(K, 2) H = End(A) phi = H([x/y, y]) emb = K.embeddings(QQbar)[0] phi.change_ring(emb) }}} since the coordiante ring is a fraction field URL: https://trac.sagemath.org/21285 Reported by: bhutz Ticket author(s): Ben Hutz Reviewer(s): Grayson Jorgenson
-
Release Manager authored
Those old-style latex expressions are giving pdf warnings. URL: https://trac.sagemath.org/21193 Reported by: chapoton Ticket author(s): Frédéric Chapoton Reviewer(s): André Apitzsch
-
Release Manager authored
If f is a newform, then f.an(n) will return the nth coefficient in its q-expansion. URL: https://trac.sagemath.org/20857 Reported by: klui Ticket author(s): Kevin Lui Reviewer(s): Peter Bruin, William Stein
-
Release Manager authored
This patch will add a dumb implementation to compute the jump number of a poset. URL: https://trac.sagemath.org/21276 Reported by: jmantysalo Ticket author(s): Jori Mäntysalo Reviewer(s): Frédéric Chapoton
-
Release Manager authored
Comparison between integers and strings is by memory position, hence random order here: {{{ sage -t --long src/sage/modules/tutorial_free_modules.py ********************************************************************** File "src/sage/modules/tutorial_free_modules.py", line 45, in sage.modules.tutorial_free_modules Failed example: F = CombinatorialFreeModule(ZZ, ['spam', 'eggs', 42]); F.an_element() Expected: 3*B[42] + 2*B['eggs'] + 2*B['spam'] Got: 2*B['eggs'] + 2*B['spam'] + 3*B[42] ********************************************************************** 1 item had failures: 1 of 43 in sage.modules.tutorial_free_modules [42 tests, 1 failure, 0.43 s] }}} URL: https://trac.sagemath.org/21238 Reported by: vbraun Ticket author(s): Frédéric Chapoton Reviewer(s): Volker Braun, Travis Scrimshaw
-
Release Manager authored
When a warning happens in the doctester, the source filename is always replaced by `doctest`. This should be fixed. Second, we display a complete traceback instead of just the warning message for warnings raised while doctesting. URL: https://trac.sagemath.org/21191 Reported by: jdemeyer Ticket author(s): Jeroen Demeyer Reviewer(s): Frédéric Chapoton
-
Release Manager authored
It seems as though when using plot() we are forced to have an aspect ratio of automatic whether we want that or not. Example: If we define a class {{{ class something: def plot(self): G = Graphics() G.set_aspect_ratio(1) return G }}} when we do something.plot() the aspect ratio is correctly set to 1. But when we do plot(something) the aspect ratio gets converted to automatic. This is due to the native way that plot is handled: file: src/sage/plot/plot.py {{{ @Options(alpha=1, thickness=1, fill=False, fillcolor='automatic', fillalpha=0.5, rgbcolor=(0,0,1), plot_points=200, adaptive_tolerance=0.01, adaptive_recursion=5, detect_poles = False, exclude = None, legend_label=None, __original_opts=True, aspect_ratio='automatic') def plot(funcs, *args, **kwds): G_kwds = Graphics._extract_kwds_for_show(kwds, ignore=['xmin', 'xmax']) original_opts = kwds.pop('__original_opts', {}) do_show = kwds.pop('show',False) from sage.structure.element import is_Vector if kwds.get('parametric',False) and is_Vector(funcs): funcs = tuple(funcs) if hasattr(funcs, 'plot'): G = funcs.plot(*args, **original_opts) # if we are using the generic plotting method else: # Other things - deleted for clarity G._set_extra_kwds(G_kwds) if do_show: G.show() return G }}} Notice how the last option in @Options is aspect_ratio='automatic'. The reason that this is the only one with an issue is the comination of Graphics._extract_kwds_for_show and G._set_extra_kwds. When using Graphics._extract_kwds_for_show we are doing the following: file: src/sage/plot/graphics.py {{{ SHOW_OPTIONS = dict(# axes options axes=None, axes_labels=None, axes_labels_size=None, axes_pad=None, base=None, scale=None, xmin=None, xmax=None, ymin=None, ymax=None, # Figure options aspect_ratio=None, dpi=DEFAULT_DPI, fig_tight=True, figsize=None, fontsize=None, frame=False, title=None, title_pos=None, transparent=False, # Grid options gridlines=None, gridlinesstyle=None, hgridlinesstyle=None, vgridlinesstyle=None, # Legend options legend_options={}, show_legend=None, # Ticks options ticks=None, tick_formatter=None, ticks_integer=False, # Text options typeset='default') def _extract_kwds_for_show(cls, kwds, ignore=[]): result = {} for option in cls.SHOW_OPTIONS: if option not in ignore: try: result[option] = kwds.pop(option) except KeyError: pass return result }}} As you can see, we always grab these additional kwds, in particular we grab the 'aspect_ratio' kwd. This means that when G._set_extra_kwds gets called, the aspect ratio is changing AFTER we have already set it in our something.plot() method. It seems as though this is not working as expected and/or there is some non-intuitive way to get around this issue. Recommendations: - We should only be doing _set_extra_kwds if we are NOT using the plot method of an object - Or we should have some way to override this property so that if we are setting an aspect ratio, then it does not get forcibly overwritten as is happening now. I'm thinking of doing the second one, where I do something of the following nature: {{{ if hasattr(funcs, 'plot'): G = funcs.plot(*args, **original_opts) for ext in G._extra_kwds if ext in G_kwds: delete G_kwds[ext] }}} Like this, if we are ever setting something beforehand, we are not unintentionally removing it as we are now. Thoughts would be beneficial on this ticket as plot is a fairly common tool that is used in multiple places and so I don't want to alter something that might break other things especially if there does actually exist something that would get around this issue that I don't know about and/or if someone has a different idea of how to approach it. Thank you. URL: https://trac.sagemath.org/20924 Reported by: aram.dermenjian Ticket author(s): Aram Dermenjian Reviewer(s): Paul Masson, Aaron Lauve, Travis Scrimshaw
-