Ask Your Question

Ed Scheinerman's profile - activity

2019-04-18 15:16:09 -0500 received badge  Nice Question (source)
2018-01-11 15:18:47 -0500 received badge  Famous Question (source)
2017-06-17 12:16:47 -0500 received badge  Popular Question (source)
2016-10-05 13:47:45 -0500 received badge  Notable Question (source)
2016-08-14 07:08:51 -0500 received badge  Notable Question (source)
2015-08-13 15:42:31 -0500 received badge  Famous Question (source)
2015-03-04 19:54:17 -0500 received badge  Popular Question (source)
2014-12-11 07:04:09 -0500 received badge  Nice Question (source)
2014-06-29 04:05:50 -0500 received badge  Notable Question (source)
2014-06-29 04:05:50 -0500 received badge  Popular Question (source)
2014-02-04 13:17:52 -0500 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 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 11:45:39 -0500 received badge  Popular Question (source)
2013-10-15 09:41:10 -0500 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 16:15:56 -0500 received badge  Notable Question (source)
2013-04-13 21:45:42 -0500 received badge  Famous Question (source)
2013-03-27 13:44:08 -0500 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 10:40:18 -0500 received badge  Notable Question (source)
2012-12-05 12:24:55 -0500 received badge  Popular Question (source)
2012-09-19 03:39:32 -0500 received badge  Popular Question (source)
2012-07-18 04:02:49 -0500 received badge  Nice Question (source)
2012-06-07 04:39:00 -0500 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/ 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: but that didn't work.

I tried a more simple

sage -f python

and got this:

Calling sage-spkg on 'python'
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.


2012-04-05 04:21:21 -0500 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 09:43:17 -0500 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 08:50:18 -0500 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 04:13:16 -0500 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 04:11:59 -0500 received badge  Supporter (source)
2011-11-20 23:58:40 -0500 received badge  Student (source)
2011-11-20 12:05:20 -0500 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?