ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 25 Feb 2020 05:54:32 -0600NumberField NotImplemented Errorhttp://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 05:54:32 -0600http://ask.sagemath.org/question/50052/Why does solve() produces an error?http://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 02:02:13 -0600http://ask.sagemath.org/question/49699/Condition of type: STORAGE-EXHAUSTEDhttp://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 00:29:19 -0600http://ask.sagemath.org/question/49077/Error: Tried to use Sage's Python which was not yet installed.http://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 12:59:09 -0600http://ask.sagemath.org/question/48855/using cplex as a solver in sage - import error undefined symbol: CPXsetlogfilehttp://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 06:36:42 -0500http://ask.sagemath.org/question/46606/Why do I get the OSError: [Errno2] when I try to run a .sage filehttp://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 14:44:50 -0500http://ask.sagemath.org/question/46116/Why does Sage Math crash instantly? / Running .sage files?http://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 09:26:52 -0500http://ask.sagemath.org/question/46051/Wrong output by plotting with SageMath Version 8.4.rc1 (Trusted)http://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 04:37:47 -0600http://ask.sagemath.org/question/45698/Error in false statementhttp://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 10:10:55 -0600http://ask.sagemath.org/question/45623/Error in false statementhttp://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 10:09:17 -0600http://ask.sagemath.org/question/45622/__init__() takes exactly 5 arguments (4 given) error in contour plothttp://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 05:03:37 -0600http://ask.sagemath.org/question/45446/How can I solve the following (linear) differential equation?http://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.ThrashWed, 16 Jan 2019 22:27:41 -0600http://ask.sagemath.org/question/45075/Why doesn't assume(x, 'real') exclude complex values when using plot(x^(1/3)) over a negative domain?http://ask.sagemath.org/question/44798/why-doesnt-assumex-real-exclude-complex-values-when-using-plotx13-over-a-negative-domain/ Running the following commands:
assume(x,'real')
plot(x^(1/3), -5, 5)
produces the following error:
verbose 0 (3630: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 100 points.
verbose 0 (3630: plot.py, generate_plot_points) Last error message: 'negative number cannot be raised to a fractional power'
Shouldn't the assume command take care of this?
Thanks.
douglas.y.youngThu, 27 Dec 2018 21:04:18 -0600http://ask.sagemath.org/question/44798/Error occurs Compiling with sage “SystemError: new style getargs format but argument is not a tuple”http://ask.sagemath.org/question/43411/error-occurs-compiling-with-sage-systemerror-new-style-getargs-format-but-argument-is-not-a-tuple/ When the following codes are compiling with python everything is good, there is no error, but when I compile with sage it occurs the error : "SystemError: new style getargs format but argument is not a tuple"
Here is my code
from PIL import Image
file=Image.open('/home/mks/Desktop/Shamir_VSIS/si.jpeg')
file2=file.convert("L")
pix = file2.load()
colsize,rowsize=file2.size
for i in range(rowsize):
for j in range(colsize):
if pix[j,i]>250:
pix[j,i]=250
file2.save('/home/mks/Desktop/Shamir_VSIS/si.pgm')
How can I fix this issue?math.mks@yandex.comSat, 18 Aug 2018 01:35:18 -0500http://ask.sagemath.org/question/43411/Error when running a commandhttp://ask.sagemath.org/question/43337/error-when-running-a-command/Why does sage say that there is an error when I type a command and run it? (even I run 1+1, the error appear)
Here is how sage says:
ERROR: 'closed'
Communication with the Sage server is failing.
Here are some actions you could try to resolve this problem:
- check your internet connection,
- run this cell again,
- close and reopen this file,
- restart the project (in project settings, wrench icon),
- reload the browser tab or even restart your browser,
- delete some of the content in the project's ~/.local directory,
(locally installed Python libraries might interfere with running this worksheet)
pizzaSat, 11 Aug 2018 09:48:34 -0500http://ask.sagemath.org/question/43337/Unable to build sage with Python 2http://ask.sagemath.org/question/42970/unable-to-build-sage-with-python-2/I set `export SAGE_CHECK="yes"` to run tests on the spkgs before running `make -j5`. This gives me another build breaking error, despite using python 2 to build sage
Sage version: 8.3rc0
OS fedora 28 linux_86_x64
### Last section from ppl-1.2.p1.log or see [pastebin](https://pastebin.com/vtJYjqLQ):
In file included from ../../src/Pointset_Powerset_defs.hh:1454,
from ../../src/algorithms.hh:28,
from ../../src/ppl_include_files.hh:18,
from ../../src/ppl_header.hh:38,
from ../../tests/ppl_test.hh:27,
from equals1.cc:25:
../../src/Pointset_Powerset_templates.hh: In instantiation of 'Parma_Polyhedra_Library::Pointset_Powerset<PSET>::Pointset_Powerset(const Parma_Polyhedra_Library::Pointset_Powerset<QH>&, Parma_Polyhedra_Library::Complexity_Class) [with QH = Parma_Polyhedra_Library::Box<Parma_Polyhedra_Library::Interval<__gmp_expr<__mpq_struct [1], __mpq_struct [1]>, Parma_Polyhedra_Library::Interval_Info_Bitset<unsigned int, Parma_Polyhedra_Library::Test::Rational_Real_Open_Interval_Info_Policy> > >; PSET = Parma_Polyhedra_Library::NNC_Polyhedron]':
../../src/Pointset_Powerset_inlines.hh:262:43: required from 'bool Parma_Polyhedra_Library::Pointset_Powerset<PSET>::geometrically_equals(const
Parma_Polyhedra_Library::Pointset_Powerset<PSET>&) const [with PSET =
Parma_Polyhedra_Library::Box<Parma_Polyhedra_Library::Interval<__gmp_expr<__mpq_struct [1], __mpq_struct [1]>, Parma_Polyhedra_Library::Interval_Info_Bitset<unsigned int, Parma_Polyhedra_Library::Test::Rational_Real_Open_Interval_Info_Policy> > >]'
equals1.cc:44:50: required from here
../../src/Pointset_Powerset_templates.hh:66:29: internal compiler error: in type_dependent_expression_p, at cp/pt.c:25100
y_end = y.end(); i != y_end; ++i) {
~~^~~~~~~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
Preprocessed source stored into /tmp/ccb8H3zx.out file, please attach this to your bugreport.
make[7]: *** [Makefile:1245: equals1.o] Error 1
************************************************************************
Error testing package ppl-1.2.p1
********
****************************************************************number123Thu, 12 Jul 2018 11:34:50 -0500http://ask.sagemath.org/question/42970/RuntimeWarning [Sage 8.2 WSL]http://ask.sagemath.org/question/42959/runtimewarning-sage-82-wsl/Hi. I was pretty surprised to see Sage linux binaries worked on WSL right away. There's just 1 problem, which is:
```
RuntimeWarning: 'sin' and 'sout' swap memory stats couldn't be determined and were set to 0
```
Is there a fix to this?o6pThu, 12 Jul 2018 08:33:23 -0500http://ask.sagemath.org/question/42959/Unable to compile sagehttp://ask.sagemath.org/question/42894/unable-to-compile-sage/I've spent more than an hour trying to create a google account so that I can report serious problems I'm having with compiling the sagemath source code but google won't let me create an account. Its very unreasonable for sagemath to require users to create a google account just to get support. Why not use github or an independent website? Just because they are closely tied with google doesn't mean they have to force users to bend to their will.
Any way, the problem is that I get this error when trying to build sagemath on fedora 28:
Error building Sage.
The following package(s) may have failed to build (not necessarily
during this run of 'make all-start'):
* package: ppl-1.2.p1
log file: /home/user/sagemath/src/logs/pkgs/ppl-1.2.p1.log
build directory: /home/user/sagemath/inst/var/tmp/sage/build/ppl-1.2.p1
* package: zeromq-4.0.5.p2
log file: /home/user/sagemath/src/logs/pkgs/zeromq-4.0.5.p2.log
build directory: /home/user/sagemath/inst/var/tmp/sage/build/zeromq-4.0.5.p2number123Tue, 10 Jul 2018 14:41:42 -0500http://ask.sagemath.org/question/42894/Ploting ODE (unable to simplify to float approximation)http://ask.sagemath.org/question/42487/ploting-ode-unable-to-simplify-to-float-approximation/I wanted to to draw the slope field aswell as the solution for my ODE.
When I try to plot the solution i get a warning and an error.
verbose 0 (3749: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 200 points.
verbose 0 (3749: plot.py, generate_plot_points) Last error message: 'unable to simplify to float approximation'
My Code:
----------
y = function('y')(x)
a,b,c,d=var('a b c d')
_C=var('_C')
a=1
b=0
c=0
d=1
de = diff(y,x) == (a*x+b*y)/(c*x+d*y)
h = desolve(de, y, ivar=x);
h=h.substitute(_C==0)
h
y = var('y')
x = var('x')
Plot1=plot_slope_field(((a*x+b*y)/(c*x+d*y)),(x,-10,10),(y,-10,10))
Plot2=plot(h,(x,0,5))
Plot1+Plot2MarsupilamieSun, 03 Jun 2018 13:53:10 -0500http://ask.sagemath.org/question/42487/Sage wont solve simultaneous equationhttp://ask.sagemath.org/question/42174/sage-wont-solve-simultaneous-equation/I tried asking this question earlier, but my profile still says I have asked 0 questions. I have tried solving this problem in different ways, but this is the closest I have gotten;
var('a b c d e f g h i')
X=matrix(3,3,[[0,1,0],[0,0,1],[1,0,0]])
P=matrix(3,3,[[a,b,c],[d,e,f],[g,h,i]])
Pdagger=P.transpose()
Xdagger=X.transpose()
Q=X*Pdagger
B=Q.solve_left(X)
eqns=[]
xlist=[]
for i in range(0,3):
for j in range(0,3):
eqns.append(B[i][j])
xlist.append(X[i][j])
final=[]
for k in range(0,9):
final.append(eqns[k]==xlist[k])
show(final)
sol=solve(eqns,[a,b,c,d,e,f,g,h,i])
show(sol)
I know there is a solution to this problem, and it is the identity, $PXP^{\dagger}=X$.
But the output:
Error in lines 19-19
Traceback (most recent call last):
File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1013, in execute
exec compile(block+'\n', '', 'single') in namespace, locals
File "", line 1, in <module>
File "/ext/sage/sage-8.1/local/lib/python2.7/site-packages/sage/symbolic/relation.py", line 976, in solve
raise TypeError("%s is not a valid variable." % repr(i))
TypeError: 2 is not a valid variable.
There is also probably a much more efficient way of specifying the problem, but I don't understand why this wont work. I would like to extend this problem to larger matrices as well, so autonomy is welcomed. However, I would appreciate any advice just on getting this error fixed.PatrickLewisWed, 25 Apr 2018 18:23:53 -0500http://ask.sagemath.org/question/42174/how to find the syntax errorhttp://ask.sagemath.org/question/41435/how-to-find-the-syntax-error/ Hi
Here's a short code (copy-paste) that gets me syntax error
i=3
while i>0 :
print i, 'looping'
i=i-1
"<ipython-input-7-8e7eba3f21a0>", line 4
i=i-Integer(1)
I retyped it a second time; now it works, but I don't see any difference.
i=3
while i>0 :
print i, 'looping'
i=i-1
Retyping only the line 4 with the error won't help, retyping the previous lines or restarting the kernel won't help either.
It's like a phantom error florinThu, 08 Mar 2018 05:58:58 -0600http://ask.sagemath.org/question/41435/error with cosinushttp://ask.sagemath.org/question/41059/error-with-cosinus/ When I type "cos(8*pi/7)", Sage answers me
cos(1/7*pi)
wich is wrong. I exchanged with some people who had the correct answer "-cos(1/7*pi)". So I guess the problem is with my CPU or my configuration. But how to change that ?
ThankskarlusSat, 10 Feb 2018 13:32:04 -0600http://ask.sagemath.org/question/41059/line number of error in .sage filehttp://ask.sagemath.org/question/40891/line-number-of-error-in-sage-file/ When sage reports an error, it reports the line number of the `.py` file where the error occured. I am wondering if there is a way to configure sage so that it instead reports the line number of the code in the `.sage` file that ultimately generated that problematic line in the `.py` file.
This would be useful because it is the `.sage` file that I am actually editing.
This is theoretically possible: other languages and transpilers use sourcemaps to solve this same issue.ml9nnTue, 30 Jan 2018 16:47:45 -0600http://ask.sagemath.org/question/40891/notebook admin not workinghttp://ask.sagemath.org/question/40861/notebook-admin-not-working/Hello,
I have installed sagemath on debian (Stretch) with the debian package on 3 different computers.
When clicking on manage users 500: internal server error
and
raise BuildError(endpoint, values, method, self)
BuildError: Could not build url for endpoint 'users' with values ['reset']. Did you mean 'admin.users' instead?
I have no clue how to fix this or what it is due to...
maybe I need to configure notebook or use different options
Any idea ?
Thank-you,
b.
edited added debian release 9bb16Mon, 29 Jan 2018 11:37:30 -0600http://ask.sagemath.org/question/40861/Keys of a dictionaryhttp://ask.sagemath.org/question/40059/keys-of-a-dictionary/Hello guys, I have a piece of code to get a dictionary of preimages of a function. These look like this:
{[0.0]: [[0 0 0 0 0]], [1.27]: [[0 0 0 0 1]], [2.63]: [[1 1 1 0 0]], ..... , [5.619999999999999]: [[1 0 1 1 1]]}
if I look for `preimages.keys()`, I get the following:
[[0.0], [1.27], [2.63], ....... , [5.619999999999999]]
But when I try to get a particular preimage like `preimages[1.27]` I get an error
KeyError: 1.27000000000000
even though it is in a dictionary. Or if I try
preimages [[1.27]]
I get another error
TypeError: unhashable type: 'list'
Could someone please help to solve this ploblem ?XeniaSun, 10 Dec 2017 07:43:41 -0600http://ask.sagemath.org/question/40059/How is the proper form to calculate the propagation errorhttp://ask.sagemath.org/question/39618/how-is-the-proper-form-to-calculate-the-propagation-error/ Hello, my function is;
alpha = (i1.g2/(i2.g1)-1)/(t1-t2)
I will have to measure i1, i2, g1, g2, t1 and t2 them
How is the proper way to calculate the propagation error for alphaAndresThu, 16 Nov 2017 16:57:53 -0600http://ask.sagemath.org/question/39618/Call error for integers (when I haven't declared any.)http://ask.sagemath.org/question/38945/call-error-for-integers-when-i-havent-declared-any/ I'm trying to define a pretty atrocious function (that I eventually want to solve for zeroes) in three variables, k,j,N.
I tried to just use
f=sin(2*k*2*pi/N)*sin((k+1)*2*pi/N)*sin((k-1)*2*pi/N)*sin((2*j+2)*2*pi/N)*sin^2(j*2*pi/N)*sin(6*pi/N)*sin(4*pi/N)*sin(2*pi/N)+sin(2*j*2*pi/N)*sin((j+1)*2*pi/N)*sin((j-1)*2*pi/N)*sin((2*k+2)*2*pi/N)*sin(k*2*pi/N)*sin(k*2*pi/N)*sin(6*pi/N)*sin(4*pi/N)*sin(2*pi/N)+sin((k-1)*2*pi/N)*sin((2*k+2)*2*pi/N)*sin(k*2*pi/N)*sin((2*j+2)*2*pi/N)*sin(j*2*pi/N)*sin(j*2*pi/N)*sin(12*pi/N)*sin(4*pi/N)*sin(2*pi/N)+sin((j-1)*2*pi/N)*sin((2*j+2)*2*pi/N)*sin(j*2*pi/N)*sin((2*k+2)*2*pi/N)*sin(k*2*pi/N)*sin(k*2*pi/N)*sin(12*pi/N)*sin(4*pi/N)*sin(2*pi/N)-sin((k-1)*2*pi/N)*sin((j-1)*2*pi/N)*sin((2*k+2)*2*pi/N)*sin((2*j+2)*2*pi/N)*sin(k*2*pi/N)*sin(j*2*pi/N)*sin(6*pi/N)*sin(2*pi/N)* sin(8*pi/N)-sin(12*pi/N)*sin(4*(pi/N))*sin(4*(pi/N))*sin((2*k+2)*2*pi/N)*sin((2*j+2)*2*pi/N)*sin(j*2*pi/N)*sin(j*2*pi/N)*sin(k*2*pi/N)*sin(k*2*pi/N)
but I'm getting:
TypeError: 'sage.rings.integer.Integer' object is not callable
why is this, I already had that
assume(k,'real')
assume(pi/2>k>0)
assume(j,'real')
assume(pi/2>j>0)
assume(N,'real')
assume(N>0)
so what can I do to fix this error?Andres MejiaFri, 22 Sep 2017 20:17:11 -0500http://ask.sagemath.org/question/38945/Why does underscore for last output not work in worksheets uploaded from local SageMath to Cocalc?http://ask.sagemath.org/question/38820/why-does-underscore-for-last-output-not-work-in-worksheets-uploaded-from-local-sagemath-to-cocalc/My commands are like this:
vector([x1,y1,z1])
r1 = _
And I get this message:
Error in lines 1-1
Traceback (most recent call last):
File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 995, in execute
exec compile(block+'\n', '', 'single') in namespace, locals
File "", line 1, in <module>
NameError: name '_' is not defined
However, copying and pasting commands into a new worksheet make that feature work again. Why?
I have links to illustrate it, but my karma is insufficient to post them here.
Leo Luiz CastroFri, 15 Sep 2017 07:24:23 -0500http://ask.sagemath.org/question/38820/Read-only Sage" Errorhttp://ask.sagemath.org/question/38589/read-only-sage-error/ Hi all,
I am a systems administrator at University of Southern California and I am attempting to include SageMath-7.6 in our lab image (around 400 computers, thousands of students). Students log in with non-administrative active directory accounts,thus when launching SageMath-7.6 they get a "read-only" error. How significantly does this affect their use of the application? If I chmod -R 777 on the SageMath-7.6.app this corrects the issue, but (security issues aside) how does this impact other users that will be using the application and making changes to it? If application changes and configurations are not being stored in the user's profile then how does the application isolate changes from multiple users?
Thanks in advance for your assistance.dkaurlotSun, 20 Aug 2017 05:27:52 -0500http://ask.sagemath.org/question/38589/Error Building Sage 7.6 in ubuntuhttp://ask.sagemath.org/question/38041/error-building-sage-76-in-ubuntu/Hi all,
I am new to Sage. I am having trouble in installing sage 7.6 in Ubuntu 14.04. I've got this error.
Could someone help me?
Thank you all.
make build/make/Makefile
make[1]: Entering directory `/home/eric/Sage/SageMath'
make[1]: `build/make/Makefile' is up to date.
make[1]: Leaving directory `/home/eric/Sage/SageMath'
build/bin/sage-logger \
"cd build/make && ./install 'all'" logs/install.log
*** ALL ENVIRONMENT VARIABLES BEFORE BUILD: ***
CLUTTER_IM_MODULE=xim
COLORTERM=gnome-terminal
COMPIZ_CONFIG_PROFILE=ubuntu
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-XWvPOj2kHc
DEFAULTS_PATH=/usr/share/gconf/ubuntu.default.path
DESKTOP_SESSION=ubuntu
DISPLAY=:0
GDM_LANG=en_US
GDMSESSION=ubuntu
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
GNOME_KEYRING_CONTROL=/run/user/1000/keyring-Ku5pqL
GNOME_KEYRING_PID=1767
GPG_AGENT_INFO=/run/user/1000/keyring-Ku5pqL/gpg:0:1
GTK_IM_MODULE=ibus
GTK_MODULES=overlay-scrollbar:unity-gtk-module
HOME=/home/eric
IM_CONFIG_PHASE=1
INSTANCE=Unity
JOB=gnome-session
LANG=en_US.UTF-8
LANGUAGE=en_US
LESSCLOSE=/usr/bin/lesspipe %s %s
LESSOPEN=| /usr/bin/lesspipe %s
LOGNAME=eric
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:
MAKEFLAGS=
MAKELEVEL=1
MAKE=make
MANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.path
MFLAGS=
PATH=/home/eric/Sage/SageMath/build/bin:/home/eric/Sage/SageMath/src/bin:/home/eric/Sage/SageMath/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
PWD=/home/eric/Sage/SageMath/build/make
PYTHONPATH=/home/eric/Sage/SageMath/local
QT4_IM_MODULE=xim
QT_IM_MODULE=ibus
QT_QPA_PLATFORMTHEME=appmenu-qt5
SAGE_EXTCODE=/home/eric/Sage/SageMath/local/share/sage/ext
SAGE_LOCAL=/home/eric/Sage/SageMath/local
SAGE_LOGS=/home/eric/Sage/SageMath/logs/pkgs
SAGE_ORIG_PATH_SET=True
SAGE_ORIG_PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
SAGE_ROOT=/home/eric/Sage/SageMath
SAGE_SHARE=/home/eric/Sage/SageMath/local/share
SAGE_SPKG_INST=/home/eric/Sage/SageMath/local/var/lib/sage/installed
SAGE_SRC=/home/eric/Sage/SageMath/src
SAGE_VERSION=7.6
SELINUX_INIT=YES
SESSIONTYPE=gnome-session
SHELL=/bin/bash
SHLVL=3
SSH_AUTH_SOCK=/run/user/1000/keyring-Ku5pqL/ssh
TERM=xterm
TEXTDOMAINDIR=/usr/share/locale/
TEXTDOMAIN=im-config
UPSTART_EVENTS=started starting
UPSTART_INSTANCE=
UPSTART_JOB=unity-settings-daemon
UPSTART_SESSION=unix:abstract=/com/ubuntu/upstart-session/1000/1771
USER=eric
_=/usr/bin/env
V=1
VTE_VERSION=3409
WINDOWID=58720268
XAUTHORITY=/home/eric/.Xauthority
XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/usr/share/upstart/xdg:/etc/xdg
XDG_CURRENT_DESKTOP=Unity
XDG_DATA_DIRS=/usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/
XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/eric
XDG_RUNTIME_DIR=/run/user/1000
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
XDG_SEAT=seat0
XDG_SESSION_ID=c2
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
XDG_VTNR=7
XMODIFIERS=@im=ibus
***********************************************
make[1]: Entering directory `/home/eric/Sage/SageMath/build/make'
make base
make[2]: Entering directory `/home/eric/Sage/SageMath/build/make'
make[2]: Nothing to be done for `base'.
make[2]: Leaving directory `/home/eric/Sage/SageMath/build/make'
env SAGE_BUILD_TOOLCHAIN=yes make toolchain
make[2]: Entering directory `/home/eric/Sage/SageMath/build/make'
make[2]: Nothing to be done for `toolchain'.
make[2]: Leaving directory `/home/eric/Sage/SageMath/build/make'
make toolchain-deps
make[2]: Entering directory `/home/eric/Sage/SageMath/build/make'
make /home/eric/Sage/SageMath/local/var/lib/sage/installed/zlib-1.2.8.p0
make[3]: Entering directory `/home/eric/Sage/SageMath/build/make'
make[3]: `/home/eric/Sage/SageMath/local/var/lib/sage/installed/zlib-1.2.8.p0' is up to date.
make[3]: Leaving directory `/home/eric/Sage/SageMath/build/make'
make /home/eric/Sage/SageMath/local/var/lib/sage/installed/mpir-2.7.2.p0
make[3]: Entering directory `/home/eric/Sage/SageMath/build/make'
make[3]: `/home/eric/Sage/SageMath/local/var/lib/sage/installed/mpir-2.7.2.p0' is up to date.
make[3]: Leaving directory `/home/eric/Sage/SageMath/build/make'
make /home/eric/Sage/SageMath/local/var/lib/sage/installed/mpfr-3.1.5
make[3]: Entering directory `/home/eric/Sage/SageMath/build/make'
make[3]: `/home/eric/Sage/SageMath/local/var/lib/sage/installed/mpfr-3.1.5' is up to date.
make[3]: Leaving directory `/home/eric/Sage/SageMath/build/make'
make /home/eric/Sage/SageMath/local/var/lib/sage/installed/mpc-1.0.3.p0
make[3]: Entering directory `/home/eric/Sage/SageMath/build/make'
make[3]: `/home/eric/Sage/SageMath/local/var/lib/sage/installed/mpc-1.0.3.p0' is up to date.
make[3]: Leaving directory `/home/eric/Sage/SageMath/build/make'
make[2]: Leaving directory `/home/eric/Sage/SageMath/build/make'
make doc all-sage
make[2]: Entering directory `/home/eric/Sage/SageMath/build/make'
if [ -z "$SAGE_INSTALL_FETCH_ONLY" ]; then \
cd /home/eric/Sage/SageMath/src && source bin/sage-env && \
sage-logger -p 'time make sage' '/home/eric/Sage/SageMath/logs/pkgs/sagelib-7.6.log'; \
fi
[sagelib-7.6] make[3]: Entering directory `/home/eric/Sage/SageMath/src'
[sagelib-7.6] (cd . \
[sagelib-7.6] && export SAGE_ROOT=/doesnotexist \
[sagelib-7.6] SAGE_SRC=/doesnotexist \
[sagelib-7.6] SAGE_SRC_ROOT=/doesnotexist \
[sagelib-7.6] SAGE_DOC_SRC=/doesnotexist \
[sagelib-7.6] SAGE_SCRIPTS_DIR=/doesnotexist \
[sagelib-7.6] SAGE_BUILD_DIR=/doesnotexist \
[sagelib-7.6] SAGE_PKGS=/home/eric/Sage/SageMath/build/pkgs \
[sagelib-7.6] SAGE_CYTHONIZED=/home/eric/Sage/SageMath/src/build/cythonized \
[sagelib-7.6] && python -u setup.py --no-user-cfg build install)
[sagelib-7.6] /home/eric/Sage/SageMath/local/bin/python: 1: /home/eric/Sage/SageMath/local/bin/python: Syntax error: word unexpected (expecting ")")
[sagelib-7.6] make[3]: *** [sage] Error 2
[sagelib-7.6] make[3]: Leaving directory `/home/eric/Sage/SageMath/src'
[sagelib-7.6]
[sagelib-7.6] real 0m0.023s
[sagelib-7.6] user 0m0.000s
[sagelib-7.6] sys 0m0.000s
make[2]: *** [sagelib] Error 2
make[2]: Leaving directory `/home/eric/Sage/SageMath/build/make'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/eric/Sage/SageMath/build/make'
real 0m0.441s
user 0m0.084s
sys 0m0.060s
***************************************************************
Error building Sage.
The following package(s) may have failed to build (not necessarily
during this run of 'make all'):
The build directory may contain configuration files and other potentially
helpful information. WARNING: if you now run 'make' again, the build
directory will, by default, be deleted. Set the environment variable
SAGE_KEEP_BUILT_SPKGS to 'yes' to prevent this.
make: *** [all] Error 1
Eric_h22Wed, 21 Jun 2017 06:12:26 -0500http://ask.sagemath.org/question/38041/