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, 28 Jan 2020 02:02:13 -0600Why 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/sage-run received unknown option -ihttp://ask.sagemath.org/question/49094/sage-run-received-unknown-option-i/ Hello,
After typing sage -i [package name], I received the error message:
sage-run received unknown option -i
usage: sage [options]
Try 'sage -h' for more information.
What is wrong? I use version 8.1
Thanks in advance!PorcellinoFri, 20 Dec 2019 03:02:30 -0600http://ask.sagemath.org/question/49094/qsieve errorhttp://ask.sagemath.org/question/48549/qsieve-error/ I'm trying to run the qsieve function in sage (version 8.9) and I'm getting a file or directory error.
For example, when I try the code
n = next_prime(10^20)*next_prime(10^21)
q,t = qsieve(n,time = True)
I get the error,
OSError: [Errno 2] No such file or directory.
I tried looking up if there was an additional library or package I needed to download to make the qsieve function work, but I couldn't find anything. Any advice or insight would be appreciated.
JRHalesTue, 29 Oct 2019 09:44:32 -0500http://ask.sagemath.org/question/48549/'Error: Could not fork child process' while opening Sagehttp://ask.sagemath.org/question/47187/error-could-not-fork-child-process-while-opening-sage/ Hello,
SageMath 8.8 worked just fine but for a few days now whenever I open the console I get the following error:
Error: Could not fork child process: Resource temporarily unavailable (-1).
DLL rebasing may be required; see 'rebaseall / rebase --help'.
I reinstalled a few times with no luck. My Windows 10 has been updated recently so perhaps it is something in the latest update that interferes? Appreciate if anyone got around this.
Robert HTue, 16 Jul 2019 13:23:49 -0500http://ask.sagemath.org/question/47187/local variable 'Integer' referenced before assignmenthttp://ask.sagemath.org/question/41524/local-variable-integer-referenced-before-assignment/ I'll be honest I have no idea why this error is popping up, and it's really weird! I'm writing code that will generate a closed form solution to the partial sums of integer powers up to n, and this is what I have
def sum_first_n_p_powers(p):
length = p+1
vector = zero_vector(length)
matrix_list = []
for x in xrange(0,length):
copy = vector[:]
for y in xrange(0,length):
copy[y] = binomial(length-y,x-y+1)
matrix_list.append(copy)
M = Matrix(matrix_list)
solution_vector = zero_vector(length)
solution_vector[0] = 1
coeffs = M.solve_right(solution_vector)
n = var('n')
0 = polynomial
for x in xrange(0,len(coeffs)):
polynomial = polynomial + coeffs[x]*n^(length-x)
return polynomial
And when I try to run it I get the most unusual error, it just says to me
UnboundLocalError: local variable 'Integer' referenced before assignment.
I have never run into this before and have no idea what's wrong with the line. Thanks in advance!
JRHalesTue, 13 Mar 2018 20:12:23 -0500http://ask.sagemath.org/question/41524/Error with Solve() on Mac OS X 10.11.6http://ask.sagemath.org/question/34723/error-with-solve-on-mac-os-x-10116/Hello,
Downloaded Sage 7.3 (the ...64.app.dmg download) for the first time and learning the interface. I tried to solve a nonlinear equation of some complexity and got an error. I followed up with the following example from the Sage 7.3 tutorial manual:
g = var('g')
solve(g^2 + 3*g + 2, g)
and received this error (the same error as the equation of some complexity)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "_sage_input_60.py", line 10, in <module>
exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("WF9BID0gdmFyKCdYX0EnKQpERVEgPSAoRl9hMCkqKFhfQSkgPT0gVl9jCnNvbHZlKFtERVFdLCBYX0Ep"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
File "", line 1, in <module>
File "/private/var/folders/61/8zfqb4g12xl87lp5x2sk4g_r0000gn/T/tmpQtR_UQ/___code___.py", line 4, in <module>
exec compile(u'solve([DEQ], X_A)
File "", line 1, in <module>
File "/Applications/SageMath-7.3.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/symbolic/relation.py", line 810, in solve
return f[0].solve(*args,**kwds)
File "sage/symbolic/expression.pyx", line 10679, in sage.symbolic.expression.Expression.solve (/Applications/SageMath-7.3.app/Contents/Resources/sage/src/build/cythonized/sage/symbolic/expression.cpp:53735)
File "sage/symbolic/expression.pyx", line 802, in sage.symbolic.expression.Expression._maxima_ (/Applications/SageMath-7.3.app/Contents/Resources/sage/src/build/cythonized/sage/symbolic/expression.cpp:7281)
File "sage/structure/sage_object.pyx", line 673, in sage.structure.sage_object.SageObject._interface_ (/Applications/SageMath-7.3.app/Contents/Resources/sage/src/build/cythonized/sage/structure/sage_object.c:5506)
File "sage/misc/lazy_import.pyx", line 354, in sage.misc.lazy_import.LazyImport.__getattr__ (/Applications/SageMath-7.3.app/Contents/Resources/sage/src/build/cythonized/sage/misc/lazy_import.c:3486)
File "sage/misc/lazy_import.pyx", line 246, in sage.misc.lazy_import.LazyImport._get_object (/Applications/SageMath-7.3.app/Contents/Resources/sage/src/build/cythonized/sage/misc/lazy_import.c:2241)
File "/Applications/SageMath-7.3.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/interfaces/maxima_lib.py", line 105, in <module>
ecl_eval("(set-locale-subdir)")
File "sage/libs/ecl.pyx", line 1315, in sage.libs.ecl.ecl_eval (/Applications/SageMath-7.3.app/Contents/Resources/sage/src/build/cythonized/sage/libs/ecl.c:10158)
File "sage/libs/ecl.pyx", line 1330, in sage.libs.ecl.ecl_eval (/Applications/SageMath-7.3.app/Contents/Resources/sage/src/build/cythonized/sage/libs/ecl.c:10097)
File "sage/libs/ecl.pyx", line 343, in sage.libs.ecl.ecl_safe_eval (/Applications/SageMath-7.3.app/Contents/Resources/sage/src/build/cythonized/sage/libs/ecl.c:5162)
RuntimeError: ECL says: The function SET-LOCALE-SUBDIR is undefined.
Didn't get much luck with google searches on the exact cause of this, but some sources recommended installing Xcode or iPython, though I do not have any rational to connect the reccomended solution to the original problem.
Update:
I downloaded Xcode 7.3.1 and Command Tools per the instructions,(Command_Line_Tools_OS_X_10.11_for_Xcode_7.3.1).
First I downloaded Command Tools only, and tried Sage, and the result below occurred. Next I downloaded Xcode and initialized Xcode, it did not work either. In both cases the following errors occurred.
1st error on sage startup and running solve function
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "_sage_input_3.py", line 10, in <module>
exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("ZyA9IHZhcignZycpCnNvbHZlKGcrMSA9PSAwLCBnKQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
File "", line 1, in <module>
File "/private/var/folders/61/8zfqb4g12xl87lp5x2sk4g_r0000gn/T/tmpvuE3ym/___code___.py", line 4, in <module>
exec compile(u'solve(g+_sage_const_1 == _sage_const_0 , g)
File "", line 1, in <module>
File "/Applications/SageMath-7.3.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/symbolic/relation.py", line 800, in solve
ans = f.solve(*args,**kwds)
File "sage/symbolic/expression.pyx", line 10679, in sage.symbolic.expression.Expression.solve (/Applications/SageMath-7.3.app/Contents/Resources/sage/src/build/cythonized/sage/symbolic/expression.cpp:53735)
File "sage/symbolic/expression.pyx", line 802, in sage.symbolic.expression.Expression._maxima_ (/Applications/SageMath-7.3.app/Contents/Resources/sage/src/build/cythonized/sage/symbolic/expression.cpp:7281)
File "sage/structure/sage_object.pyx", line 673, in sage.structure.sage_object.SageObject._interface_ (/Applications/SageMath-7.3.app/Contents/Resources/sage/src/build/cythonized/sage/structure/sage_object.c:5506)
File "sage/misc/lazy_import.pyx", line 354, in sage.misc.lazy_import.LazyImport.__getattr__ (/Applications/SageMath-7.3.app/Contents/Resources/sage/src/build/cythonized/sage/misc/lazy_import.c:3486)
File "sage/misc/lazy_import.pyx", line 246, in sage.misc.lazy_import.LazyImport._get_object (/Applications/SageMath-7.3.app/Contents/Resources/sage/src/build/cythonized/sage/misc/lazy_import.c:2241)
File "/Applications/SageMath-7.3.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/interfaces/maxima_lib.py", line 101, in <module>
ecl_eval("(require 'maxima)")
File "sage/libs/ecl.pyx", line 1315, in sage.libs.ecl.ecl_eval (/Applications/SageMath-7.3.app/Contents/Resources/sage/src/build/cythonized/sage/libs/ecl.c:10158)
File "sage/libs/ecl.pyx", line 1330, in sage.libs.ecl.ecl_eval (/Applications/SageMath-7.3.app/Contents/Resources/sage/src/build/cythonized/sage/libs/ecl.c:10097)
File "sage/libs/ecl.pyx", line 343, in sage.libs.ecl.ecl_safe_eval (/Applications/SageMath-7.3.app/Contents/Resources/sage/src/build/cythonized/sage/libs/ecl.c:5162)
RuntimeError: ECL says: In function CAR, the value of the first argument is
#P"/Applications/SageMath-7.3.app/Contents/Resources/sage/local/var/tmp/sage/build/maxima-5.35.1.p2/src/src/numerical/f2cl-lib.lisp"
which is not of the expected type LIST
Compiling a second time yields a different error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "_sage_input_4.py", line 10, in <module>
exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("ZyA9IHZhcignZycpCnNvbHZlKGcrMSA9PSAwLCBnKQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
File "", line 1, in <module>
File "/private/var/folders/61/8zfqb4g12xl87lp5x2sk4g_r0000gn/T/tmpcyBVlM/___code___.py", line 4, in <module>
exec compile(u'solve(g+_sage_const_1 == _sage_const_0 , g)
File "", line 1, in <module>
File "/Applications/SageMath-7.3.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/symbolic/relation.py", line 800, in solve
ans = f.solve(*args,**kwds)
File "sage/symbolic/expression.pyx", line 10679, in sage.symbolic.expression.Expression.solve (/Applications/SageMath-7.3.app/Contents/Resources/sage/src/build/cythonized/sage/symbolic/expression.cpp:53735)
File "sage/symbolic/expression.pyx", line 802, in sage.symbolic.expression.Expression._maxima_ (/Applications/SageMath-7.3.app/Contents/Resources/sage/src/build/cythonized/sage/symbolic/expression.cpp:7281)
File "sage/structure/sage_object.pyx", line 673, in sage.structure.sage_object.SageObject._interface_ (/Applications/SageMath-7.3.app/Contents/Resources/sage/src/build/cythonized/sage/structure/sage_object.c:5506)
File "sage/misc/lazy_import.pyx", line 354, in sage.misc.lazy_import.LazyImport.__getattr__ (/Applications/SageMath-7.3.app/Contents/Resources/sage/src/build/cythonized/sage/misc/lazy_import.c:3486)
File "sage/misc/lazy_import.pyx", line 246, in sage.misc.lazy_import.LazyImport._get_object (/Applications/SageMath-7.3.app/Contents/Resources/sage/src/build/cythonized/sage/misc/lazy_import.c:2241)
File "/Applications/SageMath-7.3.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/interfaces/maxima_lib.py", line 105, in <module>
ecl_eval("(set-locale-subdir)")
File "sage/libs/ecl.pyx", line 1315, in sage.libs.ecl.ecl_eval (/Applications/SageMath-7.3.app/Contents/Resources/sage/src/build/cythonized/sage/libs/ecl.c:10158)
File "sage/libs/ecl.pyx", line 1330, in sage.libs.ecl.ecl_eval (/Applications/SageMath-7.3.app/Contents/Resources/sage/src/build/cythonized/sage/libs/ecl.c:10097)
File "sage/libs/ecl.pyx", line 343, in sage.libs.ecl.ecl_safe_eval (/Applications/SageMath-7.3.app/Contents/Resources/sage/src/build/cythonized/sage/libs/ecl.c:5162)
RuntimeError: ECL says: The function SET-LOCALE-SUBDIR is undefined.NeekSun, 04 Sep 2016 21:29:04 -0500http://ask.sagemath.org/question/34723/Is it possible to install sage 7.1 on OSX 10.11?http://ask.sagemath.org/question/32916/is-it-possible-to-install-sage-71-on-osx-1011/I can't get the binary app (7.1) to install on OSX 10.11 -- the same error appears with 7.2 beta0.
The install fails at the setting up the paths stage when the app is clicked for the first time.
The error is shown below. Is this fixable? Switching SIP off has no effect.
Dess-MacBook:~ des$ '/Applications/SageMath-7.1.app/Contents/Resources/sage/sage' --notebook
File "/Applications/SageMath-7.1.app/Contents/Resources/sage/relocate-once.py", line 12
print "relocate-once.py -d <destination>"
^
SyntaxError: Missing parentheses in call to 'print'
Traceback (most recent call last):
File "/Applications/SageMath-7.1.app/Contents/Resources/sage/src/bin/sage-notebook", line 7, in <module>
import argparse
File "/Applications/SageMath-7.1.app/Contents/Resources/sage/local/lib/python/argparse.py", line 85, in <module>
import collections as _collections
File "/Applications/SageMath-7.1.app/Contents/Resources/sage/local/lib/python/collections.py", line 9, in <module>
from operator import itemgetter as _itemgetter, eq as _eq
ImportError: dlopen(/Applications/SageMath-7.1.app/Contents/Resources/sage/local/lib/python2.7/lib-dynload/operator.so, 2): Symbol not found: __PyUnicodeUCS4_AsDefaultEncodedString
Referenced from: /Applications/SageMath-7.1.app/Contents/Resources/sage/local/lib/python2.7/lib-dynload/operator.so
Expected in: flat namespace
in /Applications/SageMath-7.1.app/Contents/Resources/sage/local/lib/python2.7/lib-dynload/operator.so
Dess-MacBook:~ des$
professordesWed, 30 Mar 2016 14:38:18 -0500http://ask.sagemath.org/question/32916/