Ask Your Question

heluani's profile - activity

2023-10-16 22:52:12 +0200 received badge  Notable Question (source)
2022-03-15 12:03:22 +0200 received badge  Popular Question (source)
2021-07-08 15:18:15 +0200 received badge  Popular Question (source)
2021-04-29 20:52:56 +0200 received badge  Popular Question (source)
2021-01-04 15:12:56 +0200 received badge  Taxonomist
2020-07-02 09:27:02 +0200 received badge  Popular Question (source)
2020-04-30 14:41:32 +0200 received badge  Nice Question (source)
2020-04-29 21:54:09 +0200 asked a question Find expansion of polynomial in an ideal

I have a polynomial p and some other polynomials p_1,...,p_k which are elements of a multivariate polynomial ring. Say something like P = PolynomialRing(QQ,'a,b,c,d,e,f,g') . I know that p belongs to the ideal generated by p_1,..,p_k because when I ask for a groebner basis of I I can see explicitly p there. How do I find the expression of p as a linear combination of the p_i's with coefficients in P?

2020-04-23 16:37:27 +0200 received badge  Self-Learner (source)
2020-04-23 14:52:47 +0200 answered a question building docs with sphinx-1.8.5

I'll add here the answer I got in sage-support mailing list: running 'make' before 'make clean-doc' solves the problem.

2020-04-22 21:12:19 +0200 commented question building docs with sphinx-1.8.5

Tried that and fails again with a [Errno 2] No such file or directory: ...en/reference/objects.inv. It looks exactly as was reported in that trac. _static is a symlink to an nonexistent directory. A make doc-clean does remove the link. But it gets created during the run of sage --docbuild reference html

2020-04-22 19:53:42 +0200 received badge  Associate Editor (source)
2020-04-22 19:30:28 +0200 asked a question building docs with sphinx-1.8.5

Hi I'll try this site before asking the developers mailing list. Please let me know if this is the wrong place for this sort of questions.

On my own git branch, after the last pull which happened after arch linux upgraded to sphinx-1.8.5 I hit this error on sage --docbuild refernce html even after a make doc-clean.

EDIT: this does not have to do with arch's sphinx, even after removing it and using the one shipped with Sage it still fails.

This looks like what's described in this ticket https://trac.sagemath.org/ticket/26451 but this is already applied in my branch


 # Sphinx version: 1.8.5
# Python version: 3.7.3 (CPython)
# Docutils version: 0.14 
# Jinja2 version: 2.10
# Last messages:
#   linking _static directory.
#   copying extra files...
#   done
#   dumping search index in English (code: en) ...
#   done
#   dumping object inventory...
#   done
#   build succeeded, 1295 warnings.
#   
#   The HTML pages are in local/share/doc/sage/html/en/reference/references.
# Loaded extensions:
#   sphinx.ext.mathjax (1.8.5) from /home/user/Documents/code/sage/sage/local/lib/python3.7/site-packages/sphinx/ext/mathjax.py
#   alabaster (0.7.12) from /home/user/Documents/code/sage/sage/local/lib/python3.7/site-packages/alabaster/__init__.py
#   inventory_builder (unknown version) from /home/user/Documents/code/sage/sage/src/sage_setup/docbuild/ext/inventory_builder.py
#   multidocs (unknown version) from /home/user/Documents/code/sage/sage/src/sage_setup/docbuild/ext/multidocs.py
#   sage_autodoc (1.8.5) from /home/user/Documents/code/sage/sage/src/sage_setup/docbuild/ext/sage_autodoc.py
#   sphinx.ext.graphviz (1.8.5) from /home/user/Documents/code/sage/sage/local/lib/python3.7/site-packages/sphinx/ext/graphviz.py
#   sphinx.ext.inheritance_diagram (1.8.5) from /home/user/Documents/code/sage/sage/local/lib/python3.7/site-packages/sphinx/ext/inheritance_diagram.py
#   sphinx.ext.todo (1.8.5) from /home/user/Documents/code/sage/sage/local/lib/python3.7/site-packages/sphinx/ext/todo.py
#   sphinx.ext.extlinks (1.8.5) from /home/user/Documents/code/sage/sage/local/lib/python3.7/site-packages/sphinx/ext/extlinks.py
#   IPython.sphinxext.ipython_directive (unknown version) from /home/user/Documents/code/sage/sage/local/lib/python3.7/site-packages/IPython/sphinxext/ipython_directive.py
#   matplotlib.sphinxext.plot_directive (unknown version) from /home/user/Documents/code/sage/sage/local/lib/python3.7/site-packages/matplotlib/sphinxext/plot_directive.py
Traceback (most recent call last):
  File "/home/user/Documents/code/sage/sage/local/lib/python3.7/site-packages/sphinx/cmd/build.py", line 304, in build_main
    app.build(args.force_all, filenames)
  File "/home/user/Documents/code/sage/sage/local/lib/python3.7/site-packages/sphinx/application.py", line 369, in build
    self.emit('build-finished', None)
  File "/home/user/Documents/code/sage/sage/local/lib/python3.7/site-packages/sphinx/application.py", line 510, in emit
    return self.events.emit(event, self, *args)
  File "/home/user/Documents/code/sage/sage/local/lib/python3.7/site-packages/sphinx/events.py", line 80, in emit
    results.append(callback(*args))
  File "/home/user/Documents/code/sage/sage/local/lib/python3.7/site-packages/sphinx/ext/graphviz.py", line 414, in on_build_finished
    copy_asset(src, dst)
  File "/home/user/Documents/code/sage/sage/local/lib/python3.7/site-packages/sphinx/util/fileutil.py", line 81, in copy_asset
    ensuredir(destination)
  File "/home/user/Documents/code/sage/sage/local/lib/python3.7/site-packages/sphinx/util/osutil.py", line 90, in ensuredir
    os.makedirs(path)
  File "/home/user/Documents/code/sage/sage/local/lib/python3.7/os.py", line 221, in makedirs
    mkdir(name, mode)
FileExistsError: [Errno 17] File exists: '/home/user/Documents/code/sage/sage/local/share/doc/sage/html/en/reference/references/_static'
2020-02-14 13:27:43 +0200 commented answer Find sphere points in a lattice

Thanks, that' works, but it's a bit less efficient that what I'm using now. This tests for all vectors in a box. You can use a ball which in higher dimensions is much smaller, and you can even account for the fact that in a root lattice case it's an ellipsoid. What I was wandering was if this was already implemented within Sage (which has the advantage of having precompiled cython code for example).

2020-02-10 13:51:22 +0200 commented question Find sphere points in a lattice

The one coming from the Killing for on the Cartan algebra.

2020-02-07 18:53:02 +0200 received badge  Good Question (source)
2020-02-04 23:46:31 +0200 received badge  Nice Question (source)
2020-02-04 22:53:35 +0200 commented question Spanish numbers using LaTeX

Thank you for pointing this Spanish rule. I was taught in school to use dots to separate every three digits. Apparently this has changed since http://lema.rae.es/dpd/srv/search?id=...

2020-02-04 20:01:35 +0200 asked a question Find sphere points in a lattice

Hello, say I have a lattice as in

Q = RootSystem('E8').weight_lattice()

with it's canonical bilinear form. How do I find the vectors $v$ such that $(v,v)=n$ for a positive integer $n$?

Edit: it would be even better if there's a way to get the points inside a cone, say the principal chamber in the above example.

2019-11-29 15:49:36 +0200 commented answer sagetex young_diagram size

Thanks, but I need to paint in the young diagram. I can achieve what I want by getting firs the partitions from sage and sending them to something like {\tiny\yng(7,...)}

2019-11-29 14:27:30 +0200 asked a question sagetex young_diagram size

Hello, I am printing a list of young diagramas in sagetex with something like

\sage{[p for p in Partitions(28) if p.is_symmetric()]}
How can I change the size of the cells so that they can actually fit in paper?

2019-11-15 20:48:37 +0200 asked a question Parentmethods for subcategories obtained from Functorial Constructions

In a related question to

https://ask.sagemath.org/question/487...

I have a category Cs which implements the axiom FinitelyGeneratedAsCs. I want to define parent methods for graded objects of Cs. Some of these apply for all objects, some only for the finitely generated ones. If I have a design sketched as


class Cs(Category_over_base_ring):

    class Subcategorymethods:
        def Graded(self):
               return GradedModules.category_of(self)
         def FinitelyGenerate(self):
                return self._with_axiom("FinitelyGeneratedAsCs")

     class Graded(GradedModulesCategory):
             class ParentMethods:
                     def some_method_for_all_parents(self)

     class FinitelyGeneratedAsCs(CategoryWithAxiom_over_base_ring):
            class Graded(GradedModulesCategory):
                     class ParentMethods:
                             def some_method_only_for_fg_graded_parents(self):

Then I receceive

sage: Cs(QQ).FinitelyGenerated().Graded()
TypeError: Graded() takes exactly 1 argument (2 given)

If I however implement Graded as an axiom, say FakeGraded then I can set up parent methods as described above (just need to add a call to self._with_axiom('FakeGraded') in the appropriate place. I thought however that to have better integration with other parts of Sage I should implement Graded as the functorial construction in GradedModulesCategory but I'm hitting the above error.

2019-11-15 16:08:07 +0200 asked a question do covariant constructions commute with WithBasis?

I have a category Cs (which is a supercategory of VectorSpaces) which implements axioms FinitelyGeneratedAsCs and WithBasis. When I want to consider Graded objects of C I simply return GradedModulesCategory.category_of(self) as the implementations of graded vector spaces or similar do. This preserves the axiom FinitelyGeneratedAsCs, namely if I call Cs().FinitelyGeneratedAsCs().Graded() I obtain the same as Cs().Graded().FinitelyGeneratedAsCs() . However when I do this with WithBasisthe results differ. Given this TODO in https://doc.sagemath.org/html/en/refe...

Todo Explain why this does not commute with WithBasis()

I suppose that this is something that has come up even in the current stable Sage code. I thought of asking here what would be the cause admittedly without having looked deeper into Sage's code to see how this is implemented.

EDIT: I suppose this has to to with the fact that Cs().WithBasis().super_categories() returns VectorSpaces(QQ).WithBasis() and Cs() in that order, so calling Graded() applies the functor to each so that Cs().WithBasis().Graded().super_categories() lists first VectorSpaces(QQ).WithBasis().Graded() and then Cs().WithBasis() and Cs().Graded(), this latter one being a direct subcategory of VectorSpaces(QQ).Graded()

But I tried defining Cs.WithBasis._super_categories in the right order and failed anyway.

EDIT2: The following seems to be a workaround. I define Cs.Graded and then on Cs.WithBasis.SubcategoryMethods I have


def Graded(self):
    axioms = self.axioms()
    return self.base_category.Graded()._with_axioms(axioms)

The problem is that if this is called from a subcategory that is a join category it will fail.

2019-11-05 19:16:53 +0200 commented question How to create 31-tuples with nonnegative entries that sum to 1

the "numbers" are in which ring?

2019-11-05 14:33:08 +0200 asked a question multiple cores groebner bases calculation

Hello, I have been looking into Singular's online manual as well as Sage's and the only mention of multiple cores is in the documentation for system. Is there an implementation of Singular's Gröbner basis calculation that uses multiple cores?

2019-11-05 13:47:15 +0200 commented question dynamic library not found

Thanks, I was about to post when I decided to check and it was indeed a mismatch between an installed version of Singular via arch's system and the one provided by SageMath. As a sidenote, it's surprising that sagemath's git packaged version of singular is older than the binary packaged in arch's system

2019-11-01 13:34:36 +0200 asked a question dynamic library not found

running a python script that just imports sage.all I get this error:

// ** Could not find dynamic library: p_Procs_FieldQ.so (path /usr/lib/../lib/singular/MOD:/home/user/Documents/code/sage/sage/local/libexec/singular/MOD)
// ** Error message from system: /usr/lib/../lib/singular/MOD/p_Procs_FieldQ.so: undefined symbol: _Z8nlIsZeroP7snumberP9n_Procs_s
// ** Singular will work properly, but much slower.
// ** See the INSTALL section in the Singular manual for details.

And indeed that library seems to have plenty of undefined symbols:

$ nm -u ~/Documents/code/sage/sage/local/libexec/singular/MOD/p_Procs_FieldQ.so
                 w __cxa_finalize@@GLIBC_2.2.5
                 U dynamic_lookup
                 w __gmon_start__
                 w _ITM_deregisterTMCloneTable
                 w _ITM_registerTMCloneTable
                 U omAllocBinFromFullPage
                 U omFreeToPageFault
                 U __stack_chk_fail@@GLIBC_2.4
                 U _Z5nlNegP7snumberP9n_Procs_s
                 U _Z5nlSubP7snumberS0_P9n_Procs_s
                 U _Z6nlCopyP7snumberP9n_Procs_s
                 U _Z6nlMultP7snumberS0_P9n_Procs_s
                 U _Z7nlEqualP7snumberS0_P9n_Procs_s
                 U _Z8nlDeletePP7snumberP9n_Procs_s
                 U _Z8nlInpAddRP7snumberS0_P9n_Procs_s
                 U _Z8nlIsZeroP7snumberP9n_Procs_s

This is against a freshly cloned git version. Is this some environment variable that I need to set or some part of Singular that I am missing?

2019-10-27 20:09:40 +0200 commented answer Displaying help in the browser

Thanks, indeed browse_sage_doc does open the page, albeit formated in a different way than the html itself in doc/en/reference/...

2019-10-27 18:27:12 +0200 commented answer Displaying help in the browser

Although this technically answers my question the result is generating a pdf that it's somehow worse than the console representation. I am hoping to get the html generated from the rst text in the source files. I should update my question

2019-10-27 16:04:13 +0200 asked a question Displaying help in the browser

while on the interactive shell, ss there anyway to see the outcome of ThisMethod?? displayed on a running browser instead of in the console?

EDIT: I am hoping to get the generated html from the source files. For example I would want to get file:///SAGEROOT/local/share/doc/sage/html/en/reference/algebras/sage/algebras/lie_algebras/lie_algebra.htmlas the output of LieAlgebra??

2019-10-26 11:34:32 +0200 marked best answer moving from .sage to .py

Hello, for the last few weeks I have been playing implementing an algebraic category in sage. I am new to both Sage and Python, and my code has grown large enough to be a large hierarchy of interdependent modules. I want to move those .sage files to .py files (eventually .pyx and adding some c code in parts) with the view to eventually add them to my local Sage library, but I am having trouble understanding the workflow in Python. My problem is how to figure out all the imports that my files will need. Within the interpreter I have available lots of symbols, so that when attaching a .sage there's no errors of global names being undefined. But if I want to keep these files as separate modules (so that I can't call from sage.all import * ) those symbols will not be present in the scope of the files.

I am used to compiled languages where I would run a compiler, find all errors, fix them as much as I can and repeat the process until no errors are found. But in the current situation I see only two options: either try to import the module from the Sage console like from mysage.myalgebra.thisalgebra import ThisAlgebra and expect some global name 'ThisName' is not defined error, fix it and continue. And on top of this, even if the symbol imports correctly, there are plenty of such errors that will popup at runtime for example trying to run ThisAlgebra.this_method if this_method uses some other undenfined global name. The other option would be trying to compile the python file, but for this I'll need to preparse the sage file. The command sage-preparse imports all again, so that's not an option.

So my question is how to get a list of all needed imports at once instead of iterating solving one by one, and subtly debugging all runtime calls.