ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 08 Aug 2022 11:29:12 +0200Compilation fails with "ModuleNotFoundError: No module named 'Cython'"https://ask.sagemath.org/question/63590/compilation-fails-with-modulenotfounderror-no-module-named-cython/A little history first:
On a Desktop with Ubuntu 20.04 and an AMD Zen 3, I compiled Sage from source pulling it (cloning) from Git and following the instructions in the GitHub readme. It pulled the version 9.7, which is in beta, but I don't have a problem with that: it seems to be working fine for the limited use I'm making of it.
Now I tried to do the exact same on my laptop with Ubuntu 20.04 and an AMD Zen 2. Compilation is failing. I'm getting the following error (from the log, before that there's a long stack trace and a long list of directories):
[Inferior 1 (process 1190799) detached]
27 ../sysdeps/unix/sysv/linux/wait4.c: No such file or directory.
Traceback (most recent call last):
File "<string>", line 25, in <module>
ModuleNotFoundError: No module named 'Cython'
Error while executing Python code.
Saved trace to /home/andrea/.sage/crash_logs/crash_tlqcuwtm.log
------------------------------------------------------------------------
Unhandled SIGSEGV: A segmentation fault occurred.
This probably occurred because a *compiled* module has a bug
in it and is not properly wrapped with sig_on(), sig_off().
Python will now terminate.
------------------------------------------------------------------------
Segmentation fault (core dumped)
Error: 'sage --docbuild --all-documents' failed
make[5]: *** [Makefile:40: doc-inventory-reference] Error 1
I will paste/attach the whole thing if you want.
How can I solve this problem?
Is there a way to tell make not to compile the docs, so that I can at least see if the programs themselves compile fine?AndyfcMon, 08 Aug 2022 11:29:12 +0200https://ask.sagemath.org/question/63590/Compile from source fails on Ubuntuhttps://ask.sagemath.org/question/63459/compile-from-source-fails-on-ubuntu/ I tried to compile sage from source. I did
git clone github.com/sagemath/sage.git /math/sage
cd /math/sage
make configure
./configure --enable-editable
make -j4
,but it didn't complete, returning after ~30minutes the following error :
[sagelib-9.7.beta6] error: subprocess-exited-with-error
[sagelib-9.7.beta6]
[sagelib-9.7.beta6] × python setup.py develop did not run successfully.
[sagelib-9.7.beta6] │ exit code: 1
[sagelib-9.7.beta6] ╰─> See above for output.
[sagelib-9.7.beta6]
[sagelib-9.7.beta6] note: This error originates from a subprocess, and is likely not a problem with pip.
[sagelib-9.7.beta6] full command: /math/sage/local/var/lib/sage/venv-python3.10/bin/python3 -c '
[sagelib-9.7.beta6] exec(compile('"'"''"'"''"'"'
[sagelib-9.7.beta6] # This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py
[sagelib-9.7.beta6] #
[sagelib-9.7.beta6] # - It imports setuptools before invoking setup.py, to enable projects that directly
[sagelib-9.7.beta6] # import from `distutils.core` to work with newer packaging standards.
[sagelib-9.7.beta6] # - It provides a clear error message when setuptools is not installed.
[sagelib-9.7.beta6] # - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so
[sagelib-9.7.beta6] # setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning:
[sagelib-9.7.beta6] # manifest_maker: standard file '"'"'-c'"'"' not found".
[sagelib-9.7.beta6] # - It generates a shim setup.py, for handling setup.cfg-only projects.
[sagelib-9.7.beta6] import os, sys, tokenize
[sagelib-9.7.beta6]
[sagelib-9.7.beta6] try:
[sagelib-9.7.beta6] import setuptools
[sagelib-9.7.beta6] except ImportError as error:
[sagelib-9.7.beta6] print(
[sagelib-9.7.beta6] "ERROR: Can not execute `setup.py` since setuptools is not available in "
[sagelib-9.7.beta6] "the build environment.",
[sagelib-9.7.beta6] file=sys.stderr,
[sagelib-9.7.beta6] )
[sagelib-9.7.beta6] sys.exit(1)
[sagelib-9.7.beta6]
[sagelib-9.7.beta6] __file__ = %r
[sagelib-9.7.beta6] sys.argv[0] = __file__
[sagelib-9.7.beta6]
[sagelib-9.7.beta6] if os.path.exists(__file__):
[sagelib-9.7.beta6] filename = __file__
[sagelib-9.7.beta6] with tokenize.open(__file__) as f:
[sagelib-9.7.beta6] setup_py_code = f.read()
[sagelib-9.7.beta6] else:
[sagelib-9.7.beta6] filename = "<auto-generated setuptools caller>"
[sagelib-9.7.beta6] setup_py_code = "from setuptools import setup; setup()"
[sagelib-9.7.beta6]
[sagelib-9.7.beta6] exec(compile(setup_py_code, filename, "exec"))
[sagelib-9.7.beta6] '"'"''"'"''"'"' % ('"'"'/math/sage/src/setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' --no-user-cfg develop --no-deps
[sagelib-9.7.beta6] cwd: /math/sage/src/
[sagelib-9.7.beta6] error: subprocess-exited-with-error
[sagelib-9.7.beta6]
[sagelib-9.7.beta6] × python setup.py develop did not run successfully.
[sagelib-9.7.beta6] │ exit code: 1
[sagelib-9.7.beta6] ╰─> See above for output.
[sagelib-9.7.beta6]
[sagelib-9.7.beta6] note: This error originates from a subprocess, and is likely not a problem with pip.
[sagelib-9.7.beta6]
[sagelib-9.7.beta6] real 0m25,129s
[sagelib-9.7.beta6] user 0m22,528s
[sagelib-9.7.beta6] sys 0m2,610s
make[4]: *** [Makefile:3002 : sagelib-SAGE_VENV-no-deps] Erreur 1
make[3]: *** [Makefile:3002 : /math/sage/local/var/lib/sage/venv-python3.10/var/lib/sage/installed/sagelib-9.7.beta6] Erreur 2
make[2]: *** [Makefile:2561 : all-start] Erreur 2
make[2] : on quitte le répertoire « /math/sage/build/make »
real 0m25,475s
user 0m22,867s
sys 0m2,665s
***************************************************************
Error building Sage.
The following package(s) may have failed to build (not necessarily
during this run of 'make all-start'):
It is safe to delete any log files and build directories, but they
contain information that is helpful for debugging build problems.
WARNING: If you now run 'make' again, the build directory of the
same version of the package will, by default, be deleted. Set the
environment variable SAGE_KEEP_BUILT_SPKGS=yes to prevent this.
make[1]: *** [Makefile:40 : all-start] Erreur 1
make[1] : on quitte le répertoire « /math/sage »
make: *** [Makefile:13 : all] Erreur 2
enter code here
I don't know what to do, I tried several times, it never complete.
Thank you for any helpjohnsmokeSat, 30 Jul 2022 16:16:02 +0200https://ask.sagemath.org/question/63459/How to deal with "GAPError: Error, reached the pre-set memory limit" ?https://ask.sagemath.org/question/61829/how-to-deal-with-gaperror-error-reached-the-pre-set-memory-limit/I get the following error while doing group theoretic computations in Sage:
GAPError: Error, reached the pre-set memory limit
(change it with the -o command line option)
How overcome it by allowing GAP use more memory? Where exactly I should use `-o` option?
---
Here is a code producing an error:
def a138077_q(q): G = PSL(3, q); d = G.order(); return d // max(H.order() for H in G.conjugacy_classes_subgroups() if H.order()<d)
print(a138077_q(13))Max AlekseyevTue, 05 Apr 2022 03:12:25 +0200https://ask.sagemath.org/question/61829/Trouble defining polynomial ring over Gaussian integershttps://ask.sagemath.org/question/61635/trouble-defining-polynomial-ring-over-gaussian-integers/Hello,
I would like to define a polynomial ring over `ZZ[I]`, e.g. like this:
sage: R.<x> = PolynomialRing(ZZ[I])
If I run this on sage 9.4 I get the following:
sage: R
Univariate Polynomial Ring in x over Order in Number Field in I0 with defining polynomial x^2 + 1 with I0 = 1*I
If I now try to define a polynomial with complex coefficients I get:
sage: f = I*x
TypeError: unsupported operand parent(s) for *: 'Number Field in I with defining polynomial x^2 + 1 with I = 1*I' and 'Univariate Polynomial Ring in x over Order in Number Field in I0 with defining polynomial x^2 + 1 with I0 = 1*I'
On SageMath version 9.0 I do not get the same error. Instead it says:
sage: R
Univariate Polynomial Ring in x over Order in Number Field in I with defining polynomial x^2 + 1 with I = 1*I
and i have no issues defining `f = I*x`. How do I resolve this issue in SageMath version 9.4?
Edit: I have done some further investigation, and the problem lies with this `I0` in
sage: ZZ[I]
Order in Number Field in I0 with defining polynomial x^2 + 1 with I0 = 1*I
What is the difference between `I0` and `I` and how do I work with it? Simply typing `f = I0 * x` also results in an error. Is this maybe a bug in SageMath 9.4? Does the same happen in SageMath 9.5?FKalkerSat, 26 Mar 2022 12:05:56 +0100https://ask.sagemath.org/question/61635/kernel error in Sagemathshttps://ask.sagemath.org/question/61138/kernel-error-in-sagemaths/hello i am going to decide to leave definitively the association jupyter-sagemaths because it has taken me hours and hours without any resolution
but in case it is useful for anyone else, i write the description, being as precise as possible
* the software are :
Macos Catalina 10.15.7
SageMath-9-4 installed
in the folder : /usr/local/share/jupyter/kernels/, i only have a sagemath_9_2_all.
before there was a Sagemaths_9_5 kernel there, i typed :
jupyter kernelspec uninstall
and it said :
Couldn't find kernel spec(s): /usr/local/share/jupyter/kernels/SageMath-9.5/
so i have rm -r the 9.5 kernel and the problem remains the same…
* the situation is :
when i launch SageMaths, it proposes me :
- terminal : works fine
- jupyter : returns error :
Firefox ne peut établir de connexion avec le serveur à l’adresse localhost:8888.
except if i do "jupyter-lab" in the terminal before
if so :
nothings work (kernel error)
* what i have done :
pip install pip-autoremove
pip-autoremove jupyter -y
pip uninstall notebook
pip uninstall jupyter_core
pip install jupyterlab
without any success
* i have not tried to install via conda because a cuple of months ago it worked very fine, without conda
* thanks for your attention
---------------
1/03/2022 it works, endly, after reinstallation of SageMaths-9-5.appErWinzThu, 17 Feb 2022 00:35:31 +0100https://ask.sagemath.org/question/61138/Error Handlinghttps://ask.sagemath.org/question/60887/error-handling/I am very new to Sage, so apologies if the answer to this question is obvious.
I have a program, and at the final calculation, for T and E matrices calculated earlier, it needs to either calculate a matrix A such that `T=AE`, or, if this returns an error message, calculate a matrix A such that `p*T=AE`, where p is also calculated earlier.
In mock code, what I mean is:
Calculate E.solve_left(T)
If that returns an error:
A=E.solve_left(p*T)
else:
A=E.solve_left(T)
return A
But I don't know how to do that in real code.RuneSun, 30 Jan 2022 20:06:57 +0100https://ask.sagemath.org/question/60887/gcd sometimes works, sometimes throws an errorhttps://ask.sagemath.org/question/60031/gcd-sometimes-works-sometimes-throws-an-error/ sage: a = 1/(x-1/x)
sage: b = 1/(x-1/x)/x
sage: a.gcd(b)
Sometimes I can get the result of a.gcd(b)
sage: a.gcd(b)
1/(x - 1/x)
But sometimes I get an error
sage: a.gcd(b)
ValueError Traceback (most recent call last)
<ipython-input-19-b4da4d9362f4> in <module>
----> 1 a.gcd(b)
/usr/local/anaconda3/envs/sage/lib/python3.8/site-packages/sage/symbolic/expression.pyx in
sage.symbolic.expression.Expression.gcd (build/cythonized/sage/symbolic/expression.cpp:42801)()
7489 """
7490 cdef Expression r = self.coerce_in(b)
-> 7491 cdef GEx x = g_gcd(self._gobj, r._gobj)
7492 return new_Expression_from_GEx(self._parent, x)
7493
ValueError: divide: arguments must be polynomials over the rationalsvnbThu, 02 Dec 2021 05:03:51 +0100https://ask.sagemath.org/question/60031/How am I using definite_integral wrong?https://ask.sagemath.org/question/59606/how-am-i-using-definite_integral-wrong/I'm attempting to evaluate the definite integral of a symbolic function, and I'm getting a type error that I don't understand.
Here's my script:
from sage.symbolic.integration.integral import definite_integral
### random variables
xi = var('xi'); assume(xi >= 0)
tau, eta = var('tau', 'eta'); assume(tau > 0); assume(eta > 0)
p1 = var('p1'); assume(p1 >= 0); assume(p1 <=1)
### expressions
h(p1, alpha, beta) = p1^(1/3 - 1) * (1 - p1)^(1/3 - 1)
k(p1, xi) = (1 - exp(-p1 * xi)) * exp(-p1 * xi)
hk = h * k
### evaluate
print(hk)
print(type(hk))
definite_integral(hk, p1, 0, 1)
The call to `print(type(hk))` returns `<class 'sage.symbolic.expression.Expression'>`, which is what I expect. However, the call to `definite_integral(hk, p1, 0, 1)` returns a lengthy error message featuring:
TypeError: cannot coerce arguments: no canonical coercion from Callable function ring with arguments (p1, alpha, beta, xi) to Symbolic Ring
I'm not sure what's going on with the types here, and I'd like to understand that so I can get this to work and also avoid making such mistakes in the future.
Thanks in advance,
A beginnercorvaxSat, 06 Nov 2021 01:34:31 +0100https://ask.sagemath.org/question/59606/Strange error in integrationhttps://ask.sagemath.org/question/56942/strange-error-in-integration/<pre><code>
[roganov@aorus bin]$ ./sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.2, Release Date: 2020-10-24 │
│ Using Python 3.8.5. Type "help()" for help. │
└────────────────────────────────────────────────────────────────────┘
sage: var('x')
x
sage: h = cos(1/2*x)*sqrt(4-x^2)
sage: integrate(h,x)
integrate(sqrt(-(x + 2)*(x - 2))*cos(1/2*x), x)
sage: integrate(h+x,x)
1/2*x^2
sage: integrate(cos(1/2*x)*sqrt(4-x^2)+x,x)
1/2*x^2
</code></pre>
roganovTue, 04 May 2021 13:55:38 +0200https://ask.sagemath.org/question/56942/Cannot evaluate symbolic expression to a numerical valuehttps://ask.sagemath.org/question/56672/cannot-evaluate-symbolic-expression-to-a-numerical-value/ I'm trying to do this:
```
(sqrt(10*y*(10-y))+sqrt(1000)*acos(sqrt(y/10))-15*sqrt(2*6.673*10^(-11)*50000000000)).roots( ring=RealField(100))
```
Unfortunately I get the error in the title.
Also any other way of solving the above equation numerically would be appreciated. I was able to do it in maxima using `find_root` but was hoping for a better function (one that doesn't require specifying an interval). I couldn't use find_root in sage because it returns the error 'unable to simplify to float approximation' and ofcourse `solve` doesn't return explicit solutions.Dr. BananaFri, 16 Apr 2021 17:06:47 +0200https://ask.sagemath.org/question/56672/Maxima wants to know whether %k1 is positive or negativehttps://ask.sagemath.org/question/56526/maxima-wants-to-know-whether-k1-is-positive-or-negative/Trying to solve a differential equation in Sage:
sage: de = -diff(y, x, 2) - G*M/y^2
sage: desolve(de, y, ics=[0, 1000])
I get a type error and a question:
TypeError: Computation failed since Maxima requested additional constraints; using the 'assume' command before evaluation *may* help (example of legal syntax is 'assume(%k1>0)', see `assume?` for more details)
Is %k1 positive or negative?
But when I use `assume(%k1>0)` I get a syntax error,
saying that there's something wrong with the percent sign.Dr. BananaWed, 07 Apr 2021 14:49:01 +0200https://ask.sagemath.org/question/56526/ArithmeticError: reduction modulo not definedhttps://ask.sagemath.org/question/56116/arithmeticerror-reduction-modulo-not-defined/I have tried performed modulo operation:
and I got this:
ArithmeticError Traceback (most recent call last) <ipython-input-1-b13f3c6e195a> in <module>
54 print(" po podziale x 2")
55 xP, yP = Pp.xy()
---> 56 uu = xQ % xP
57 print( f"uu mod = {(uu)} " )
/home/sc_serv/sage/local/lib/python3.8/site-packages/sage/rings/finite_rings/integer_mod.pyx in sage.rings.finite_rings.integer_mod.IntegerMod_abstract.__mod__ (build/cythonized/sage/rings/finite_rings/integer_mod.c:7287)()
493 R = IntegerModRing(modulus)
494 if (<Element>self)._parent._IntegerModRing_generic__order % R.order():
--> 495 raise ArithmeticError(f"reduction modulo {modulus!r} not defined")
496 return R(self)
497
ArithmeticError: reduction modulo 55066263022277343669578718895168534326250603453777594175500187360389116729240 not defined
i don't understand in python work
xQ = 0x5699b93fc6e1bd29e09a328d657a607b4155b61a6b5fcbedd7c12df7c67df8f5
xP = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798MiroslawThu, 11 Mar 2021 08:18:23 +0100https://ask.sagemath.org/question/56116/TypeError: 'tuple' object is not callable on notebook but not on terminalhttps://ask.sagemath.org/question/55874/typeerror-tuple-object-is-not-callable-on-notebook-but-not-on-terminal/Code :
x=var('x')
y=function('y')(x)
k= var('k')
assume(k>0)
harmonic2 = diff(y,x,2)+k*y == 0
desolve(harmonic2, y, ivar = x)
Error :
TypeError Traceback (most recent call last) <ipython-input-54-ef4195c42a80> in <module>
4 assume(k>Integer(0))
5 harmonic2 = diff(y,x,Integer(2))+k*y == Integer(0)
----> 6 desolve(harmonic2, y, ivar = x)
TypeError: 'tuple' object is not callable
Why does this happen when i tried it in notebook but when i tried it in notepad but it ran fine on the terminalmath1styearstudentWed, 24 Feb 2021 12:41:31 +0100https://ask.sagemath.org/question/55874/Tiny results of find roothttps://ask.sagemath.org/question/54012/tiny-results-of-find-root/ I was finding roots with a simple loop but got two odd results:
g(x) = (x^2)*cos(2*x)
for num in [-10..10,step=.1]:
try:
root=find_root(g,num,num+.1)
print(root)
except:
pass
-8.639379797371932
-7.0685834705770345
-5.497787143782152
-3.9269908169872405
-2.356194490192345
-0.7853981633974483
-7.755114791616843e-09
Are these two actual roots or a numerical error and how would I tell the difference?
7.755077210568017e-09
0.7853981633974483
2.356194490192345
3.9269908169872405
5.497787143782152
7.0685834705770345
8.639379797371932
cybervigilanteFri, 23 Oct 2020 23:21:35 +0200https://ask.sagemath.org/question/54012/Sage symbolic math simplification errorhttps://ask.sagemath.org/question/53345/sage-symbolic-math-simplification-error/In sagemath version 9.1, the code
product(1-q^x, x, 1, N)
returned
-(-1)^N*product(q^x - 1, x, 1, N)
while the correct result ought to be
(-1)^N*product(q^x - 1, x, 1, N)
What went wrong? Where did this sign change come from?ShoutOutAndCalculateMon, 07 Sep 2020 03:21:09 +0200https://ask.sagemath.org/question/53345/Why is Galois group computation failing?https://ask.sagemath.org/question/51944/why-is-galois-group-computation-failing/ L = NumberField(x^2 - x - 1, 'theta')
G = L.galois_group()
works
L = NumberField(x^3 - x - 1, 'theta')
G = L.galois_group()
gives me the error
TypeError: You must specify the name of the generator.
rain1Sat, 13 Jun 2020 12:42:27 +0200https://ask.sagemath.org/question/51944/Unexpected error in a notebookhttps://ask.sagemath.org/question/50980/unexpected-error-in-a-notebook/ I have a long notebook which works nicely. And, suddenly, when I call an already defined function I have this error message
unsupported operand parent(s) for -: 'Integer Ring' and '<class 'sage.plot.graphics.Graphics'>'
Could someone help me to understand what happen ? I cannot give the code here it is too hudge because I have tried to do as in Mathematica a self contain notebook.CyrilleFri, 24 Apr 2020 06:15:12 +0200https://ask.sagemath.org/question/50980/Random errors when using Singular via Sagehttps://ask.sagemath.org/question/50599/random-errors-when-using-singular-via-sage/Hello everyone,
I'd like to use Singulars capabilities in solving systems of polynomial equations, however I regularly obtain errors of Singular not recognizing the ring, that is created when executing the solve() command from the solve.lib Singular package. It seems somehow random to me, because the error only appears at about 30% of the time running to programm, so just giving it another try (without making any changes to the code) results in the desired result most of the time.
Here is my code:
C.<x, y> = PolynomialRing(QQ)
f = x^2 +y^2
epsilon = 1
# suggested by "rburing" to my question 'Passing functions to Singular'
# because I need to split f=f1+i*f2 in real and imaginary part
S.<x_1,x_2,y_1,y_2,i> = PolynomialRing(QQ)
F = f.subs({x: x_1 + i*x_2, y: y_1 + i*y_2}).reduce([i^2+1])
f1, f2 = F.polynomial(i).coefficients()
R = singular.ring(0,'(x_1,x_2,y_1,y_2)', 'lp')
g1 = singular.new(str(f1))
g2 = singular.new(str(f2))
g3 = singular.new('x_1^2 + x_2^2 +y_1^2+y_2^2 -' + str(epsilon) + '^2')
# creating the first ideal
I = singular.ideal(g1, g2, g3)
singular.lib("primdec.lib")
singular.lib("solve.lib")
# obtain the simplified components of the solution
components = I.primdecGTZ()
k1_1 = components[1][2][1]
k1_2 = components[1][2][2]
k1_3 = components[1][2][3]
singular.setring(R)
# creating a new ideal containing only the first component
H = singular.ideal(str(k1_1),str(k1_2),str(k1_3))
singular.setring(R)
# I now add another constraint to get two real solutions
# sphere around a point close to the solution
J = singular.ideal(H, '(x_1-0)^2 + (x_2+985/1393)^2 +(y_1-985/1393)^2+(y_2-0)^2 -1/10^2')
T = singular.solve(J)
singular.setring(T)
print(singular.eval('SOL'))
It might seem complicated to create that many Ideals but it is necessary because some of them are needed more often.
Executing it 10 times results in 2 to 3 errors of the following kind:
SingularError Traceback (most recent call last)
<ipython-input-55-da8b511c4e72> in <module>()
28 J = singular.ideal(H, '(x_1-0)^2 + (x_2+985/1393)^2 +(y_1-985/1393)^2+(y_2-0)^2 -1/10^2')
29 T = singular.solve(J)
-> 30 singular.setring(T)
31 print(singular.eval('SOL'))
/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/interfaces/singular.py in set_ring(self, R)
1097 if not isinstance(R, SingularElement):
1098 raise TypeError("R must be a singular ring")
-> 1099 self.eval("setring %s; short=0"%R.name(), allow_semicolon=True)
1100
1101 setring = set_ring
/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/interfaces/singular.py in eval(self, x, allow_semicolon, strip, **kwds)
657 # Singular actually does use that string
658 if s.find("error occurred") != -1 or s.find("Segment fault") != -1:
-> 659 raise SingularError('Singular error:\n%s'%s)
660
661 if get_verbose() > 0:
SingularError: Singular error:
? sage2437 is no name of a ring/qring
? error occurred in or before STDIN line 746: `setring sage2437; short=0;
Thanks for your help! Greetings PaulPaulEbertMon, 06 Apr 2020 18:07:09 +0200https://ask.sagemath.org/question/50599/NumberField NotImplemented Errorhttps://ask.sagemath.org/question/50052/numberfield-notimplemented-error/Hello!
I am currently trying to use NumberFields but I am getting random errors when using them.
I am trying to construct a NumberField by using
K=NumberField(x^2 +x+ 1, 'y')
or
K.<y> = NumberField(x^2+x+1)
Sometimes it works out just fine and other times i just get this NotImplemented Error:
Traceback (most recent call last):
File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1234, in execute flags=compile_flags), namespace, locals)
File "", line 1, in <module>
File "sage/modules/free_module_element.pyx", line 2023, in sage.modules.free_module_element.FreeModuleElement.__pow__ (build/cythonized/sage/modules/free_module_element.c:14871)
raise NotImplementedError
NotImplementedError
And after that I can't make it work anymore.
I tried resetting variables but that doesn't seem to be the problem.
Does anybody might have an idea what causes this issue?
CheersErratisTue, 25 Feb 2020 12:54:32 +0100https://ask.sagemath.org/question/50052/Why does solve() produces an error?https://ask.sagemath.org/question/49699/why-does-solve-produces-an-error/Why does solve() produces an error? `TypeError: The first argument must be a symbolic expression or a list of symbolic expressions.`
#!/usr/bin/env python
# coding: utf-8
# In[2]:
var('Ex Ey Ez')
# In[3]:
E=vector([Ex,Ey,Ez])
# In[4]:
var('Px Py Pz')
# In[5]:
P=vector([Px,Py,Pz])
# In[6]:
var('LAx LAy LAz LBx LBy LBz')
# In[7]:
LA=vector([LAx,LAy,LAz]); LB=vector([LBx,LBy,LBz])
# In[8]:
var('k QAx QAy')
# In[9]:
QA=QAx*LA+QAy*LB
# In[20]:
solve(E-P==k*(E-QA), [k, QAx, QAy])
# In[24]:
solve((E-P).cross_product(E-QA)==0, [QAx, QAy])portonTue, 28 Jan 2020 09:02:13 +0100https://ask.sagemath.org/question/49699/Condition of type: STORAGE-EXHAUSTEDhttps://ask.sagemath.org/question/49077/condition-of-type-storage-exhausted/ While doing some long calculations I got the error:
> Condition of type: STORAGE-EXHAUSTED
What does it mean? How do I get rid of it?mattiavThu, 19 Dec 2019 07:29:19 +0100https://ask.sagemath.org/question/49077/Error: Tried to use Sage's Python which was not yet installed.https://ask.sagemath.org/question/48855/error-tried-to-use-sages-python-which-was-not-yet-installed/ I get the following error when I try to run Sage.
$ sage
Error: Tried to use Sage's Python which was not yet installed.
If this was called from an spkg-install script for another package you should add $(PYTHON) as a dependency in build/pkgs/<pkg>/dependencies
I am using MAC. I did install both Python2 and Python3. I also upgraded my python to latest versions using
$ brew upgrade python@3
$ brew upgrade python@2
I do not understand the problem. Please help me. pantherFri, 22 Nov 2019 19:59:09 +0100https://ask.sagemath.org/question/48855/using cplex as a solver in sage - import error undefined symbol: CPXsetlogfilehttps://ask.sagemath.org/question/46606/using-cplex-as-a-solver-in-sage-import-error-undefined-symbol-cpxsetlogfile/Hi,
Ubuntu 18.04; Installed cplex_studio129.linux-x86-64.bin and then Sage 8.7 from source.
I chose source to allow me to "make" Sage again after linking the necessary CPLEX files as described at the very bottom of the page here:
doc.sagemath.org/html/en/thematic_tutorials/linear_programming
i.e. from
/home/klara/sage-8.7/local/lib
`ln -s /opt/ibm/ILOG/CPLEX_Studio129/cplex/lib/x86-64_linux/static_pic/libcplex.a .`
and from:
/home/klara/sage-8.7/local/include
`ln -s /opt/ibm/ILOG/CPLEX_Studio129/cplex/include/ilcplex/cplex.h .`
and finally, also from:
/home/klara/sage-8.7/local/include
`ln -s /opt/ibm/ILOG/CPLEX_Studio129/cplex/include/ilcplex/cpxconst.h .`
But now I get the following import error when running:
sage: p = MixedIntegerLinearProgram(solver='CPLEX')
ImportError: /home/klara/sage-8.7/local/lib/python2.7/site-packages/sage/numerical/backends/cplex_backend.so: undefined symbol: CPXsetlogfile
(By the way, after installing Sage but before linking and remaking I got the more basic import error:
`ImportError: No module named cplex_backend`)
Any hints as what to look into would be appreciated.
Thanks.
----------
Here is the Full Output of the error:
sage: p = MixedIntegerLinearProgram(solver='CPLEX')
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-d320ed52392f> in <module>()
----> 1 p = MixedIntegerLinearProgram(solver='CPLEX')
/home/klara/sage-8.7/local/lib/python2.7/site-packages/sage/misc/lazy_import.pyx in sage.misc.lazy_import.LazyImport.__call__ (build/cythonized/sage/misc/lazy_import.c:3690)()
352 True
353 """
--> 354 return self.get_object()(*args, **kwds)
355
356 def __repr__(self):
/home/klara/sage-8.7/local/lib/python2.7/site-packages/sage/numerical/mip.pyx in sage.numerical.mip.MixedIntegerLinearProgram.__init__ (build/cythonized/sage/numerical/mip.c:3931)()
449 self._first_variable_names = list(names)
450 from sage.numerical.backends.generic_backend import get_solver
--> 451 self._backend = get_solver(solver=solver,
452 constraint_generation=constraint_generation,
453 base_ring=base_ring)
/home/klara/sage-8.7/local/lib/python2.7/site-packages/sage/numerical/backends/generic_backend.pyx in sage.numerical.backends.generic_backend.get_solver (build/cythonized/sage/numerical/backends/generic_backend.c:20060)()
1647 raise ValueError("'solver' should be set to 'GLPK', 'Coin', 'CPLEX', 'CVXOPT', 'Gurobi', 'PPL', 'InteractiveLP', or None.")
1648
-> 1649 cpdef GenericBackend get_solver(constraint_generation = False, solver = None, base_ring = None):
1650 """
1651 Return a solver according to the given preferences
/home/klara/sage-8.7/local/lib/python2.7/site-packages/sage/numerical/backends/generic_backend.pyx in sage.numerical.backends.generic_backend.get_solver (build/cythonized/sage/numerical/backends/generic_backend.c:19611)()
1794
1795 elif solver == "Cplex":
-> 1796 from sage.numerical.backends.cplex_backend import CPLEXBackend
1797 return CPLEXBackend()
1798
ImportError: /home/klara/sage-8.7/local/lib/python2.7/site-packages/sage/numerical/backends/cplex_backend.so: undefined symbol: CPXsetlogfilebucks65Tue, 21 May 2019 13:36:42 +0200https://ask.sagemath.org/question/46606/Why do I get the OSError: [Errno2] when I try to run a .sage filehttps://ask.sagemath.org/question/46116/why-do-i-get-the-oserror-errno2-when-i-try-to-run-a-sage-file/Hello.
I'm new to SageMath and just installed it. Unfortunately I'm not too concerned with the importance of the information you might need to help me out - sorry for that.
So I have Windows 10 and I installed SageMath via These pre- built binaries if that's what it is called. I used the sagetex package to create a .sage file and I tried to run it with sage obviously. Therefore, I opened the Shell and typed
sage 'C:/Users/scheu/OneDrive/Desktop/sagetex.sage'
with sagetex.sage being my .sage file and I'm getting the following:
Traceback (most recent call last):
File "/opt/sagemath-8.6/src/bin/sage-preparse", line 245, in <module>
do_preparse(f)
File "/opt/sagemath-8.6/src/bin/sage-preparse", line 137, in do_preparse
with atomic_write(fname) as f:
File "/opt/sagemath-8.6/local/lib/python2.7/site-packages/sage/misc/temporary_file.py", line 422, in __enter__
fd, name = tempfile.mkstemp(dir=self.tmpdir)
File "/opt/sagemath-8.6/local/lib/python2.7/tempfile.py", line 314, in mkstemp
return _mkstemp_inner(dir, prefix, suffix, flags)
File "/opt/sagemath-8.6/local/lib/python2.7/tempfile.py", line 244, in _mkstemp_inner
fd = _os.open(file, flags, 0600)
OSError: [Errno 2] No such file or directory: '/home/sage/C:/Users/scheu/OneDrive/Desktop/Programme/LaTeX Files,Texmaker/Hilffiles/sagetex test/tmpfPP2mL'
By the way, I am sorry for putting the Code in my Question that way, I had just no idea how to Format this Code as one Code :(
Anyways, it says something I don't quite understand and I've already looked up the same Question, but it didn't help…
Thank you for your answers.LilanarusFri, 12 Apr 2019 21:44:50 +0200https://ask.sagemath.org/question/46116/Why does Sage Math crash instantly? / Running .sage files?https://ask.sagemath.org/question/46051/why-does-sage-math-crash-instantly-running-sage-files/ Hello.
First of all, I need to Mention that I am completely new to Sage Math and I have no idea what causes my problem(s), like seriousely, no idea.
When I start SageMath, it instantly crashes, I don't even touch anything. I'm running Windows 10 and I downloaded the binaries, a virtual box and this sage-8.6.tar.gz file. I am sure that I must be missing something but I don't know what.
Yesterday, I managed to get Sage to work, so in the terminal i could write simple commands like
sage:4+3
and later, I reinstalled python. Now it does not work anymore. My original aim was it to have sagetex in Latex, but for some reason running the .sage file which is created with every document using sagetex doesn't do anything and sage does not compile my document. And yes, I did follow the instructions how to make sagetex known to tex.
I have no idea how to continue, so many problems and i'm desperately trying to get things to work. (Feel like I downloaded half the Internet...) LilanarusMon, 08 Apr 2019 16:26:52 +0200https://ask.sagemath.org/question/46051/Wrong output by plotting with SageMath Version 8.4.rc1 (Trusted)https://ask.sagemath.org/question/45698/wrong-output-by-plotting-with-sagemath-version-84rc1-trusted/What is wrong? I got erroneous results by plots.
In: plot(sin(x))
Out: Graph - incorrect!
In: plot(bessel_J(0, x), x, -0, 1)
Out: Graph - incorrect!
I can send send you screenshots of both, but I don't how.myka32Thu, 07 Mar 2019 11:37:47 +0100https://ask.sagemath.org/question/45698/Error in false statementhttps://ask.sagemath.org/question/45623/error-in-false-statement/Hello
I write in SAGE the following
p=0+0*I
q=1/2+1/2*I
r=3/4+1/3*I
(real(p)==real(q))==false
and it returns "false", but it is true because 0 is not equal to 1/2. Why?creyesm1992Sun, 03 Mar 2019 17:10:55 +0100https://ask.sagemath.org/question/45623/Error in false statementhttps://ask.sagemath.org/question/45622/error-in-false-statement/I write in SAGE the following sentences
p=0+0*I
q=1/2+1/2*I
r=3/4+1/3*I
(real(p)==real(q))==false
As 0 is not equal to 1/2, this statement must be true, but SAGE says false. Why?creyesm1992Sun, 03 Mar 2019 17:09:17 +0100https://ask.sagemath.org/question/45622/__init__() takes exactly 5 arguments (4 given) error in contour plothttps://ask.sagemath.org/question/45446/__init__-takes-exactly-5-arguments-4-given-error-in-contour-plot/ I am trying to make a contour plot of a complex valued function. Let say it is g(z).
I have imported the complex root and ContourPlot command by doing following:
from sage.rings.polynomial.complex_roots import complex_roots
from sage.plot.contour_plot import ContourPlot
I have even successfully plot the 3d-Plot, but I encountered an error stating:
__init__() takes exactly 5 arguments (4 given)
My command is:
C=ContourPlot(lambda x,y:float(green(x+y*I)),(-5,5),(-5,5))
It seems that I did not miss the fifth argument, I tried to add in some commands, such as plot_points, but then Sage said it did not expect these commands..
What did I miss? Thank you!!JacobsonRadicalWed, 13 Feb 2019 12:03:37 +0100https://ask.sagemath.org/question/45446/How can I solve the following (linear) differential equation?https://ask.sagemath.org/question/45075/how-can-i-solve-the-following-linear-differential-equation/I want Sage to solve this equation:
$y'''-3y''+y'-5y=0$.
Both
y=function('y')(x)
desolve(diff(y,3)-3*diff(y,2)+diff(y,1)-5*y,y)
and
giac("desolve([y'''-3y''+y'-5y],y)").sage()
result in errors.ThrashThu, 17 Jan 2019 05:27:41 +0100https://ask.sagemath.org/question/45075/