Ask Your Question

LMN's profile - activity

2021-05-15 16:06:12 +0200 received badge  Popular Question (source)
2020-10-19 17:54:57 +0200 received badge  Famous Question (source)
2020-04-27 23:39:52 +0200 received badge  Famous Question (source)
2018-03-22 17:14:22 +0200 received badge  Notable Question (source)
2016-04-20 18:55:22 +0200 received badge  Popular Question (source)
2015-01-13 21:18:44 +0200 received badge  Notable Question (source)
2015-01-13 21:18:44 +0200 received badge  Popular Question (source)
2014-01-27 08:54:25 +0200 received badge  Student (source)
2013-08-24 18:11:57 +0200 marked best answer Approximate real numbers by rationals

You can use the method nearby_rational which works for real numbers. If you do have a symbolic expression, you first have to take a numerical approximation as in

sage: pi.n().nearby_rational()

The term pi may be replaced by any symbolic expression.

2013-08-21 13:52:33 +0200 asked a question Approximate real numbers by rationals

Does sage have routines to approximate real numbers by fractions:

For example, suppose 13.000000000000000000001 is an approximation of a complicated expression involving $pi, e$ and other transcendental constants. Then it "is probably" a rational number. Can sage tell me what rational number it "probably" is.

2013-08-18 19:37:28 +0200 received badge  Editor (source)
2013-08-18 19:20:41 +0200 asked a question Passing ideals between Macaulay and Sage

During some sage code, I'd like to take an ideal, send it to Macaulay2, do some computations with it, and then continue to use the new ideal in sage.

Are there smart ways to do this? I'm currently doing it by converting all variables/equations to strings, and using string maniuplations to produce valid macaulay2 commands. More concretely:

1.) Define the same ring in Macaulay2 via:

(my rings are Z-algebras):
l = R.cover_ring().variable_names(); #variable names
m = R.defining_ideal().gens(); #generators of ideal
T = "R = ZZ[" + ", ".join(str(z) for z in l) + "]/("+ ",".join(str(z) for z in m)  +")" ;

2.) Then, I can define an ideal I and do some computations with it.

3.) Question: I can print the generators of I via

macaulay2("toString gens I");

and then, again using string maniuplations remove the "matrix {{" and "}}" from Macaulay2's output, split the string to get a list which can be then be interpreted as generators of an ideal in sage.

Is there a better way to do any of these steps?

2013-08-18 19:03:42 +0200 received badge  Supporter (source)
2013-08-18 12:24:59 +0200 received badge  Scholar (source)
2013-08-18 12:24:59 +0200 marked best answer Sage worksheet doesn't allow tab completion or evaluation. Crashes

Looks like the history pickle is corrupted. You can probably delete it (backup first obviously). Its somewhere in the .sage/sage_notebook.sagenb tree, to find it just search:

find ~/.sage | grep history.pickle
2013-08-18 12:24:56 +0200 commented answer Sage worksheet doesn't allow tab completion or evaluation. Crashes

Thank you so much Volker!!!

2013-08-17 15:29:08 +0200 asked a question Sage worksheet doesn't allow tab completion or evaluation. Crashes

I used to be able to use the Sage 5.10 notebook (installed from the Ubuntu ppa) without any problems. Now, when I type sage at the command prompt and start the notebook the notebook opens fine and I can see and edit my previous worksheets.

However, I can't evaluate any cells or use tab-completion. Eg, if I create a new worksheet and type E = EllipticCurve("11a") or if I type E = Ellipt and then hit [tab] the worksheet just stalls indefinitely. The sage console displays some errors. I tried searching around but I couldn't find anything like it online. I get the same errors after upgrading to version 5.11, and from using a copy of sage downloaded from the website instead of the Ubuntu ppa.

The notebook files are stored in: sage_notebook.sagenb

  • *
  • Open your web browser to http://localhost:8080 *
  • *

Executing twistd --pidfile="sage_notebook.sagenb/" -ny "sage_notebook.sagenb/twistedconf.tac" 2013-08-17 13:19:21-0500 [-] Log opened. 2013-08-17 13:19:21-0500 [-] twistd 12.3.0 (/usr/lib/sagemath/local/bin/python 2.7.5) starting up. 2013-08-17 13:19:21-0500 [-] reactor class: twisted.internet.epollreactor.EPollReactor. 2013-08-17 13:19:21-0500 [-] QuietSite starting on 8080 2013-08-17 13:19:21-0500 [-] Starting factory <__builtin__.QuietSite instance at 0x6e96ab8>

(process:3245): GLib-CRITICAL *: g_slice_set_config: assertion `sys_page_size == 0' failed 2013-08-17 13:19:44-0500 [-] WSGI application error Traceback (most recent call last): File "/usr/lib/sagemath/local/lib/python2.7/site-packages/Twisted-12.3.0-py2.7-linux-x86_64.egg/twisted/python/", line 195, in _worker o = self.q.get() File "/usr/lib/sagemath/local/lib/python2.7/site-packages/Twisted-12.3.0-py2.7-linux-x86_64.egg/twisted/python/", line 118, in callWithContext return self.currentContext().callWithContext(ctx, func, *args, *kw) File "/usr/lib/sagemath/local/lib/python2.7/site-packages/Twisted-12.3.0-py2.7-linux-x86_64.egg/twisted/python/", line 83, in callWithContext self.contexts.pop() File "/usr/lib/sagemath/local/lib/python2.7/site-packages/Twisted-12.3.0-py2.7-linux-x86_64.egg/twisted/web/", line 340, in run self.started = True --- <exception caught="" here=""> --- File "/usr/lib/sagemath/local/lib/python2.7/site-packages/Twisted-12.3.0-py2.7-linux-x86_64.egg/twisted/web/", line 315, in run appIterator = self.application(self.environ, self.startResponse) File "/usr/lib/sagemath/local/lib/python2.7/site-packages/Flask-0.9-py2.7.egg/flask/", line 1701, in __call__ return self.wsgi_app(environ, start_response) File "/usr/lib/sagemath/local/lib/python2.7/site-packages/Flask-0.9-py2.7.egg/flask/", line 1689, in wsgi_app response = self.make_response(self.handle_exception(e)) File "/usr/lib/sagemath/local/lib/python2.7/site-packages/Flask-0.9-py2.7.egg/flask/", line 1687, in wsgi_app response = self.full_dispatch_request() File "/usr/lib/sagemath/local/lib/python2.7/site-packages/Flask-0.9-py2.7.egg/flask/", line 1360, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/lib/sagemath/local/lib/python2.7/site-packages/Flask-0.9-py2.7.egg/flask/", line 1358, in full_dispatch_request rv = self.dispatch_request() File "/usr/lib/sagemath/local/lib/python2.7 ...