Ask Your Question

Ed Scheinerman's profile - activity

2022-05-02 09:16:16 +0200 received badge  Taxonomist
2019-04-18 22:16:09 +0200 received badge  Nice Question (source)
2018-01-11 22:18:47 +0200 received badge  Famous Question (source)
2017-06-17 19:16:47 +0200 received badge  Popular Question (source)
2016-10-05 20:47:45 +0200 received badge  Notable Question (source)
2016-08-14 14:08:51 +0200 received badge  Notable Question (source)
2015-08-13 22:42:31 +0200 received badge  Famous Question (source)
2015-03-05 02:54:17 +0200 received badge  Popular Question (source)
2014-12-11 14:04:09 +0200 received badge  Nice Question (source)
2014-06-29 11:05:50 +0200 received badge  Notable Question (source)
2014-06-29 11:05:50 +0200 received badge  Popular Question (source)
2014-02-04 20:17:52 +0200 asked a question Ubuntu PPA not updating

I'm using Ubuntu and have previously had my sage automatically update to the latest version. It's now stalled at 5.13 and didn't upgrade to 6.0 or 6.1.

I followed the instructions on http://sagemath.org/download-linux.html which says to give these commands.

apt-add-repository -y ppa:aims/sagemath
apt-get update
apt-get install sagemath-upstream-binary

This used to work but has stopped. Any ideas?

2014-01-24 18:45:39 +0200 received badge  Popular Question (source)
2013-10-15 16:41:10 +0200 asked a question Comparing even powers of $i$ with 1

Computing $i^4$ yields $1$, but it's not the same $1$ as when I type $1$. Compare these two evaluations:

sage: I^4 == 1
1 == 1
sage: I^2 == 1
-1 == 1

I would have expected the first to yield True and the second to yield False. Is Sage's answer a desirable default behavior?

I see that the first $1$ is a sage.symbolic.expression.Expression and the other $1$ is a sage.rings.integer.Integer (likewise for the $-1$). How can I make the comparison evaluate as one might reasonably expect mathematically?

2013-07-23 23:15:56 +0200 received badge  Notable Question (source)
2013-04-14 04:45:42 +0200 received badge  Famous Question (source)
2013-03-27 19:44:08 +0200 asked a question Finding the permutation that sorts a list

Given a list (say, of numbers) L, the method L.sort() will put its elements in order. The function sorted(L) returns a new list with the elements of L in order. I would like a version of sorted that will not return the elements of L in sorted order, but rather, the permutation that puts them in sorted order. Does this exist in Sage? Thanks.

2013-01-02 17:40:18 +0200 received badge  Notable Question (source)
2012-12-05 19:24:55 +0200 received badge  Popular Question (source)
2012-09-19 10:39:32 +0200 received badge  Popular Question (source)
2012-07-18 11:02:49 +0200 received badge  Nice Question (source)
2012-06-07 11:39:00 +0200 asked a question Tkinter for sage 5.0 on linux

I'm using sage 5.0 on Ubuntu Linux. I would like to use Tkinter but it fails. I have Tk installed (works from ordinary python) and the development libraries are installed.

Here's what happens:

sage: from Tkinter import *
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)

/home/ers/<ipython console> in <module>()

/usr/lib/sage/local/lib/python2.7/lib-tk/Tkinter.py in <module>()
     37     # Attempt to configure Tcl/Tk without requiring PATH
     38     import FixTk
---> 39 import _tkinter # If this fails your Python may not be configured for Tk
     40 tkinter = _tkinter # b/w compat for export
     41 TclError = _tkinter.TclError

ImportError: No module named _tkinter

I tried the instructions here: http://wiki.sagemath.org/faq?highligh... but that didn't work.

I tried a more simple

sage -f python

and got this:

Calling sage-spkg on 'python'
python-2.7.2.p4
====================================================
Extracting package /usr/lib/sage/spkg/standard/python-2.7.2.p4.spkg
-rw-r--r-- 1 root root 107 May 14 19:57 /usr/lib/sage/spkg/standard/python-2.7.2.p4.spkg
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
Error: failed to extract /usr/lib/sage/spkg/standard/python-2.7.2.p4.spkg

Help please!

BTW: The from Tkinter import * works perfectly on my Mac.

Thanks!!

2012-04-05 11:21:21 +0200 commented answer How do I generate a random number according to the binomial distribution?

Unfortunately, the R routine is much slower than the naive one for my application.

2012-04-02 16:43:17 +0200 commented answer How do I generate a random number according to the binomial distribution?

Thanks, but this does not appear to be faster. In my application, I'm generating lots of Bin(n,0.5) RVs, but with a different n each time.

2012-04-02 15:50:18 +0200 asked a question How do I generate a random number according to the binomial distribution?

I would like to generate a random integer according to the binomial distribution. That is, I would like to generate a Bin(n,p) random value. That's number between 0 and n in which the probability we get the value k is C(n,k)p^k(1-p)^(n-k).

Here is an inefficient method (which requires n calls to random() ):

def bin_rv(n,p=0.5):
    """
    Generate a binomial random variable with parameters n,p.
    """
    return sum( random() < p for _ in range(n))

Is there a better way to do this (already built into Sage, I hope)?

(In Matlab, this can be done via the binord function and in R with the rbinom function.)

2011-11-21 11:13:16 +0200 commented question Creating a semilogx (or semilogy or loglog) plot

Thanks to Benjamin Jones. This answer was very helpful and I was able to produce the figure I needed!

2011-11-21 11:11:59 +0200 received badge  Supporter (source)
2011-11-21 06:58:40 +0200 received badge  Student (source)
2011-11-20 19:05:20 +0200 asked a question Creating a semilogx (or semilogy or loglog) plot

I would like to create a semilogx plot of some data. I have two lists of data and would like to use something like list_plot() to visualize the data, but the x-axis should be logarithmic. I have attempted (and failed) in using pyplot, but get an error message like this:

Your currently selected backend, 'agg' does not support show().
Please select a GUI backend in your matplotlibrc file

which I don't understand. Is there an option to plot() and/or list_plot() that allows one to choose logarithmic axes?

Thanks.