[sage-support] Re: How to create a new virtual environment based on an existing sage installation
https://trac.sagemath.org/ticket/33440 fixes the problem and is waiting for review. On Tuesday, March 1, 2022 at 11:07:50 AM UTC-8 Matthias Koeppe wrote: > The particular error that you are running into comes from Singular not > being in PATH. > > Use "sage -sh" to enter a shell in which SAGE_LOCAL/bin has been added to > PATH. > Then you can activate the venv as you did before. > > > > On Tuesday, March 1, 2022 at 10:45:00 AM UTC-8 m.derick...@gmail.com > wrote: > >> Hi All, >> >> I am wondering what the best way is to create a new virtual environment >> where I can import stuff from an already existing sage installation: >> >> I tried the following using sage 9.5.beta9 >> >> $ sage -python3 -m venv --system-site-packages venv >> $ source venv/bin/activate >> (venv) $ python3 >> Python 3.9.9 (main, Dec 25 2021, 18:25:51) >> [GCC 9.3.0] on linux >> Type "help", "copyright", "credits" or "license" for more information. >> >>> from sage.all import * >> Traceback (most recent call last): >> File "", line 1, in >> File >> "/scratch/home/mderickx/sages/sage/local/var/lib/sage/venv-python3.9.9/lib/python3.9/site-packages/sage/all.py", >> >> line 126, in >> from sage.rings.all import * >> File >> "/scratch/home/mderickx/sages/sage/local/var/lib/sage/venv-python3.9.9/lib/python3.9/site-packages/sage/rings/all.py", >> >> line 87, in >> ... >> ... >> File "sage/rings/polynomial/multi_polynomial_libsingular.pyx", line 1, in >> init sage.rings.polynomial.multi_polynomial_libsingular >> (build/cythonized/sage/rings/polynomial/multi_polynomial_libsingular.cpp:50020) >> >> >> File "sage/libs/singular/singular.pyx", line 1558, in init >> sage.libs.singular.singular >> (build/cythonized/sage/libs/singular/singular.cpp:15747) >> File "sage/libs/singular/singular.pyx", line 1525, in >> sage.libs.singular.singular.init_libsingular >> (build/cythonized/sage/libs/singular/singular.cpp:12865) >> File >> "/scratch/home/mderickx/sages/sage/local/var/lib/sage/venv-python3.9.9/lib/python3.9/posixpath.py", >> >> line 152, in dirname >> p = os.fspath(p) >> TypeError: expected str, bytes or os.PathLike object, not NoneType >> >> But as you can see this new venv is not created in such a way that sage >> the library is useable (probably because certain sage related environment >> variables are not set). >> >> So what is the best way to get around this? > > -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/2b6fdb69-9fa4-4a48-bff4-f14f01a289ean%40googlegroups.com.
[sage-support] Re: Multivariate polynomial ring with total degree no larger than n
I would do something like this (example for n=5): ``` n = 5 R = PolynomialRing(QQ, 'x', n) x0 = R.gen(0) # A shorter alternative is R.0 f = sum((i+1)*x0^i for i in range(n+1)) # sample polynomial p = 1 for xi in R.gens(): p *= f.substitute({x0:xi}) p = sum(coeff*mono for coeff, mono in list(p) if mono.degree() <= n) ``` timaeus schrieb am Samstag, 12. März 2022 um 12:14:26 UTC+1: > Hello everyone, > > I need to compute the product: f(x_1)f(x_2)...f(x_n), where f is a > polynomial of degree n, and I do not need the part with total degree larger > than n. To reduce the computation complexity, I think it would be helpful > to construct an n-variable multivariate polynomial ring, with terms total > degree no larger than n. I found the following two possible ways to do > this, however, I could not make either of them work for my settings. > >1. > >Create a multivariate polynomial ring then quotient out every monomial >with total degree larger than n. However I do not know how to express this >ideal. >2. > >I found a link on this site concerning >"set-of-polynomial-under-a-certain-degree" (I cannot post it since I am a >new user) which suggests a function max_degree for polynomial rings. >However, it seems there is no such a max_total_degree function for the >multivariate case. > > I am new to python, sage, and this community, so thank you in advance for > your helpful suggestions and comments! > -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/e82c6d3f-1e4e-4142-92e2-384675b60f2bn%40googlegroups.com.
[sage-support] Multivariate polynomial ring with total degree no larger than n
Hello everyone, I need to compute the product: f(x_1)f(x_2)...f(x_n), where f is a polynomial of degree n, and I do not need the part with total degree larger than n. To reduce the computation complexity, I think it would be helpful to construct an n-variable multivariate polynomial ring, with terms total degree no larger than n. I found the following two possible ways to do this, however, I could not make either of them work for my settings. 1. Create a multivariate polynomial ring then quotient out every monomial with total degree larger than n. However I do not know how to express this ideal. 2. I found a link on this site concerning "set-of-polynomial-under-a-certain-degree" (I cannot post it since I am a new user) which suggests a function max_degree for polynomial rings. However, it seems there is no such a max_total_degree function for the multivariate case. I am new to python, sage, and this community, so thank you in advance for your helpful suggestions and comments! -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/e91c9e22-3e22-481c-bf35-4844f9450755n%40googlegroups.com.