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, 20 Feb 2018 08:33:49 -0600Create multivariate function of a list of variableshttp://ask.sagemath.org/question/41185/create-multivariate-function-of-a-list-of-variables/I have created a list of variables, `myvars`
I'd like to create a function of those variables, but
myvars = var('x y z')
f = function('f')(myvars)
doesn't work.
Of course in my actual code I'm creating `myvars` programatically, so doing
f = unction('f')(myvars[0], myvars[1], myvars[2])
is not convenientMLainzMon, 19 Feb 2018 12:45:29 -0600http://ask.sagemath.org/question/41185/Speed up calculation of left kernelhttp://ask.sagemath.org/question/41200/speed-up-calculation-of-left-kernel/ Is there any way to accelerate the calculation of the left kernel of a matrix? It could be by allowing sage to use more memory or using some parallelism, for instance.
I have a 1230 x 74 dense matrix over Integer Ring
A = Matrix(ZZ, 1230, 74)
and when I try to use
A.left_kernel()
the calculations doesn't finish (it has run for three days and then I interrupted the script).VitorTue, 20 Feb 2018 08:33:49 -0600http://ask.sagemath.org/question/41200/How do you calculate the branch number of a matrix?http://ask.sagemath.org/question/41152/how-do-you-calculate-the-branch-number-of-a-matrix/ Can anyone explain what a branch number is and how to calculate it? I have checked several books on matrices but it seems uncommon. In particular, the matrix:
$$02\quad 03\quad 01\quad 01$$
$$01\quad 02\quad 03\quad 01$$
$$01\quad 01\quad 02\quad 03$$
$$03\quad 01\quad 01\quad 02$$
These entries are hexadecimals (or bytes), e.g. in bits $\{02\}$ is $00000010$, and comes from the Mix column layer in the $AES$ cipher (just in case that makes a difference).
I have read this matrix has the maximum branch number of $n+1 = 5$, but I do not understand where this came from or what it means.
I also read this is an $MDS$ matrix and I think branch numbers and $MDS$ matrices are linked somehow but, again, I don't know how. I have looked for video tutorials on $MDS$ matrices and branch numbers but there is nothing for beginners.
A couple of simple examples for branch numbers and/or $MDS$ matrices would be really helpful.
Redbook1Fri, 16 Feb 2018 07:06:40 -0600http://ask.sagemath.org/question/41152/Problem solving a system of equationshttp://ask.sagemath.org/question/41197/problem-solving-a-system-of-equations/Hello everyone,
Here I copy my code in sage.
var('r2 si co r12 r22 r32 d32')
eq1 = r12==r2*d32*(1-si*(co+sqrt(3*(1-co*co)))/2)/2
eq2 = r22==r2*d32*(1-si*(co-sqrt(3*(1-co*co)))/2)/2
eq3 = r32==r2*d32*(1+si*co)/2
eq1.show()
eq2.show()
eq3.show()
solve([eq1,eq2,eq3],r2,si,co)
And this is the answer that I get when I execute:
Error in lines 1-1
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 1050, in solve
sol_list = string_to_list_of_solutions(repr(s))
File "/ext/sage/sage-8.1/local/lib/python2.7/site-packages/sage/symbolic/relation.py", line 580, in string_to_list_of_solutions
v = symbolic_expression_from_maxima_string(s, equals_sub=True)
File "/ext/sage/sage-8.1/local/lib/python2.7/site-packages/sage/calculus/calculus.py", line 2159, in symbolic_expression_from_maxima_string
raise TypeError("unable to make sense of Maxima expression '%s' in Sage"%s)
TypeError: unable to make sense of Maxima expression '[if((-pi/2<parg(-((3*_SAGE_VAR_r22-3*_SAGE_VAR_r12)*sqrt(_SAGE_VAR_r32^2+((-_SAGE_VAR_r22)-_SAGE_VAR_r12)*_SAGE_VAR_r32+_SAGE_VAR_r22^2-_SAGE_VAR_r12*_SAGE_VAR_r22+_SAGE_VAR_r12^2))/(2*_SAGE_VAR_r32^2+((-2*_SAGE_VAR_r22)-2*_SAGE_VAR_r12)*_SAGE_VAR_r32+2*_SAGE_VAR_r22^2-2*_SAGE_VAR_r12*_SAGE_VAR_r22+2*_SAGE_VAR_r12^2)))and(parg(-((3*_SAGE_VAR_r22-3*_SAGE_VAR_r12)*sqrt(_SAGE_VAR_r32^2+((-_SAGE_VAR_r22)-_SAGE_VAR_r12)*_SAGE_VAR_r32+_SAGE_VAR_r22^2-_SAGE_VAR_r12*_SAGE_VAR_r22+_SAGE_VAR_r12^2))/(2*_SAGE_VAR_r32^2+((-2*_SAGE_VAR_r22)-2*_SAGE_VAR_r12)*_SAGE_VAR_r32+2*_SAGE_VAR_r22^2-2*_SAGE_VAR_r12*_SAGE_VAR_r22+2*_SAGE_VAR_r12^2))<==pi/2),[_SAGE_VAR_co==-((2*_SAGE_VAR_r32-_SAGE_VAR_r22-_SAGE_VAR_r12)*sqrt(_SAGE_VAR_r32^2+((-_SAGE_VAR_r22)-_SAGE_VAR_r12)*_SAGE_VAR_r32+_SAGE_VAR_r22^2-_SAGE_VAR_r12*_SAGE_VAR_r22+_SAGE_VAR_r12^2))/(2*_SAGE_VAR_r32^2+((-2*_SAGE_VAR_r22)-2*_SAGE_VAR_r12)*_SAGE_VAR_r32+2*_SAGE_VAR_r22^2-2*_SAGE_VAR_r12*_SAGE_VAR_r22+2*_SAGE_VAR_r12^2),_SAGE_VAR_r2==(2*_SAGE_VAR_r32+2*_SAGE_VAR_r22+2*_SAGE_VAR_r12)/(3*_SAGE_VAR_d32),_SAGE_VAR_si==-(2*sqrt(_SAGE_VAR_r32^2+((-_SAGE_VAR_r22)-_SAGE_VAR_r12)*_SAGE_VAR_r32+_SAGE_VAR_r22^2-_SAGE_VAR_r12*_SAGE_VAR_r22+_SAGE_VAR_r12^2))/(_SAGE_VAR_r32+_SAGE_VAR_r22+_SAGE_VAR_r12)],union()),if((-pi/2<parg(((3*_SAGE_VAR_r22-3*_SAGE_VAR_r12)*sqrt(_SAGE_VAR_r32^2+((-_SAGE_VAR_r22)-_SAGE_VAR_r12)*_SAGE_VAR_r32+_SAGE_VAR_r22^2-_SAGE_VAR_r12*_SAGE_VAR_r22+_SAGE_VAR_r12^2))/(2*_SAGE_VAR_r32^2+((-2*_SAGE_VAR_r22)-2*_SAGE_VAR_r12)*_SAGE_VAR_r32+2*_SAGE_VAR_r22^2-2*_SAGE_VAR_r12*_SAGE_VAR_r22+2*_SAGE_VAR_r12^2)))and(parg(((3*_SAGE_VAR_r22-3*_SAGE_VAR_r12)*sqrt(_SAGE_VAR_r32^2+((-_SAGE_VAR_r22)-_SAGE_VAR_r12)*_SAGE_VAR_r32+_SAGE_VAR_r22^2-_SAGE_VAR_r12*_SAGE_VAR_r22+_SAGE_VAR_r12^2))/(2*_SAGE_VAR_r32^2+((-2*_SAGE_VAR_r22)-2*_SAGE_VAR_r12)*_SAGE_VAR_r32+2*_SAGE_VAR_r22^2-2*_SAGE_VAR_r12*_SAGE_VAR_r22+2*_SAGE_VAR_r12^2))<==pi/2),[_SAGE_VAR_co==((2*_SAGE_VAR_r32-_SAGE_VAR_r22-_SAGE_VAR_r12)*sqrt(_SAGE_VAR_r32^2+((-_SAGE_VAR_r22)-_SAGE_VAR_r12)*_SAGE_VAR_r32+_SAGE_VAR_r22^2-_SAGE_VAR_r12*_SAGE_VAR_r22+_SAGE_VAR_r12^2))/(2*_SAGE_VAR_r32^2+((-2*_SAGE_VAR_r22)-2*_SAGE_VAR_r12)*_SAGE_VAR_r32+2*_SAGE_VAR_r22^2-2*_SAGE_VAR_r12*_SAGE_VAR_r22+2*_SAGE_VAR_r12^2),_SAGE_VAR_r2==(2*_SAGE_VAR_r32+2*_SAGE_VAR_r22+2*_SAGE_VAR_r12)/(3*_SAGE_VAR_d32),_SAGE_VAR_si==(2*sqrt(_SAGE_VAR_r32^2+((-_SAGE_VAR_r22)-_SAGE_VAR_r12)*_SAGE_VAR_r32+_SAGE_VAR_r22^2-_SAGE_VAR_r12*_SAGE_VAR_r22+_SAGE_VAR_r12^2))/(_SAGE_VAR_r32+_SAGE_VAR_r22+_SAGE_VAR_r12)],union())]' in Sage
CrisSanzTue, 20 Feb 2018 04:52:13 -0600http://ask.sagemath.org/question/41197/ed25519 elliptic curvehttp://ask.sagemath.org/question/41187/ed25519-elliptic-curve/Is is possible to represent the elliptic curve used by the ed25519 signature scheme in Sage? How?
EllipticCurve takes parameters for the long Weierstrass form of an Elliptic curve. But I don't know how to convert the ed25519 curve to that form, if it even is possible.
Frans LundbergMon, 19 Feb 2018 14:48:55 -0600http://ask.sagemath.org/question/41187/search_doc readable formathttp://ask.sagemath.org/question/41170/search_doc-readable-format/Using Jupyter Notebook in Windows Native
The following code:
search_doc("curl", whole_word=True)
produces a bunch of unreadable lines, is there any way to make them readable?
If those lines are internet links, they should also be clickable.
Daniel
danielvolinskiSun, 18 Feb 2018 04:46:29 -0600http://ask.sagemath.org/question/41170/Hi, please help, problems using SageMath 8.1 Console to plot!http://ask.sagemath.org/question/41178/hi-please-help-problems-using-sagemath-81-console-to-plot/Hi, I am using SageMath 8.1 Console on Windows 10. First time I try to plot something I get an error: "/opt/sagemath-8.1/local/lib/python2.7/site-packages/sage/repl/rich_output/display_manager.py:590: RichReprWarning: Exception in _rich_repr_ while displaying object: 'ascii' codec can't decode byte 0xc4 in position 12: ordinal not in range(128) RichReprWarning, Graphics object consisting of 1 graphics primitive." And when I repeat the code to plot sage returns "Graphics object consisting of 1 graphics primitive" and it does not show anything i.e. it does not plot a thing. Im getting a bit hopeless here beacuse it seems like sage is running the code properly (beacuse it is a simple plot) but it does not want to show the result image for some reason. Please help! The code to plot I was using is: x=var('x') plot(x+2, (x,0,5))maria_exeMon, 19 Feb 2018 02:24:10 -0600http://ask.sagemath.org/question/41178/Pullback of idealshttp://ask.sagemath.org/question/41171/pullback-of-ideals/Hi.
I have the the following question and I hope that somebody of you has a good idea for the implementation and an explanation of the error.
**Offset**:
- A number field K (in general non Galois)
- L the Galois closure of K
- phi: K --> L an arbitrary embedding of K into L
- I a fractional ideal in K and IL = phi(I)
**Question**:
How to compute the pullback of IL for (general) fractional ideals of K?
**My approach**:
- Let V, W be two QQ vector spaces and f: V --> W a linear map (morphism).
Let further V' and W' be subspaces of V and W.
- The aim is to identify the subspace V' = f^(-1)(W') as the preimage of W' under f.
- Let p: V x W' --> W be a linear map definied by (v,w')|--> f(v) - w' with
ker(p):={(v,w')in V x W'| f(v)-w' = 0_W} = {(v,w'): f(v) = w'}.
Such vectors v are the vectors in the preimage of W'.
def inverseImage(IL, K, phi):
ZK = K.maximal_order()
dK = K.degree()
BZK = ZK.basis()
M = Matrix(QQ, [ list(phi(b)) for b in BZK ])
BJ = IL.basis()
N = Matrix(QQ, [ list(b) for b in BJ ])
vs = M.stack(N).integer_kernel().basis()
BI = [ sum([ v[i]*BZK[i] for i in [0..(dK - 1)] ]) for v in vs ]
IK = ZK.fractional_ideal([num_IL/denom_IL, BI])
return IK
**EXAMPLE 1**:
sage: K = NumberField(x^6 - 2*x^5 - 6*x^3 + 151*x^2 + 76*x + 861, 'a')
sage: L.<b> = K.galois_closure()
sage: phi = K.embeddings(L)[1]
sage: I = K.fractional_ideal([129, x - 54])
sage: I_ = inverseImage(IL, K, phi)
sage: I_ == I
TRUE
**EXAMPLE 2 (and the first problem, loosing the denominator)**
sage: I = K.fractional_ideal([2/3])
sage: I
Fractional ideal (2/3)
sage: I_ = inverseImage(phi(I), K, phi)
sage: I_
Fractional ideal (2)
sage: I == I_
FALSE
**My improvement approach:**
...
num_IL = IL.numerator().gens()[0]
denom_IL = IL.denominator().gens()[0]
IK = ZK.fractional_ideal([num_IL/denom_IL, BI])
return IK
Now EXAMPLE 2 returns the corresponding fractional ideal I_ **BUT** with an incorrect ideal I_ in EXAMPLE 1.
Thanks for helping!bdSun, 18 Feb 2018 08:15:17 -0600http://ask.sagemath.org/question/41171/file with extension swshttp://ask.sagemath.org/question/40136/file-with-extension-sws/ Hi All,
I downloaded several SageMath files with extension sws, but I am unable to open them with SageMath 8.0 on Windows native. Is there any translator from sws to ipynb file? How should I proceed?
Thanks,
Daniel
danielvolinskiWed, 13 Dec 2017 08:06:09 -0600http://ask.sagemath.org/question/40136/'CyclicCode_with_category' object has no attribute 'gen_mat'http://ask.sagemath.org/question/41150/cycliccode_with_category-object-has-no-attribute-gen_mat/I am trying to create the generator matrix for Quadratic Residue code and the code I am using is:
def gen_matrices(n):
C = codes.QuadraticResidueCode(n, GF(2))
D = C.dual_code()
G = C.gen_mat()
H = D.gen_mat()
J = G.transpose() * (G * G.transpose())^-1
K = H.transpose() * (H * H.transpose())^-1
if rank(block_matrix([[G],[H]]))!=G.ncols()\
or G * H.transpose ()!=0:
raise("Logic error: The code is not LCD")
return [ G, H, J, K ]
gen_matrices(17)
Here I am first generating the QR code, where G is the generator matrix for the code C and H is the generator matrix for the cyclic code D. So after the encoding is done we now do XOR operation of the two codes - z = xG (XOR) yH. Now I want to do decoding and here J and K are the matrices which are used for doing decoding. Here J is given by J = G.Transpose*(G*G.Transpose)^-1.
Here I am running a code that is being used in a paper.
The paper is (https://hal.archives-ouvertes.fr/hal-01240242/document).
When I am running the code I am getting the following error:
AttributeError Traceback (most recent call last)
<ipython-input-2-68b96fb2983c> in <module>()
----> 1 gen_matrices(Integer(17))
<ipython-input-1-f09fbcf52b0e> in gen_matrices(n)
2 C = codes.QuadraticResidueCode(n, GF(Integer(2)))
3 D = C.dual_code()
----> 4 G = C.gen_mat()
5 H = D.gen_mat()
6 J = G.transpose() * (G * G.transpose())**-Integer(1)
/opt/sagemath-8.1/src/sage/structure/category_object.pyx in sage.structure.categ ory_object.CategoryObject.__getattr__ (build/cythonized/sage/structure/category_ object.c:8014)()
854 AttributeError: 'PrimeNumbers_with_category' object has no a ttribute 'sadfasdf'
855 """
--> 856 return self.getattr_from_category(name)
857
858 cdef getattr_from_category(self, name):
/opt/sagemath-8.1/src/sage/structure/category_object.pyx in sage.structure.categ ory_object.CategoryObject.getattr_from_category (build/cythonized/sage/structure /category_object.c:8177)()
869 cls = self._category.parent_class
870
--> 871 attr = getattr_from_other_class(self, cls, name)
872 self.__cached_methods[name] = attr
873 return attr
/opt/sagemath-8.1/src/sage/cpython/getattr.pyx in sage.cpython.getattr.getattr_f rom_other_class (build/cythonized/sage/cpython/getattr.c:1837)()
247 dummy_error_message.cls = type(self)
248 dummy_error_message.name = name
--> 249 raise dummy_attribute_error
250 cdef PyObject* attr = _PyType_Lookup(<type>cls, name)
251 if attr is NULL:
AttributeError: 'CyclicCode_with_category' object has no attribute 'gen_mat'
Can anyone please suggest what I need to do?SubhajitFri, 16 Feb 2018 00:41:37 -0600http://ask.sagemath.org/question/41150/Sage 8.1: jupyter does not start on MacOS Sierrahttp://ask.sagemath.org/question/41155/sage-81-jupyter-does-not-start-on-macos-sierra/I have just installed Sage 8.1 on MacOS Sierra. After I launch the application, I am told Jupyter did not start and I get offered to open the log. Doing so, here is what I get there
```
/Applications/SageMath-8.1.app/Contents/Resources/sage/src/bin/sage-env: line 322: [: /Applications/SageMath-8.1: binary operator expected
Traceback (most recent call last):
File "/Applications/SageMath-8.1.app/Contents/Resources/sage/src/bin/sage-notebook", line 13, in <module>
from sage.env import SAGE_ROOT
ImportError: No module named sage.env
```
ljboFri, 16 Feb 2018 16:25:43 -0600http://ask.sagemath.org/question/41155/How to find all the sub-square matrices of an 4x4 matrix and all their determinantshttp://ask.sagemath.org/question/41136/how-to-find-all-the-sub-square-matrices-of-an-4x4-matrix-and-all-their-determinants/ 1. I need to find all the sub-square matrices of a $4 \times 4$ matrix.
2. Then find the determinant of all $70$ of them.
I was directed to Sage but I know little about it. A simple program would be much appreciated.
For example, the matrix below:
$$2\quad 3\quad 1\quad 1$$
$$1\quad 2\quad 3\quad 1$$
$$1\quad 1\quad 2\quad 3$$
$$3\quad 1\quad 1\quad 2$$
Thanks to anyone who can help. Redbook1Thu, 15 Feb 2018 13:24:16 -0600http://ask.sagemath.org/question/41136/"mesh=" juypter vs. -notebookhttp://ask.sagemath.org/question/35802/mesh-juypter-vs-notebook/Perhaps I should send this to some devel or support group ?
Starting command line:
sage -notebook
Comes up and executes:
var('x,y')
plot3d(sin(x-y)*y*cos(x),(x,-3,3),(y,-3,3), mesh=True)
Correctly.
Whereas:
sage -n jupyter
Fails with miscellaneous assertion type errors.
sagemath 7.3 in both cases.
A friend also point out the option "color='yellow' " also fails in jupyter.
----------
Edit (slelievre):
I confirm I can observe this also with Sage 7.4. Here is the error message I get:
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-3-44b2387a145a> in <module>()
----> 1 plot3d(sin(x-y)*y*cos(x),(x,-Integer(3),Integer(3)),(y,-Integer(3),Integer(3)), mesh=True)
/opt/s/sage-7.4/local/lib/python2.7/site-packages/IPython/core/displayhook.pyc in __call__(self, result)
244 self.start_displayhook()
245 self.write_output_prompt()
--> 246 format_dict, md_dict = self.compute_format_data(result)
247 self.update_user_ns(result)
248 self.fill_exec_result(result)
/opt/s/sage-7.4/local/lib/python2.7/site-packages/IPython/core/displayhook.pyc in compute_format_data(self, result)
148
149 """
--> 150 return self.shell.display_formatter.format(result)
151
152 # This can be set to True by the write_output_prompt method in a subclass
/opt/s/sage-7.4/local/lib/python2.7/site-packages/sage/repl/display/formatter.pyc in format(self, obj, include, exclude)
158 # First, use Sage rich output if there is any
159 PLAIN_TEXT = u'text/plain'
--> 160 sage_format, sage_metadata = self.dm.displayhook(obj)
161 assert PLAIN_TEXT in sage_format, 'plain text is always present'
162 if sage_format.keys() != [PLAIN_TEXT]:
/opt/s/sage-7.4/local/lib/python2.7/site-packages/sage/repl/rich_output/display_manager.pyc in displayhook(self, obj)
764 self._backend.set_underscore_variable(obj)
765 plain_text, rich_output = self._rich_output_formatter(obj, dict())
--> 766 return self._backend.displayhook(plain_text, rich_output)
767
768 def display_immediately(self, obj, **rich_repr_kwds):
/opt/s/sage-7.4/local/lib/python2.7/site-packages/sage/repl/rich_output/backend_ipython.pyc in displayhook(self, plain_text, rich_output)
525 from sage.repl.display.jsmol_iframe import JSMolHtml
526 jsmol = JSMolHtml(rich_output, height=500)
--> 527 return ({u'text/html': jsmol.iframe(),
528 u'text/plain': plain_text.text.get_unicode(),
529 }, {})
/opt/s/sage-7.4/local/lib/python2.7/site-packages/sage/repl/display/jsmol_iframe.py in iframe(self)
259 </iframe>
260 """
--> 261 escaped_inner_html = self.inner_html().replace('"', '"')
262 iframe = IFRAME_TEMPLATE.format(
263 script=self.js_script(),
/opt/s/sage-7.4/local/lib/python2.7/site-packages/sage/repl/display/jsmol_iframe.py in inner_html(self)
235 """
236 return INNER_HTML_TEMPLATE.format(
--> 237 script=self.js_script(),
238 width=self._width,
239 height=self._height,
/opt/s/sage-7.4/local/lib/python2.7/site-packages/sage/repl/display/jsmol_iframe.py in js_script(self)
193 """
194 script = [r"["]
--> 195 for line in self.script().splitlines():
196 script += [r" '{0}',".format(line)]
197 script += [r"].join('\n');"]
/opt/s/sage-7.4/src/sage/misc/cachefunc.pyx in sage.misc.cachefunc.CachedMethodCallerNoArgs.__call__ (/opt/s/sage-7.4/src/build/cythonized/sage/misc/cachefunc.c:12716)()
2399 if self.cache is None:
2400 f = self.f
-> 2401 self.cache = f(self._instance)
2402 return self.cache
2403
/opt/s/sage-7.4/local/lib/python2.7/site-packages/sage/repl/display/jsmol_iframe.py in script(self)
156 command, obj, meshfile = line.split(' ', 3)
157 assert command == 'pmesh'
--> 158 assert meshfile.startswith('"') and meshfile.endswith('"\n')
159 meshfile = meshfile[1:-2] # strip quotes
160 script += [
AssertionError:rrogersTue, 29 Nov 2016 17:42:58 -0600http://ask.sagemath.org/question/35802/Sage is probably interfering with anacondahttp://ask.sagemath.org/question/39866/sage-is-probably-interfering-with-anaconda/I think Sage is interfering with anaconda, and I want to remove check if this is so. For I saw that to uninstall sage (I'm on a Mac) I just need to put it in the trash. Is this so? If I put it in the trash and still cannot run Jupyter from anaconda, does it mean that I have some other problem? roi.holtzmanFri, 01 Dec 2017 02:31:27 -0600http://ask.sagemath.org/question/39866/Can Jupyter notebook run simultaneously with sage?http://ask.sagemath.org/question/37791/can-jupyter-notebook-run-simultaneously-with-sage/I'm running Sage notebook and at the same time, I'm trying to run Jupyter notebook.
I get the following error:
Last login: Sun Jun 4 22:21:20 on ttys005
Rois-MBP:~ roi$ /anaconda/bin/jupyter_mac.command ; exit;
[W 22:32:09.192 NotebookApp] Unrecognized JSON config file version, assuming version 1
Traceback (most recent call last):
File "/anaconda/bin/jupyter-notebook", line 6, in <module>
sys.exit(notebook.notebookapp.main())
File "//anaconda/lib/python3.5/site-packages/jupyter_core/application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "//anaconda/lib/python3.5/site-packages/traitlets/config/application.py", line 595, in launch_instance
app.initialize(argv)
File "<decorator-gen-7>", line 2, in initialize
File "//anaconda/lib/python3.5/site-packages/traitlets/config/application.py", line 74, in catch_config_error
return method(app, *args, **kwargs)
File "//anaconda/lib/python3.5/site-packages/notebook/notebookapp.py", line 1069, in initialize
self.init_configurables()
File "//anaconda/lib/python3.5/site-packages/notebook/notebookapp.py", line 837, in init_configurables
parent=self,
File "//anaconda/lib/python3.5/site-packages/nb_conda_kernels/manager.py", line 19, in __init__
specs = self.find_kernel_specs() or {}
File "//anaconda/lib/python3.5/site-packages/nb_conda_kernels/manager.py", line 129, in find_kernel_specs
self.conda_info = self._conda_info()
File "//anaconda/lib/python3.5/site-packages/nb_conda_kernels/manager.py", line 29, in _conda_info
p = subprocess.check_output(["conda", "info", "--json"]
File "//anaconda/lib/python3.5/subprocess.py", line 626, in check_output
**kwargs).stdout
File "//anaconda/lib/python3.5/subprocess.py", line 693, in run
with Popen(*popenargs, **kwargs) as process:
File "//anaconda/lib/python3.5/subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "//anaconda/lib/python3.5/subprocess.py", line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'conda'
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
Is there a way to run both at the same time?
P.S. I'm working on a Mac.
Even when Sage is closed, Jupyter doesn't run. Other apps like spyder do run.roi.holtzmanSun, 04 Jun 2017 14:39:57 -0500http://ask.sagemath.org/question/37791/Converting strings into expressionshttp://ask.sagemath.org/question/41135/converting-strings-into-expressions/ Hey everyone,
This is probably pretty straightforward, but I couldn't find any straightforward answers with google searching. I'm looking for a function that works in the same way as python's str() and float() functions, but turns variables (especially strings) into sage's different classes of variables, like expressions.
For example, if I have string variable:
expression = "x1^2*x2*x3*4"
and x1, x2, and x3 are already declared as variables, how can I turn that variable into a sage expression so it will work with things like the coefficient() function?
Thanks!trenzafeedsThu, 15 Feb 2018 13:02:49 -0600http://ask.sagemath.org/question/41135/Admin Password wrong, another notebook runninghttp://ask.sagemath.org/question/41033/admin-password-wrong-another-notebook-running/Hello, I have updated to High Sierra and am now having problem logging into my Sage notebook. I've tried reset(notebook=True). Sage said:
Please login to the notebook with the username 'admin' and the above password.
Password changed for user 'admin'.
Another Sage Notebook server is running, PID 3229.
Opening web browser at
How should I fix this? Any help appreciated.
A similar question to this one [link text](https://ask.sagemath.org/question/35317/how-can-i-log-in-to-my-sage-v-72-notebook/)
Another similar question to this one [link text](https://ask.sagemath.org/question/37818/installationupdate-issue-another-sage-notebook-server-is-running/)
Update: I've reinstalled SageMath 8.1 and changed directory (i.e. I used to put the Sage folder in Application and now I put in on desktop). Then when I typed in the command notebook(), I got
localhost is currently unable to handle this request.
HTTP ERROR 500
And it seems that reinstallation doesn't solve the "another notebook running" problem.
Any help is appreciated!j453w588Thu, 08 Feb 2018 08:57:26 -0600http://ask.sagemath.org/question/41033/trying to plot the phase angle of a Laplace transfer functionhttp://ask.sagemath.org/question/41116/trying-to-plot-the-phase-angle-of-a-laplace-transfer-function/hello,
I'm new to sagemath and while i was trying to dig into it i came across the following problem
see my small program...
n=1;1;1000
T1=0.1 w=2*pi*10*n/1000
S=I*w
F(S)=1/(1+S*T1)
P1=plot_loglog(abs(F), xmin=0.1, xmax=100.0, ymin=0.1)
P2=plot_semilogx(arg(F), xmin=0.1, xmax=100.0, ymax=0, ymin=-90)
P=P1+P1 p.show()
I'm getting the following error message:
I dont know how to fix this, i would really apreciate if one can give me some hints...
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-1-b52c0c8fff57> in <module>()
8
9 P1=plot_loglog(abs(F), xmin=RealNumber('0.1'), xmax=RealNumber('100.0'), ymin=RealNumber('0.1'))
---> 10 P2=plot_semilogx(arg(F), xmin=RealNumber('0.1'), xmax=RealNumber('100.0'), ymax=Integer(0), ymin=-Integer(90))
11 P=P1+P1
12 p.show()
/home/sc_serv/sage/src/sage/symbolic/function.pyx in sage.symbolic.function.BuiltinFunction.__call__ (build/cythonized/sage/symbolic/function.cpp:11602)()
992 res = self._evalf_try_(*args)
993 if res is None:
--> 994 res = super(BuiltinFunction, self).__call__(
995 *args, coerce=coerce, hold=hold)
996
/home/sc_serv/sage/src/sage/symbolic/function.pyx in sage.symbolic.function.Function.__call__ (build/cythonized/sage/symbolic/function.cpp:6439)()
472 if callable(method):
473 return method()
--> 474 raise TypeError("cannot coerce arguments: %s" % (err))
475
476 else: # coerce == False
TypeError: cannot coerce arguments: no canonical coercion from Callable function ring with argument S to Symbolic RingMatrinWed, 14 Feb 2018 02:47:54 -0600http://ask.sagemath.org/question/41116/Sagemath on Windows 10?http://ask.sagemath.org/question/32930/sagemath-on-windows-10/ Hello all. Today, I could come up with the following news(you can google "microsoft-canonical-bring-ubuntu-linux-on-windows-10". Sorry for not writing the link, since my karma is low...)
As far as I understand, I guess it means that one can install sagemath in windows 10, directly - not using virtualbox.
In fact, in earlier versions of MS windows, like windows 7, it seemed that one should run virtualbox to run sagemath
on one's computer.
Maybe using cloud computing in sagemath homepage would be better, but I don't prefer that.
When only considering using sagemath, it would be more convenient to use Linux.
So, if the news is true, then I can directly download and install sagemath in windows 10.
Is my understanding correct?
Or is there anybody who already tried this?prosolverThu, 31 Mar 2016 10:03:59 -0500http://ask.sagemath.org/question/32930/terminal for sage/ipython/virtualbox on Windows 10http://ask.sagemath.org/question/33457/terminal-for-sageipythonvirtualbox-on-windows-10/ Just started using sage on Windows 10. When I invoke VB and start Sage-7.2, it loads Jupyter. Right-Ctrl does not work. How do I get a terminal after Jupyter loads? I wish to use Sage interactively on the command line. Thanks, CCccc31807Thu, 19 May 2016 21:33:52 -0500http://ask.sagemath.org/question/33457/Problem : ImageMagick and animatehttp://ask.sagemath.org/question/41082/problem-imagemagick-and-animate/Hi,
I have Sage 8.1 and ImageMagick (installed from 7.0.7-22-Q16-x64-dll.exe) installed on W10.
When I execute in Sage Notebook :
sines = [plot(c*sin(x), (-2*pi,2*pi), color=Color(c,0,0), ymin=-1, ymax=1) for c in sxrange(0,1,.2)]
a = animate(sines)
a.show()
I get this :
convert.exe: unable to open image
'/dot_sage/temp/my_desktop/17724/tmp_bfv0BC.gif': No such file or
directory @ error/blob.c/OpenBlob/3335.
Animation with 5 frames
And I have no animation.
How can I solve this ?
Thank youkrokoMon, 12 Feb 2018 16:44:56 -0600http://ask.sagemath.org/question/41082/Installing on Windows 10http://ask.sagemath.org/question/34350/installing-on-windows-10/ Trying to install ova 7.2. All I get when running it is screen that looks like its for getting the build code. Tried VBox. Didn't like it and now using VM Player, but still can't get to notebook. (You need to quit recommending VBox for Windows. Doesn't support Windows 10 well.)
Is it hard to make new virtual machine with guest Linux OS and install Linux binary on it? Seems ova is very non-secure. Network enabled, seems I'm inviting malware in.
MikeMike56765Fri, 05 Aug 2016 20:59:32 -0500http://ask.sagemath.org/question/34350/SageMath as a regular python packagehttp://ask.sagemath.org/question/40947/sagemath-as-a-regular-python-package/If one were to endeavor converting SageMath into a regular python package, which parts would be easy to convert and which would be difficult?
Why didn't sage start out as a regular python package in the first place?
I imagine such a conversion project ending up with a package that can be installed with pip or conda. After the package is installed any python script can import sage and can be run with the system's plain old python binary.
johnny pythonFri, 02 Feb 2018 17:00:07 -0600http://ask.sagemath.org/question/40947/implicit plot with different scales on x and y axeshttp://ask.sagemath.org/question/41110/implicit-plot-with-different-scales-on-x-and-y-axes/ Say I want to plot `implicit_plot(x^2 + 10000*y^2 - 2, (x,-3,3), (y,-0.03,0.03))`, or anything else where the interesting values of x and y varies over different orders of magnitude. At least on my machine, the result is a completely illegible png, squished into nothingness.
http: // i187.photobucket.com/albums/x207/pratarpersilja/scaling_unusable_zpsspbvecof.png
(I wasn't allowed to add clickable links).
Of course, in this particular case I could rewrite the expression manually until the x and y ranges are the same. In the case that inspired these experiments in the first place, that rewrite is not realistic to do by hand.
How do I force an implicit plot to not have the same number of pixels per numerical unit in x and y directions?pratarpersiljaTue, 13 Feb 2018 22:03:13 -0600http://ask.sagemath.org/question/41110/Solving system of polynomial inequalities in SageMath 8.1http://ask.sagemath.org/question/41056/solving-system-of-polynomial-inequalities-in-sagemath-81/ Hi everyone!
I am currently trying to use SageMath for the solution of a system of polynomial inequalities. In the first place based on the documentation and because solutions were returned I used the "solve" command and the "solve_ineq" command. However, when I tried to verify the answers with the one computed by Mathematica I realised the solutions were not the same. Is this a bug in the current version?
Also, I am trying to do it the normal way by computing the CAD using QEPCAD but when I tried to replicate the example on the website I get the following error:
> RuntimeError: unable to start QEPCAD
I am using SageMath 8.1 in Windows 7 64bit and jupyter notebook for interface that I call using the SageMath shell, if that is of any help.
The system I am referring to is the following:
> sys=[0.800000000000000*theta1*x1 + 0.100000000000000*theta2*x2 - 24000,
0.100000000000000*theta2*x2 + 0.0500000000000000*x1 - 2000,
0.100000000000000*x1 + 0.360000000000000*x2 - 6000,
-x1, -x2, -theta1 - 5, theta1 - 5, -theta2 - 5, theta2 - 5, -lamda1, -lamda2, -lamda3, -lamda4, -lamda5]
and using the following substitution:
> sol=[x1 == 440000/(16*theta1 - 1),
x2 == 80000*(4*theta1 - 3)/(16*theta1*theta2 - theta2),
lamda1 == 54*(3*theta2 - 2)/(16*theta1*theta2 - theta2),
lamda2 == 54*(32*theta1 - 3*theta2)/(16*theta1*theta2 - theta2),
lamda3 == 0, lamda4 == 0, lamda5 == 0]
The output of
> solve([sys[i].subs(sol)<=0 for i in range(0,len(sys))], theta1, theta2)
is
> []
Sorry for the long post but I would really appreciate and help with regards on how to solve such as system of inequalities and whether solve command has a bug?
Best,
Jason JasonKSat, 10 Feb 2018 07:58:03 -0600http://ask.sagemath.org/question/41056/Run Java in Sagemath! AWESOME! But i got errors/comment/warning!http://ask.sagemath.org/question/40994/run-java-in-sagemath-awesome-but-i-got-errorscommentwarning/Hi im a running this:
https://cocalc.com/share/8668c880-b850-4069-87b0-9bc2c0f28cf6/java/Aufg1.java?viewer=share
But I get this error/comment/warning:
Picked up _JAVA_OPTIONS: -Djava.io.tmpdir=/home/user/tmp/ -Xms64m
Is there a way to enable the edditor to recognise java use some highlights, or like this?thethaTue, 06 Feb 2018 04:46:00 -0600http://ask.sagemath.org/question/40994/plot_vector_field3d and three.js viewerhttp://ask.sagemath.org/question/41091/plot_vector_field3d-and-threejs-viewer/ I guess there might be some mistake in my code, but I cannot use `plot_vector_field3d` and show the result with `three.js` viewer. The code is
var('x y z')
f = (x, y, z)
show(plot_vector_field3d(f, (x,-3,3), (y,-3,3), (z,-3,3), aspect_ratio=1), viewer='threejs')
and it only shows an empty box. How to explain this behaviour?jepstraTue, 13 Feb 2018 05:56:22 -0600http://ask.sagemath.org/question/41091/piecewise defined function via defhttp://ask.sagemath.org/question/41061/piecewise-defined-function-via-def/I've made the following experiment with Sage:
def f(x):
if (0<= x<= 1/2):
return 1
else:
return 0
assume(0<= x<= 1/2)
show(f(x))
show(f(1/3))
However I get outputs 0 and 1 respectively. Can someone clarify please? Thanks.newuserSat, 10 Feb 2018 20:43:20 -0600http://ask.sagemath.org/question/41061/how to enter comments?http://ask.sagemath.org/question/9341/how-to-enter-comments/I'm making an assumption that this is even possible, as I cannot find anything about it in the documentation. How does one enter comments (eg just text that is not to be evaluated) into a worksheet?draeathWed, 08 Jan 2014 13:02:13 -0600http://ask.sagemath.org/question/9341/Import error with pydotplushttp://ask.sagemath.org/question/41078/import-error-with-pydotplus/ Hello,
I am running Sagemath 7.3 on Linux. I would like to export a graph using the export function of the graph, but I get the error
`
ImportError: No module named pydotplus`
The python module pydotplus was already installed with `pip install pydotplus`
I cannot find any help regarding this issue. Any suggestion?
Thank you in advance for your helpluno_TMon, 12 Feb 2018 07:55:11 -0600http://ask.sagemath.org/question/41078/