Ask Your Question

heluani's profile - activity

2020-04-30 07:41:32 -0500 received badge  Nice Question (source)
2020-04-29 14:54:09 -0500 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 09:37:27 -0500 received badge  Self-Learner (source)
2020-04-23 07:52:47 -0500 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 14:12:19 -0500 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 12:53:42 -0500 received badge  Associate Editor (source)
2020-04-22 12:30:28 -0500 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 06:27:43 -0500 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 06:51:22 -0500 commented question Find sphere points in a lattice

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

2020-02-07 11:53:02 -0500 received badge  Good Question (source)
2020-02-04 16:46:31 -0500 received badge  Nice Question (source)
2020-02-04 15:53:35 -0500 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 13:01:35 -0500 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 08:49:36 -0500 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 07:27:30 -0500 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 13:48:37 -0500 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 09:08:07 -0500 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 12:16:53 -0500 commented question How to create 31-tuples with nonnegative entries that sum to 1

the "numbers" are in which ring?

2019-11-05 07:33:08 -0500 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 06:47:15 -0500 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 07:34:36 -0500 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 14:09:40 -0500 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 12:27:12 -0500 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 10:04:13 -0500 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-22 03:47:22 -0500 received badge  Notable Question (source)
2019-10-14 14:08:07 -0500 commented question building from git unresolved symbols libgomp

Indeed it was a broken gcc-fortran. I just reinstalled gcc and gcc-fortran and recompiled without trouble. I suppose this question can be closed? thanks.

2019-10-12 13:21:59 -0500 commented question building from git unresolved symbols libgomp

won't have access to that box until Monday but my guess is that it was an incompatible version of gcc-fortran. I just compiled in a different computer running arch updated the same day and it went smoothly.

2019-10-12 13:20:40 -0500 received badge  Enthusiast
2019-10-11 12:14:14 -0500 asked a question building from git unresolved symbols libgomp

fresh git cloned repository. Compilation fails with the spurious error as in https://trac.sagemath.org/ticket/28513. Running ./sage crashes with the error

ImportError: /home/user/sage/local/lib/liblinbox.so.0: undefined symbol: GOMP_loop_ull_maybe_nonmonotonic_runtime_next

But the symbols are there:

$ nm /usr/lib/libgomp.so | grep GOMP_loop_ull_maybe_
0000000000010070 T GOMP_loop_ull_maybe_nonmonotonic_runtime_next
000000000000f210 T GOMP_loop_ull_maybe_nonmonotonic_runtime_start

This is on Arch

$uname -a 
Linux host 5.3.5-arch1-1-ARCH #1 SMP PREEMPT Mon Oct 7 19:03:08 UTC 2019 x86_64 GNU/Linux
$ gcc --version
gcc (GCC) 9.2.0

2019-10-11 08:29:22 -0500 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.