[sage-support] Re: Difference between sage and pyhton calculations

2010-04-05 Thread Alec Mihailovs
On Apr 6, 2:00 am, Robert Bradshaw wrote: > I would be in favor of following Python's conventions here--they at   > least seem more natural to me (after all, % is related to "floor   > division" not "round division." :) Also, currently 2==2., 3==3., but 2%3 is 2 and 2.%3. is -1.00, a

[sage-support] Re: Difference between sage and pyhton calculations

2010-04-05 Thread Alec Mihailovs
On Apr 5, 11:56 pm, Eugene Goldberg wrote: > Python 2.6.5 (r265:79063, Mar 23 2010, 04:49:54) > >>> 6e-6 % 10e-6 > > 6.0002e-06 > Sage Version 4.3.5, Release Date: 2010-03-28 > sage: 6e-6 % 10e-6 > -4.00e-6 > > I'm sure sage is wrong.. :( As William Stein said, Sage is

Re: [sage-support] Difference between sage and pyhton calculations

2010-04-05 Thread Robert Bradshaw
On Apr 5, 2010, at 9:44 PM, William Stein wrote: On Mon, Apr 5, 2010 at 9:12 PM, Michael Welsh wrote: On 6/04/2010, at 3:56 PM, Eugene Goldberg wrote: Hello! Here is my pyhtons results: python Python 2.6.5 (r265:79063, Mar 23 2010, 04:49:54) [GCC 4.4.3] on linux2 Type "help", "copyright"

Re: [sage-support] Difference between sage and pyhton calculations

2010-04-05 Thread William Stein
On Mon, Apr 5, 2010 at 9:12 PM, Michael Welsh wrote: > > On 6/04/2010, at 3:56 PM, Eugene Goldberg wrote: > >> Hello! >> >> Here is my pyhtons results: >> >> python >> Python 2.6.5 (r265:79063, Mar 23 2010, 04:49:54) >> [GCC 4.4.3] on linux2 >> Type "help", "copyright", "credits" or "license" for

Re: [sage-support] Difference between sage and pyhton calculations

2010-04-05 Thread Michael Welsh
On 6/04/2010, at 3:56 PM, Eugene Goldberg wrote: > Hello! > > Here is my pyhtons results: > > python > Python 2.6.5 (r265:79063, Mar 23 2010, 04:49:54) > [GCC 4.4.3] on linux2 > Type "help", "copyright", "credits" or "license" for more information. 1+1 > 2 6e-6 % 10e-6 > 6.000

[sage-support] Re: Difference between sage and pyhton calculations

2010-04-05 Thread Eugene Goldberg
P.S. I've also got wrong result at http://sagenb.kaist.ac.kr/ server. On Apr 6, 3:56 am, Eugene Goldberg wrote: > Hello! > > Here is my pyhtons results: > > python > Python 2.6.5 (r265:79063, Mar 23 2010, 04:49:54) > [GCC 4.4.3] on linux2 > Type "help", "copyright", "credits" or "license" for mor

[sage-support] Difference between sage and pyhton calculations

2010-04-05 Thread Eugene Goldberg
Hello! Here is my pyhtons results: python Python 2.6.5 (r265:79063, Mar 23 2010, 04:49:54) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> 1+1 2 >>> 6e-6 % 10e-6 6.0002e-06 >>> and here is sage: ./ sage Sage Version 4.3.5, Release Dat

[sage-support] Re: Interface to openssl hash functions?

2010-04-05 Thread Alec Mihailovs
On Apr 5, 10:50 am, William Stein wrote: > I would make sure to install the openssl development packages, then > force a rebuild from source of Python in Sage. > >    sage -f python-2.6.4.p7 I can confirm that that works in Sage 4.3 in VirtualBox on Windows, sage -i openssl-0.9.8d.p1 sage -f py

[sage-support] Re: Interface to openssl hash functions?

2010-04-05 Thread Alasdair
Actually, the best thing is to simply use ripemd from the command line openssl: a...@goldsmith:~$ echo -n "a" | openssl dgst -ripemd160 0bdc9d2d256b3ee9daae347be6f4dc835a467ffe Or this can be done from within Sage by escaping to the command line. Alasdair On Apr 6, 12:50 am, William Stein wrot

Re: [sage-support] Re: nested "for" statements?

2010-04-05 Thread Dana Ernst
> By the way, one has to be careful using some of the methods of U. In > particular, > > sage: u1=U.list_of_elements_of_multiplicative_group() > sage: u==u1 >True > but > > sage: type(u[0]) > > < type 'sage.rings.integer_mod.IntegerMod_int' > > > type(u1[0]) > >

[sage-support] Re: nested "for" statements?

2010-04-05 Thread Alec Mihailovs
On Apr 5, 8:26 pm, Dana Ernst wrote: > Wow, thanks for all the feedback.  I learned a lot today! > > On Apr 5, 2010, at 5:31 PM, Alec Mihailovs wrote: > > u=[n for n in U if gcd(n,40)==1] By the way, one has to be careful using some of the methods of U. In particular, sage: u1=U.list_of_element

Re: [sage-support] Re: nested "for" statements?

2010-04-05 Thread Dana Ernst
Wow, thanks for all the feedback. I learned a lot today! On Apr 5, 2010, at 5:31 PM, Alec Mihailovs wrote: > On Apr 5, 5:11 pm, Alec Mihailovs wrote: > >> u=filter(lambda n: gcd(n,40)==1, U) > > Also, that can be done as > > u=[n for n in U if gcd(n,40)==1] > > Alec > > -- > To post to th

Re: [sage-support] sage 4.3.4 and 4.3.5 build error on CentOS 5 x86_64 (TypeError: unsupported operand parent(s) for '+': 'Univariate Polynomial Ring in x over Algebraic Real Field' and '

2010-04-05 Thread William Stein
On Mon, Apr 5, 2010 at 3:28 PM, Tru Huynh wrote: > Hi, > > building doc still fails for 4.3.4 and 4.3.5 (since 4.3.2) with the same > error message: Does sage work? What happens if you type ./sage then sage: 2+2 4 William > > TypeError: unsupported operand parent(s) for '+': 'Univariate P

[sage-support] sage 4.3.4 and 4.3.5 build error on CentOS 5 x86_64 (TypeError: unsupported operand parent(s) for '+': 'Univariate Polynomial Ring in x over Algebraic Real Field' and '')

2010-04-05 Thread Tru Huynh
Hi, building doc still fails for 4.3.4 and 4.3.5 (since 4.3.2) with the same error message: TypeError: unsupported operand parent(s) for '+': 'Univariate Polynomial Ring in x over Algebraic Real Field' and '' [...@liberte sage-4.3.4]$ make cd spkg && ./install all 2>&1 | tee -a ../install.log

[sage-support] Re: nested "for" statements?

2010-04-05 Thread Alec Mihailovs
On Apr 5, 5:11 pm, Alec Mihailovs wrote: > u=filter(lambda n: gcd(n,40)==1, U) Also, that can be done as u=[n for n in U if gcd(n,40)==1] Alec -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googleg

[sage-support] Re: nested "for" statements?

2010-04-05 Thread Alec Mihailovs
On Apr 5, 5:11 pm, Alec Mihailovs wrote: > html.table([r]+[map(lambda j: k^j, r) for k in u], header=True) Or even more simple, html.table([r]+[[k^j for j in r] for k in u],header=True) Alec -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group,

[sage-support] Re: nested "for" statements?

2010-04-05 Thread Alec Mihailovs
On Apr 5, 4:48 pm, Harald Schilly wrote: > you can also format it as an html table, read the output of > html.table? for more information ;) That can be done as U=Integers(40) u=filter(lambda n: gcd(n,40)==1, U) r=range(1,len(u)) html.table([r]+[map(lambda j: k^j, r) for k in u], header=True)

[sage-support] Re: nested "for" statements?

2010-04-05 Thread Harald Schilly
On Apr 5, 10:05 pm, Mike Hansen wrote: > This uses a few more constructs... based on your example, here is one that aligns the numbers visually. "%2d" means to format the number as a number that always takes two characters. U = Integers(40) for k in U: if gcd(k,40) != 1: continue

Re: [sage-support] Re: nested "for" statements?

2010-04-05 Thread Mike Hansen
On Mon, Apr 5, 2010 at 12:58 PM, Dana Ernst wrote: > This does help.  BTW, above, I meant to write (swap order of k and j): > > for k in range(1,40): >     for j in range(16): >     if gcd(k,40) == 1: >     print (U(k))^j > > Is there a way to insert a character after each (U(k))^16, s

Re: [sage-support] Re: nested "for" statements?

2010-04-05 Thread Dana Ernst
William Stein wrote: On Mon, Apr 5, 2010 at 12:39 PM, D.C. Ernst wrote: Great, thanks! This is the sort of thing I was trying, but I wasn't handling the indentation correctly. Perhaps y'all can help me with a related issue. I'd like my abstract algebra students to use Sage to do some com

Re: [sage-support] Re: nested "for" statements?

2010-04-05 Thread William Stein
On Mon, Apr 5, 2010 at 12:39 PM, D.C. Ernst wrote: > Great, thanks!  This is the sort of thing I was trying, but I wasn't > handling the indentation correctly.  Perhaps y'all can help me with a > related issue.  I'd like my abstract algebra students to use Sage to > do some computations involving

[sage-support] Re: nested "for" statements?

2010-04-05 Thread D.C. Ernst
Great, thanks! This is the sort of thing I was trying, but I wasn't handling the indentation correctly. Perhaps y'all can help me with a related issue. I'd like my abstract algebra students to use Sage to do some computations involving the group of units mod n. I've been fiddling around myself

Re: [sage-support] nested "for" statements?

2010-04-05 Thread Mike Hansen
On Mon, Apr 5, 2010 at 12:14 PM, Dana Ernst wrote: > I think I understand how to deal with "for" statements in Sage.  For > example: > > for j in range(5): >     print 3^j > > will output the values of 3^0, 3^1, ..., 3^5.  However, how could I do this > for all the numbers, say 1 to 100, instead o

[sage-support] nested "for" statements?

2010-04-05 Thread Dana Ernst
I think I understand how to deal with "for" statements in Sage. For example: for j in range(5): print 3^j will output the values of 3^0, 3^1, ..., 3^5. However, how could I do this for all the numbers, say 1 to 100, instead of just 3? Maybe this is a silly example, but I'm wondering ho

Re: [sage-support] errrors in the prime function complex?

2010-04-05 Thread Minh Nguyen
Hi, On Tue, Apr 6, 2010 at 12:34 AM, bb wrote: > I am a simple minded user and have some questions concerning Sage functions. > May be I misunderstand the docu at > http://sage.math.washington.edu/home/mhansen/sage-epydoc/sage.rings.arith-module.html#primes? Scroll down to the very end of that H

Re: [sage-support] Interface to openssl hash functions?

2010-04-05 Thread William Stein
On Mon, Apr 5, 2010 at 6:01 AM, Alasdair wrote: > I'm doing some experimentation with cryptographic hash functions, and > I should be able to use openssl.  I can load the python hashlib > library: > > sage: import hashlib > sage: hashlib. > hashlib.md5     hashlib.sha1    hashlib.sha256  hashlib.s

[sage-support] errrors in the prime function complex?

2010-04-05 Thread bb
I am a simple minded user and have some questions concerning Sage functions. May be I misunderstand the docu at http://sage.math.washington.edu/home/mhansen/sage-epydoc/sage.rings.arith-module.html#primes? Here an excerpt: eratosthenes(n) Return a list of the primes $\leq n$. prange(

[sage-support] Interface to openssl hash functions?

2010-04-05 Thread Alasdair
I'm doing some experimentation with cryptographic hash functions, and I should be able to use openssl. I can load the python hashlib library: sage: import hashlib sage: hashlib. hashlib.md5 hashlib.sha1hashlib.sha256 hashlib.sha512 hashlib.new hashlib.sha224 hashlib.sha384 Now, acc

[sage-support] valgrind-3.5.0.p0/src/install-sh executable

2010-04-05 Thread David Joyner
Hi: I'm posting this for Michael Somos: ... I just ran across a slight glitch in installing an optional valgrind SAGE package. ... Here is my message: > I tried to install valgrind using the command > > > sage -i valgrind-3.5.0.p0 > > It fa

Re: [sage-support] n(...) bug

2010-04-05 Thread Burcin Erocal
On Mon, 5 Apr 2010 00:39:02 -0700 (PDT) Kwankyu wrote: > sage: f=sqrt(pi)^-1*exp(-x^2/2); f > e^(-1/2*x^2)/sqrt(pi) > sage: g=integral(f,(x,0,2)); g > 1/2*sqrt(2)*erf(sqrt(2)) > sage: n(g) > Traceback (most recent call last): > ... > TypeError: cannot evaluate symbolic expression numerically > sa

[sage-support] n(...) bug

2010-04-05 Thread Kwankyu
Hi All, The following is a bug. Isn't it? sage: f=sqrt(pi)^-1*exp(-x^2/2); f e^(-1/2*x^2)/sqrt(pi) sage: g=integral(f,(x,0,2)); g 1/2*sqrt(2)*erf(sqrt(2)) sage: n(g) Traceback (most recent call last): ... TypeError: cannot evaluate symbolic expression numerically sage: h=1/2*sqrt(2)*erf(sqrt(2))

[sage-support] Re: derivative instance

2010-04-05 Thread Alec Mihailovs
A: Yes. > Q: Are you sure? >> A: Because it reverses the logical flow of conversation. >>> Q: Why is top posting annoying in email? -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For mo