[sage-support] Re: [mpir-devel] Re: [sage-devel] MPIR 1.3.0 released (at last)

2010-01-28 Thread Craig Citro
 So it can't find libmpir.so.8. But I don't see why.

 echo $LD_LIBRARY_PATH
 /usr/lib/sparcv9:/home/wbhart/mpir-1.3.0/.libs


Total random guess: could it be that you need this to be in your
DYLD_LIBRARY_PATH, too?

-cc

-- 
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: setuptools vs. Distribute

2009-09-29 Thread Craig Citro

 Is it their goal to supplant setuptools, or has it already been
 decided by the Python community? Though there's been grumbling for a
 while, the official fork seeks rather recent.

Yes, they're looking to replace setuptools, and the Python community
(particularly Guido) seems to be behind them. I think Tarek Ziade (the
guy in charge of Distribute) volunteered to start trying to clean up
the current mess with Python packaging at the last PyCon, and this is
the result. They don't want to fork -- the issue is that the guy in
charge of setuptools is generally too busy to work on it, but doesn't
want to hand over the rights to any of the folks who want to be
working on it, for various reasons. It's much messier than that, of
course, but it looks like Distribute is going to be the way of the
future for Python distribution.

 I don't think there's
 any hurry, at this point I'd say we should just wait and see. If
 Distribute becomes the standard that setuptools is now, I'd imagine
 we'll ship it.


I agree -- I think that when the time comes that someone needs to
update our setuptools spkg for some reason, they'll discover that the
only option is to switch to Distribute. Until then, though, there's
probably no reason to mess with it -- in particular, Python 3 is still
far off in our future.

-cc

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: sparse linear algebra

2009-09-20 Thread Craig Citro

 Is there a good reason for such a difference?


I think the only reason is that the vector code in Sage hasn't
received much attention over the years. William and I talked about
this a while back, and basically agreed that it would be best to
rewrite most of the vector classes as a *very* light wrapper around
matrices of size 1xn or nx1. This is one of the projects I'm planning
on taking care of in the Fall, so if anyone has any thoughts or
suggestions, please pipe in!

-cc

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Anonymous functions in sage : I can't iterate and insert a test.

2009-09-19 Thread Craig Citro

 Is it possible to compose/iterate functions in sage by a functional way
 without any loop for or while.


Why don't you want to use a loop? I think it's the most natural way to
do this in Python.

 When I used mupad I could get the u(100) term of this sequence by :

 (sin@@100) (1) # u(0)=1 and u(n+1)=sin (u(n))


There's no default syntax for doing this kind of thing, but you could
always add a function that does it. This isn't perfect, but it does
what you want in one line:

reduce(lambda x,y: y(x), [sin for _ in xrange(100)], 1)

Of course, it's going to return something symbolic: you could use the
.n() method to get an approximation. Or apply it to something inexact.

sage: reduce(lambda x,y: y(x), [sin for _ in xrange(100)], 1)
sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(1

sage: reduce(lambda x,y: y(x), [sin for _ in xrange(100)], 1).n()
0.168852488727981

sage: reduce(lambda x,y: y(x), [sin for _ in xrange(100)], 1.0)
0.168852488727981

Of course, I really don't think any of those (including the mupad
example) is nearly as clear as

sage: x = 1
sage: for _ in xrange(100):
   : x = sin(x)
   :
sage: x
sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(1
sage: x.n()
0.168852488727981

A nicer fix would be to create a new class for recurrence relations --
so you could do something like this:

sage: my_sequence = RecurrenceRelation(relation=lambda previous_term:
sin(previous_term), initial_value=1)
sage: my_sequence[100]
sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(sin(1
sage: my_sequence[100].n()
0.168852488727981

-cc

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Anonymous functions in sage : I can't iterate and insert a test.

2009-09-19 Thread Craig Citro

 This is equivalent to the cleaner and more concise:

 sage: reduce(lambda x,y: y(x), [sin]*100, 1)


Ah, true. (Clearly I've been making lists of lists recently.) You
could even get rid of the use of the optional argument to reduce:

sage: reduce(lambda x,y: y(x), [1] + [sin]*100)

-cc

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Elliptic Curves

2009-09-17 Thread Craig Citro

 Actually, I wonder if there is some list of the usual commands to use
 on Elliptic Curves. I've been searching for it, but I only found the
 commands to define an Elliptic Curve (just over Q or a finite field,
 but not over a function field, say Q(t) for example) and operate with
 some of points in it. I would like to do other things and I don't
 really know how to. Sorry to bother. Thanks.


Hi,

Most of the available commands are methods on an elliptic curve
object. You can use tab completion to see what all is available:

sage: E = EllipticCurve('11a')
sage: E.tab

and a huge list of options will pop out. (Here the tab means hit
tab. This also works in the notebook.) Once you find one you want, you
can use ? to see some documentation, and ?? to see the source:

sage: E.tamagawa_number?
Type: instancemethod
Base Class:   type 'instancemethod'
String Form:   bound method
EllipticCurve_rational_field.tamagawa_number of Elliptic Curve defined
by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field
Namespace:Interactive
File:
/sage/local/lib/python2.5/site-packages/sage/schemes/elliptic_curves/ell_rational_field.py
Definition:   E.tamagawa_number(self, p)
Docstring:

The Tamagawa number of the elliptic curve at `p`.

This is the order of the component group
`E(QQ_p)/E^0(QQ_p)`.

EXAMPLES::

sage: E = EllipticCurve('11a')
sage: E.tamagawa_number(11)
5
sage: E = EllipticCurve('37b')
sage: E.tamagawa_number(37)
3

sage: E.tamagawa_number??
Type: instancemethod
Base Class:   type 'instancemethod'
String Form:   bound method
EllipticCurve_rational_field.tamagawa_number of Elliptic Curve defined
by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field
Namespace:Interactive
File:
/sage/local/lib/python2.5/site-packages/sage/schemes/elliptic_curves/ell_rational_field.py
Definition:   E.tamagawa_number(self, p)
Source:
def tamagawa_number(self, p):
r
The Tamagawa number of the elliptic curve at `p`.

This is the order of the component group
`E(\QQ_p)/E^0(\QQ_p)`.

EXAMPLES::

sage: E = EllipticCurve('11a')
sage: E.tamagawa_number(11)
5
sage: E = EllipticCurve('37b')
sage: E.tamagawa_number(37)
3

return self.local_data(p).tamagawa_number()


Hope that gets you started ...

-cc

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: breaking out of double for loops

2009-07-23 Thread Craig Citro

 for x in range(10):
     for y in range(10):
          if 2^x*3^y==12:
                break

 (x,y)


I think the most pythonic solution would be to use
itertools.product, which requires python 2.6 or greater (and hence
sage 4.1 or greater):

sage: import itertools
sage: for x,y in itertools.product(range(10), range(10)):
   ...: if 2^x*3^y == 12:
   ...: break
   ...:
sage: print x,y
2 1

-cc

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: logarithms in complex number fields

2009-07-08 Thread Craig Citro

Hi,

 However, I can't figure out a way to do this. Sage doesn't like me
 taking logarithms at this point, so I need to embed into RR or CC,
 which screams minkowski embedding, but I can't get it to work, because
 I don't really know what I'm doing.


I've only quickly read your email, but there are several functions for
number fields you might find helpful here. In particular:

sage: L.b = NumberField(x^6+3)
sage: L.Minkowski_embedding()
[ 1.41421356237310 -1.47084137671644  1.01982445132775
0.000 -1.47084137671644  3.05947335398326]
[0.000 0.849190664782477 -1.76638776450072
2.44948974278318 -2.54757199434743  1.76638776450072]
[ 1.41421356237310 0.000 -2.03964890265551
0.000  2.94168275343288 0.000]
[0.000  1.69838132956495 0.000
-2.44948974278318 0.000  3.53277552900144]
[ 1.41421356237310  1.47084137671644  1.01982445132775
0.000 -1.47084137671644 -3.05947335398326]
[0.000 0.849190664782477  1.76638776450072
2.44948974278318  2.54757199434743  1.76638776450072]

sage: L.real_embeddings()
[]
sage: L.complex_embeddings()
[
Ring morphism:
  From: Number Field in b with defining polynomial x^6 + 3
  To:   Complex Double Field
  Defn: b |-- -1.04004191153 - 0.600468477588*I,
Ring morphism:
  From: Number Field in b with defining polynomial x^6 + 3
  To:   Complex Double Field
  Defn: b |-- -1.04004191153 + 0.600468477588*I,
Ring morphism:
  From: Number Field in b with defining polynomial x^6 + 3
  To:   Complex Double Field
  Defn: b |-- -1.52661999456e-16 - 1.20093695518*I,
Ring morphism:
  From: Number Field in b with defining polynomial x^6 + 3
  To:   Complex Double Field
  Defn: b |-- 4.22939257713e-16 + 1.20093695518*I,
Ring morphism:
  From: Number Field in b with defining polynomial x^6 + 3
  To:   Complex Double Field
  Defn: b |-- 1.04004191153 + 0.600468477588*I,
Ring morphism:
  From: Number Field in b with defining polynomial x^6 + 3
  To:   Complex Double Field
  Defn: b |-- 1.04004191153 - 0.600468477588*I
]

I'm not sure how much you've used sage or ipython -- do you know about
?, ??, and tab completion? Here's the three line summary: you could
type L.TABTAB to see all methods available on L,
L.Minkowski_embedding? to see documentation on that method, and
L.Minkowski_embedding?? to see the source itself.

It's probably confusing that we've got L.Minkowski_embedding and
L.minkowski_bound (note the different capitalization) -- we should
standardize this. I wrote the one that's capitalized, so it's clear
what I vote for. ;)

As I said at the top, I only skimmed your email -- if I'm not really
answering your question, or you have more questions, feel free to
reply again. :)

-cc

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: non-integer modulo arithmetic

2009-06-17 Thread Craig Citro

 How about

 sage: p = 7
 sage: K.q = QQ[p^(1/p)]
 sage: q^p
 7
 sage: F.qbar = K.residue_field(q)
 sage: F
 Residue field of Fractional ideal (a)

 Of course as p splits completely the residue field is always
 isomorphic to Z/pZ (with the obvious reduction map, as q * q^(p-1) ==
 p).


Actually, p is totally ramified in that extension -- it doesn't split
at all ... but the residue field is still Z/pZ. In the above example:

sage: K.factor(p)
(Fractional ideal (-a))^7
sage: P = K.factor(p)[0][0]
sage: P.ramification_index()
7
sage: K.residue_field(P)
Residue field of Fractional ideal (-a)
sage: K.residue_field(P).order()
7

-cc

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: error finding the units of a number field

2009-06-17 Thread Craig Citro

Hi,

 thanks! however, not quite there - how do I get the units in terms of
 q?


So I just tried this in sage 4.0.2.rc2, and here's what I got:

sage: K.q = NumberField(x^2+2) ; K
Number Field in q with defining polynomial x^2 + 2
sage: B.x = K[]
sage: A.c = K.extension(x^3+(q^3)*x^2+(2*q^2)*x-3*q)
sage: A.unit
A.unit_group  A.unit_ideal  A.units
sage: A.unit_group()
Unit group with structure C2 x Z x Z of Number Field in c with
defining polynomial x^3 - 2*q*x^2 - 4*x - 3*q over its base field
sage: A.units()
[q*c - 1, (-405*q - 1845)*c^2 + (674*q - 3960)*c - 2058*q - 1465]

Is that what you were looking for? You could also do this (continuing
the above session):

sage: U = A.unit_group()
sage: U.gens()
[-1, q*c - 1, (-405*q - 1845)*c^2 + (674*q - 3960)*c - 2058*q - 1465]

To be honest, I haven't thought at all about what new patches made
this work (as the .units() call clearly failed before) -- but I bet
the patch was by either Nick Alexander or John Cremona, so maybe one
of them can pipe in and say oh, I fixed that to earn their fame and
glory. ;)

-cc

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Posting in sage-windows

2009-06-15 Thread Craig Citro

 My apologies for posting about the sage-windows group within the sage-
 support group but I posted 3 messages (two replies and a new topic)
 into sage-windows a couple of weeks back and they're still not showing
 up in the message lists. And I wasn't sure how else to ask for help in
 posting there.

 I'm listed as a member of that group and did get an email notification
 that some messages had been posted.

 So do I need to do anything special to post there perhaps?

 That was my mistake.  I'm really sorry for your message not getting
 posted promptly.  It should in the future.


And just for the record -- when the behavior on one of the other
groups is funky, emailing sage-support isn't a bad idea at all. :) (In
this case, it was exactly the right move to fix the problem ... and
now several of us can approve messages on sage-windows, meaning it
shoudn't happen again.)

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Reading numbers from a file

2009-06-04 Thread Craig Citro

 In short, anyone knows a simple trick provided by sage or python to
 read numbers from a file without redoing the parsing stuff ?


Luckily, both python's float type and Sage's RealDoubleField (or any
of the RealFields) are smart enough to convert from strings:

[craigci...@sharma ~/temp]  $ cat reals.txt
3.14159
4
3.0e17
-5

[craigci...@sharma ~/temp]  $ sage
--
| Sage Version 4.0, Release Date: 2009-05-29 |
| Type notebook() for the GUI, and license() for information.|
--

sage: f = open('reals.txt')
sage: [ RDF(x) for x in f.readlines() ]
[3.14159, 4.0, 3e+17, -5.0]
sage: f.close()

sage: f = open('reals.txt')
sage: [ float(x) for x in f.readlines() ]
[3.14158999, 4.0, 3e+17, -5.0]
sage: f.close()


Is that what you were looking to do? Or are your files of real numbers
formatted differently?

-cc

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Reading numbers from a file

2009-06-04 Thread Craig Citro

 This is almost what I want to do. I had figured out that trick but my
 problem is that the line that is input is, in my case, really long and
 gulps a lot of memory.

 Thus, to save memory, I need to read the numbers one by one (or a
 small bunch of them at a time). It seems I have to read line by line,
 which in my case of a really long line, is not easy.

 Thanks anyhow !


I guess I don't understand what the format of your file is. Can you
describe it a little more explicitly? Are you saying that there are
multiple real numbers per line? (Python could easily handle that case,
just use s.split(',') on each line.) Or are you saying the lines are
so long that just reading them into memory is a slowdown? How long is
one of these lines?

-cc

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Memleak help?

2009-06-03 Thread Craig Citro

 I should point out that simply starting from scratch and creating this
 object uses 1.19GB of virtual memory (primarily because I use an
 entire permutation generator), so it's not like the memory is small
 and then gets large (though it does get consistently larger while
 saving).  But I don't understand why the process of saving should
 never end.  Thanks for any ideas.


Can you post some code that generates this (or better yet, a smaller
example of the same ilk) so that we can all play around?

-cc

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Why is Sage called a Computer *Algebra* system? What is def of algebra?

2009-05-16 Thread Craig Citro

 Sage does calculus and geometry calculations so I don't understand why
 the term Computer Algebra System is so prevalent.

 What is the definition of algebra? Perhaps algebra means something
 like the manipulation of a finite number of objects ?


I have a feeling this conversation should just be pre-emptively moved
to sage-flame. :)

-cc

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: callable symbolic function name to string

2009-04-29 Thread Craig Citro

There's probably a better way, but this works:

sage: f = function('hello',x)
sage: f._f._name
'hello'

(That's just what f._repr_() uses.)

-cc

On Tue, Apr 28, 2009 at 8:30 PM, Alex Raichev tortoise.s...@gmail.com wrote:

 Hi all:

 How do you retrieve the name of a callable symbolic function as a
 string?  For instance, suppose you have

 sage: f= function('hello',x)

 and you want to retrieve 'hello' from f.

 sage: str(f)
 '\n                                   hello(x)'

 followed by stripping away the extra characters works, but is there a
 more direct approach?

 Alex
 


--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Dirichlet L-function

2009-04-25 Thread Craig Citro

Hi,

 The example from the reference manual p.2630

 sage: lcalc.twist_values(0.5, -10, 10)
 [(-8, 1.10042141), (-7, 1.14658567), (-4, 0.667691457), (-3,
 0.480867558),
 (5, 0.231750947), (8, 0.373691713)]

 works fine. But I need the value of  L( chi_3 , 2 ).


I think the problem is just one of documentation. In fact, the
twist_values command calls into lcalc, and it's giving you twists by
quadratic characters with *conductor* between dmin and dmax, *not* the
characters of the form (d/.) with d between dmin and dmax. As it
happens, the Kronecker symbol (3/.) happens to have conductor 12, not
3, which is what's causing the confusion:

sage: kronecker_character(3).conductor()
12

Then this should be the value you want:

sage: lcalc.twist_values(2,12,12)
[(12, 0.949703126)]

I'll file a trac ticket about this right now ... and a patch is up:

http://trac.sagemath.org/sage_trac/ticket/5896

Anyone want to give this a quick review?

-cc

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: sage

2009-04-03 Thread Craig Citro

 Now I think that Armand wants an equivalent to %S.  Presumably the
 commands typed in will all be in a history file somewhere.


Yep, the commands do get stored in a history file -- it's
~/.sage/ipython/history-sage from your home directory. Also, from the
command line, you can do %history to see the history of the live
session (with numbers as headings). The code that does this is in
_ip.IP.magic_history -- we could definitely write something that
extracts this data out into the same format Magma users might find
familiar, if that's desirable ... unless such a thing already exists?

-cc

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Number of operands in an expression

2009-03-21 Thread Craig Citro

 That works well, but what about when the expression is multivariate,
 such as:

 expand((1+x+1/y)^10)

 It would be nice to have a general command to count the number of
 summands in such an expression.


Yep, I agree. Here is a *terrible* way to do it:

sage: var('x,y')
(x, y)
sage: f = x+y + 1
sage: len(expand(f._maxima_()))
3
sage: len(expand((f**4)._maxima_()))
15

Someone should file an enhancement ticket to do this in a more
sensible way. I also have no idea whether or not it works with
anything more complicated than rational functions -- do you want to
use just rational functions? It might be better to just work with
polynomial rings and their fraction fields ...

-cc

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Number of operands in an expression

2009-03-21 Thread Craig Citro

 I think that better way is to use maxima commands op, args, length,
 atomp


I think that for objects which come from Maxima, this is the right
thing to do. However, not all symbolic objects in Sage are wrappers
for Maxima objects -- in the case of expressions using pynac, the code
above actually moves them over to Maxima (via strings and pexpect) and
then ask for their length there (which probably ultimately uses the
commands you mention). This is less than desirable, hence my claim
that it was a terrible way to calculate the length. :)

I think a first step might be to introduce a __len__ method for
symbolic objects, but then, I'm not always sure what it should return.
For instance, what's the length of sin(x^2-y+3)? I could see
reasonable arguments for 1 or 4, or maybe even 3. Probably the
semantics should be decided by the people who actually use the
symbolics a lot, which isn't me ... which is why I haven't filed a
trac ticket -- I have no idea what to suggest such a method should do.

-cc

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: python's list comprehension

2009-03-21 Thread Craig Citro

 Note that you're skipping the last conductor in the database, I
 think... DB.conductor_range? indicates that the returned values
 represent an inclusive range, but range/xrange/etc. take their second
 argument as an exclusive bound.  (This is easy to fix with the above
 xrange expression, but I don't see how to fix it with the simple *args
 syntax.)


Touche. I can find *a* way to fix it, but only at the cost of making
it significantly uglier and more fragile than the original use of an
anonymous lambda:

sage: t = (1,10)
sage: srange(*(list(t) + [1,ZZ,False,True]))
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

Clearly that's not the way to go in general ... I think the lambda is
much nicer in this case. (To be fair, Scheme is still the language
closest to my heart, so I may be biased.)

-cc

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Number of operands in an expression

2009-03-20 Thread Craig Citro

 Is there a Sage equivalent to Maple's nops command, which counts the
 number of operands in an expression?  In particular, is there a
 command which returns the number of terms of something like

 expand((1+x+1/x)^10) ?


There's probably a classier way to do it, but this works:

sage: len(expand((1+x+1/x)^10).coeffs())
21

-cc

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: python's list comprehension

2009-03-20 Thread Craig Citro

Hi Nils,

Yep, I think there are ways of making this nicer.

 I was interested in elliptic curves with possible 9-torsion in Sha, so
 I figured querying Cremona's database would get me some examples.
 After some experimenting, I finally created a query that had the
 desired result:

 sage: DB = CremonaDatabase()
 sage: L = [ N.str()+c[0] for N in (lambda l: xrange(l[0],l[1]))
 (DB.conductor_range()) for c in DB.allbsd(N).items() if
                 round(RDF(c[1][4]))%81 == 0]

 Two things made me feel uncomfortable with this expression:

  - the whole lambda expression to make the pair output by
 DB.conductor_range() into an iterable. Is there a syntactically more
 pleasing construct in python for that?

So in this case, you're trying to call xrange with arguments given by
the entries of DB.conductor_range() -- the lambda works, but python
has a nicer syntax for this. (I don't know a better name than the
*args syntax.) You can do:

sage: t = (0,10)
sage: xrange(*t)
xrange(10)
sage: range(*t)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

and that will just insert the entries of t as sequential arguments to
xrange. (You can also use ** with a dictionary, and it will insert the
key:value pairs as keyword arguments to your function.)

 (for instance variables local to expressions. In Magma speak: [a..b]
 where (a,b)=DB.conductor_range())

The [1..5] syntax works just fine here, and returns Sage Integer
objects (i.e. sage.rings.integer.Integer), just like srange. Here's
what really happens:

sage: [1..5]
[1, 2, 3, 4, 5]
sage: preparse('[1..5]')
'(ellipsis_range(Integer(1),Ellipsis,Integer(5)))'

Sadly, the ellipsis argument needs to go in the middle -- so I can't
quickly do it only evaluating the function once and not using a
lambda. You can just use srange, though:

sage: t = (0,10)
sage: srange(*t)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
sage: type(srange(*t)[0])
type 'sage.rings.integer.Integer'

  - the round(RDF(c[1][4])) to make the analytic sha into an integer.


This one is a little more trouble: the Integer constructor just passes
strings off to MPIR's mpz_set_str, which isn't willing to accept
strings like '1.0'. On top of that, some of the strings (such as the
one for 389) aren't just of the form '1.00' (i.e. an integer
with a bunch of zeros following). So probably the easiest way is to
use round, as you do above. However, you can make it maybe a bit more
readable:

sage: DB = CremonaDatabase()
sage: n = 81
sage: %time L = [ str(N)+label for N in srange(*DB.conductor_range())
for label,data in DB.allbsd(N).items() if
n.divides(RDF(data[4]).round()) ]
CPU times: user 90.17 s, sys: 1.57 s, total: 91.74 s
Wall time: 91.75 s
sage: len(L)
86

Does that seem better?

-cc

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Special linear group on finite field

2009-03-15 Thread Craig Citro

 So I don't think it has to do with trac #5491.  It is either a problem with
 Sage finite fields, or with translating between Gap finite fields and Sage
 finite fields.  I'll have a closer look later today and open a ticket.


Indeed, we just don't have the ability to coerce between GF(p^a) and
GF(p^(ab)) when a and b are both larger than one. For instance:

sage: K.a = GF(9)
sage: L.b = GF(81)
sage: L(a)
---
TypeError Traceback (most recent call last)

/Users/craigcitro/.sage/temp/sharma.local/52679/_Users_craigcitro__sage_init_sage_0.py
in module()
 1
  2
  3
  4
  5

/sage/local/lib/python2.5/site-packages/sage/rings/finite_field_givaro.so
in sage.rings.finite_field_givaro.FiniteField_givaro.__call__
(sage/rings/finite_field_givaro.cpp:4003)()
528
529
-- 530
531
532

TypeError: unable to coerce from a finite field other than the prime subfield

This is hitting the exact same line that Martin did above -- see
http://trac.sagemath.org/sage_trac/ticket/2916 for details. Someone
needs to just sit down and implement this ... I think the relevant
ticket is http://trac.sagemath.org/sage_trac/ticket/5426. Code for
this exists in the coercion branch, so I think it's mostly a question
of getting that code moved over ...

-cc

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Object changes its contents after saved (sage 3.1.1)

2009-03-10 Thread Craig Citro

Hi Alex,

 I think it is better option (1), but where can I get 3.4.rcl? I don't
 see it in the website of Sage.

 In your opinion, which option is better?


I'd definitely go with option (1), as long as you don't mind leaving
it building for a few hours. Jaap was already nice enough to post a
link to the file, too ...

-cc

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Object changes its contents after saved (sage 3.1.1)

2009-03-09 Thread Craig Citro

Hi Alex,

 After I found a bug in sage 3.2.3 ( see Division error in Sage 3.3 but
 not in Sage 3.1.1 posted march 7, 2009), I decided used sage 3.1.1.
 Now I have a problem with sage 3.1.1
 1. the program generate the object H
 2. save H
 3. G =load(H)


So this is a pretty funky bug -- however, it's one that's already
fixed. I'd recommend not trying to use 3.1.1 once you've got your
pickles converted ... it's just going to cause you a headache when you
hit bugs, and since a lot of them have already been fixed, no one is
going to be too excited about fixing them. :)

I don't know if this was mentioned clearly in the other thread, but
the bug you're hitting in 3.2.3 is already fixed in the current
3.4.rc1 ... you could do one of two things:

(1) download and compile 3.4.rc1, use that
(2) take the patch that fixed your bug, apply it to 3.2.3 (which is
what we did to get your 3.1.1 working), go from there.

The patch is at this ticket:

http://trac.sagemath.org/sage_trac/ticket/5434

And the file itself is here:

http://trac.sagemath.org/sage_trac/raw-attachment/ticket/5434/poly-shift-of-zero.patch

So you can just grab that, and in your 3.2.3 tree, follow the same
directions you did to get your 3.1.1 correctly pickling your fraction
field elements.

I hope that helps ...

-cc

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: I can't load objets in Sage 3.2.3 that were created in Sage 3.1.1

2009-03-04 Thread Craig Citro

Hi Alex,

 Every thing works ok. I already did a proof with one object and there
 was no problem. There was no DeprecationWarning.

 Thanks a lot, you're a genius man.


Awesome! I'm glad you got those objects loaded. :)

 Do you know the sagetex package? I followed the directions to use the
 sagetex package, without successful. I tried with the example and I
 got the following messages:


Honestly, I've never used sagetex myself -- I hear it's really cool.
Dan Drake is the man to ask -- I'm pretty sure he reads sage-support,
but he may have stopped reading this thread at some point. I'd
recommend starting a new thread to ask him, and you'll probably hear
something really quick. If that doesn't work, he hangs out in the sage
IRC channel a lot -- #sage-devel on irc.freenode.net ... you can
surely find him there. (He's in Korea, so he keeps different hours.)

-cc

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: I can't load objets in Sage 3.2.3 that were created in Sage 3.1.1

2009-03-03 Thread Craig Citro

Hi Alex,

 All the objects have the same general shape as the one posted. The
 option (2) it is ok. I do not want you spend much time with my
 problem.


Excellent -- (2) was definitely the easier plan for me. :) I've posted
a patch here:

 http://sage.math.washington.edu/home/craigcitro/fix-frac-pickle-3.1.1.patch

So here are the steps you need to take to use this (I'm happy to
explain any of these in more detail, if you want):

 1. Build sage-3.1.1 on your machine. It's here:
http://sage.math.washington.edu/sage/src/sage-3.1.1.tar
 2. In your sage-3.1.1 build directory, type: ./sage -clone pickle
 3. From that same directory: cd devel/sage-pickle
 4. Copy the above patch file into that directory, and type: hg patch
fix-frac-pickle-3.1.1.patch
 5. cd ../..
 6. ./sage -br

You should now be running a copy of sage 3.1.1 with the patch applied.
Then you can just update the pickles like this:

sage: foo = load('test.sobj')
sage: save(foo, 'test2.sobj')

or even

sage: save(load('test.sobj'), 'test-new.sobj')

where it's going to look for the patches in the sage-3.1.1 directory.
(Of course, you could just run the copy of 3.1.1 you've built from
anywhere by giving the full path.) In fact, if you have a bunch of
files in the same directory, you could just do something like:

sage: for name in ['file1', 'file2', 'file3']:
...: save(load(name + '.sobj'), name + '-new.sobj')

and that should work. It takes a few seconds for each pickle, but it
seems to work for me.

Now, the new pickles you produce will load just fine in sage 3.2.3 (or
at least, they did for me) -- however, they'll still give you a
DeprecationWarning when you load them. You can ignore this, or just
load and re-save them again in sage 3.2.3.

Let me know if you run into any trouble ...
-cc

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: I can't load objets in Sage 3.2.3 that were created in Sage 3.1.1

2009-03-02 Thread Craig Citro

Hi Burcin,

 The error I get when I try to load the .sobj file linked above in
 Sage-3.3 is:

 ...
 /home/burcin/sage/sage-3.3/local/lib/python2.5/site-packages/sage/structure/sage_object.so
 in sage.structure.sage_object.loads
 (sage/structure/sage_object.c:6156)()

 RuntimeError: (None, function PolynomialRing at 0x1355e60, (Fraction
 Field of Univariate Polynomial Ring in t over Finite Field of size 13,
 'T', None, False)) invalid data stream
 invalid load key, 'x'.
 Unable to load pickled data.


Yep, this is the same error we had with the other pickles. This is a
wildly uninformative error message, which I think I know enough to fix
at this point (someone should file a ticket and assign it to me). All
this error really means is that cPickle ran into an error trying to
unpickle the object.

In more detail: Both Pickle and cPickle keep a stream of arguments as
they load an object, which is what gets stored in a pickle. They just
run in a loop, that basically says: if there's anything left in the
stream, pop off an argument, which is a key telling it what kind of
object is next, dispatch to a method that knows how to recreate that
object, pop the appropriate number of arguments off the stream, use
those to reconstruct the object, and then loop. I'm pretty sure what's
happening here is that a correct load key gets popped off the stream,
and the attempt to reconstruct that part of the object fails, at which
point the *key* is gone from the stream, but not all of the arguments,
and the exception we raise gets caught, so the attempt to unpickle
continues. However, now the stream has nonsense (specifically leftover
arguments) at the front of it, so on the next loop, we see the
Invalid load key: 'x' error. So all this error means is that
something went wrong unpickling.

Here's what's happening with Alex's 3.1.1 pickle. Actually, in the
process of explaining what happens in this case, I've realized it's
slightly more subtle than I thought (and in particular, some of these
details should be added to the trac ticket).

 - The FractionField object Alex pickled in 3.1.1 was a pre-coercion
FractionField. So it doesn't have _element_class and
_element_constructor attributes, and it was created when FractionField
had no __reduce__ method -- so it just calls __new__ on the class, and
tries to start filling in the dict for the object. This goes fine,
actually -- the FractionField unpickles okay. Keep in mind, though,
that it's now an instance of the *new* FractionField class (i.e. one
with the new coercion stuff in place) that happens to be missing some
key attributes (like _element_class and _element_constructor -- which
are set to None).

 - The next thing Alex's code tries to unpickle is a polynomial ring
over the FractionField. This has always had a __reduce__ method, which
stores a call to the PolynomialRing function in
sage.rings.polynomial.polynomial_ring_constructor.

 - The polynomial ring constructor always creates a polynomial in the
process of initializing, namely its generator. This is accomplished by
calling self([0,1], is_gen=True), which ultimately calls [ R(z) for z
in [0,1] ], where R is self.base_ring().

 - Since self.base_ring() is the fraction field, we try to dispatch
__call__ on that. Of course, the new FractionField class doesn't have
a __call__ method -- that's in Parent now. So it goes up the class
hierarchy and dispatches that __call__.

 - The first thing that method does is say if
self._element_constructor is None: raise NotImplementedError. This is
the error we hit, because our 3.1.1 FractionField object has this set
to None. Boom.

This could explain why you didn't hit this in testing the new code --
did you create some polynomial rings over fraction fields with the old
class, then try to unpickle them with the new one? I bet this would
fail.

 I don't have so much time to investigate this either, but if you
 already found the cause then I could probably write a clean patch. Can
 you explain how you managed to load the old files, or send your hackish
 patch to me?


So that's a pretty longwinded explanation for what's happening. Now,
the fix was easy: I commented out the two lines in Parent.__call__
which raise the NotImplementedError, and I copy-pasted the code for
FractionField.__call__ back in place. This is clearly a hack. :) In
fact, it's bad -- the new objects I create don't pickle correctly, or
even if they did, we'd have the same problem trying to load them.
However, they loaded their coefficients just fine -- so I'm going to
write something that will instantiate correctly formed classes, coerce
the old values over via lists, and then finally save the new,
correctly structured objects. A mild pain, but it seems
straightforward enough, and I didn't think of anything easier.

Hopefully that makes sense -- but it's 2:30AM here, so feel free to
write back and say that didn't make any sense ... try again. :)

-cc

--~--~-~--~~~---~--~~
To post to this 

[sage-support] Re: I can't load objets in Sage 3.2.3 that were created in Sage 3.1.1

2009-03-02 Thread Craig Citro

Ah, does this mean you have a running copy of 3.1.1 still? Because I
think it'll be easier to give you a patch against 3.1.1 than a patch
against 3.2.3 ...

-cc

On Mon, Mar 2, 2009 at 10:06 AM, Alex Lara lrodr...@gmail.com wrote:

 Hi Craig,

 Thanks for explanation, it was clear. Now I have six files, but the
 program is still running and will generate more files. So, I would
 love you can explain me how to fix the problem.

 Thanks,

 Alex

 On 1 mar, 23:41, Craig Citro craigci...@gmail.com wrote:
  From command line of Sage 3.1.1, I saved some object, and then I could
  open it with sage 3.2.3. Next I open test.sobj (this was created by a
  sage program) in sage 3.1.1,  saved it again, and when I tried to open
  it on sage 3.2.3. Here you will find that 
  object:http://math.arizona.edu/~alara/test.sobj

  Alex

  Thanks.  I'll take a look at it.  I've also CC'd Craig Citro who most
  likely knows what is going on here.

  --Mike

 Hi Alex,

 Yeah, this one is going to be a little bit annoying to fix. Here's
 what's going on: in between 3.1.1 and 3.2.3, fraction fields got moved
 over to the new coercion model. This is good, but as it happens, the
 switch was done in such a way that it caused the pre-existing pickles
 to not load correctly (which is exactly what you're seeing). There's
 probably a clean and classy way to fix this, and I'll be happy to look
 at it carefully in a few weeks if no one beats me to it (I'm busy
 trying to finish up my thesis). This is now trac #5419.

 In the interim, you probably want to hack something together so that
 you can load your pickles. I managed to make sage 3.2.3 load the
 pickles, but it's a pretty ugly hack, and you'll still need to re-save
 the objects as newer pickles (which actually has one or two more
 wrinkles), so that you don't have to deal with this in the short term.
 How many of these files are there? If it's just a few, e-mail them to
 me off-list, and I'll just re-pickle them in a newer format and send
 them back to you. If there are more than that, I'll carefully explain
 how you can fix them yourself. :)

 -cc
 


--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: I can't load objets in Sage 3.2.3 that were created in Sage 3.1.1

2009-03-02 Thread Craig Citro

Hi Alex,

Well, I have one question first before deciding the right way to
proceed. Are all the objects you're creating the same general shape as
the ones in the test.sobj you posted -- collections of polynomials
over rational function fields in one variable over finite fields? If
so, then we have two options; if not, we probably only have option
(2).

(1) We can patch 3.2.3, so you can load the objects in 3.2.3. I'll
then write a function that will take the objects, recreate
corresponding objects in 3.2.3, coerce the old ones over, and re-save
them. This isn't so bad, but it depends on me knowing exactly what
kind of objects you've got. It's slightly more error-prone, I think.

(2) We build and patch 3.1.1, and you just load and save each object.
Then they should load fine in 3.2.3.

Which seems better to you? (I think (2) is slightly easier for me, but
nominally more work for you -- you have to build 3.1.1 on your
laptop.)

-cc

On Mon, Mar 2, 2009 at 10:32 AM, Alex Lara lrodr...@gmail.com wrote:

 Hey Craig,

 I have 3.2.3  in my laptop, but I use the machines of the University
 (which have 3.1.1) to do computations that take long time.

 ---Alex

 On 2 mar, 11:19, Craig Citro craigci...@gmail.com wrote:
 Ah, does this mean you have a running copy of 3.1.1 still? Because I
 think it'll be easier to give you a patch against 3.1.1 than a patch
 against 3.2.3 ...

 -cc

 On Mon, Mar 2, 2009 at 10:06 AM, Alex Lara lrodr...@gmail.com wrote:

  Hi Craig,

  Thanks for explanation, it was clear. Now I have six files, but the
  program is still running and will generate more files. So, I would
  love you can explain me how to fix the problem.

  Thanks,

  Alex

  On 1 mar, 23:41, Craig Citro craigci...@gmail.com wrote:
   From command line of Sage 3.1.1, I saved some object, and then I could
   open it with sage 3.2.3. Next I open test.sobj (this was created by a
   sage program) in sage 3.1.1,  saved it again, and when I tried to open
   it on sage 3.2.3. Here you will find that 
   object:http://math.arizona.edu/~alara/test.sobj

   Alex

   Thanks.  I'll take a look at it.  I've also CC'd Craig Citro who most
   likely knows what is going on here.

   --Mike

  Hi Alex,

  Yeah, this one is going to be a little bit annoying to fix. Here's
  what's going on: in between 3.1.1 and 3.2.3, fraction fields got moved
  over to the new coercion model. This is good, but as it happens, the
  switch was done in such a way that it caused the pre-existing pickles
  to not load correctly (which is exactly what you're seeing). There's
  probably a clean and classy way to fix this, and I'll be happy to look
  at it carefully in a few weeks if no one beats me to it (I'm busy
  trying to finish up my thesis). This is now trac #5419.

  In the interim, you probably want to hack something together so that
  you can load your pickles. I managed to make sage 3.2.3 load the
  pickles, but it's a pretty ugly hack, and you'll still need to re-save
  the objects as newer pickles (which actually has one or two more
  wrinkles), so that you don't have to deal with this in the short term.
  How many of these files are there? If it's just a few, e-mail them to
  me off-list, and I'll just re-pickle them in a newer format and send
  them back to you. If there are more than that, I'll carefully explain
  how you can fix them yourself. :)

  -cc
 


--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: I can't load objets in Sage 3.2.3 that were created in Sage 3.1.1

2009-03-01 Thread Craig Citro

 From command line of Sage 3.1.1, I saved some object, and then I could
 open it with sage 3.2.3. Next I open test.sobj (this was created by a
 sage program) in sage 3.1.1,  saved it again, and when I tried to open
 it on sage 3.2.3. Here you will find that object: 
 http://math.arizona.edu/~alara/test.sobj

 Alex

 Thanks.  I'll take a look at it.  I've also CC'd Craig Citro who most
 likely knows what is going on here.

 --Mike


Hi Alex,

Yeah, this one is going to be a little bit annoying to fix. Here's
what's going on: in between 3.1.1 and 3.2.3, fraction fields got moved
over to the new coercion model. This is good, but as it happens, the
switch was done in such a way that it caused the pre-existing pickles
to not load correctly (which is exactly what you're seeing). There's
probably a clean and classy way to fix this, and I'll be happy to look
at it carefully in a few weeks if no one beats me to it (I'm busy
trying to finish up my thesis). This is now trac #5419.

In the interim, you probably want to hack something together so that
you can load your pickles. I managed to make sage 3.2.3 load the
pickles, but it's a pretty ugly hack, and you'll still need to re-save
the objects as newer pickles (which actually has one or two more
wrinkles), so that you don't have to deal with this in the short term.
How many of these files are there? If it's just a few, e-mail them to
me off-list, and I'll just re-pickle them in a newer format and send
them back to you. If there are more than that, I'll carefully explain
how you can fix them yourself. :)

-cc

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Vector from polynomial coefficients -- length

2009-02-13 Thread Craig Citro

 Instead of using vectors, you should just use the indexing on the
 polynomials to extract the coefficients you want:

 sage: matrix([[p[i] for i in range(3)] for p in [x^10%p1, x^11%p1, x^12%p1]])
 [1 0 1]
 [1 1 1]
 [1 1 0]


There's also the padded_list method, used exactly for getting
vectors of a specific length:

sage: R.x = GF(2)[]
sage: f = x^2-3
sage: f.list()
[1, 0, 1]

sage: f.padded_list(5)
[1, 0, 1, 0, 0]

sage: p2 = x^5-4*x^2-1

sage: [ ((x^i)%p2).list() for i in range(8,12) ]
[[0, 0, 0, 1], [0, 0, 0, 0, 1], [1], [0, 1]]

sage: [ ((x^i)%p2).padded_list(p2.degree()) for i in range(8,12) ]
[[0, 0, 0, 1, 0], [0, 0, 0, 0, 1], [1, 0, 0, 0, 0], [0, 1, 0, 0, 0]]

-cc

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: solving matrix equations

2009-02-07 Thread Craig Citro

Hi,

Yep, there are definitely easy ways of doing this. Here's one way:

sage: var('a b c d')
(a, b, c, d)
sage: A = matrix(2,[2,1,1,1])
sage: B = matrix(2,[a,b,c,d])
sage: C = A*B - B*A

sage: [ e == 0 for e in C.list() ]
[c - b == 0, d + b - a == 0, -d - c + a == 0, b - c == 0]

sage: solve([ e == 0 for e in C.list() ], N.list())
[[a == r2 + r1, b == r2, c == r2, d == r1]]

-cc

On Sat, Feb 7, 2009 at 9:45 AM, mb bestv...@gmail.com wrote:

 Hi,

 Say I want to compute the centralizer of a matrix.

 sage: P.a,b,c,d=PolynomialRing(QQ)
 sage: A=matrix(P,2,2,[2,1,1,1])
 sage: B=matrix(P,2,2,[a,b,c,d])
 sage: C=A*B-B*A
 sage: C

 [-b + c -a + b + d]
 [ a - c - d  b - c]
 sage: var('a b c d')
 (a, b, c, d)
 sage: solve([-b + c==0,-a + b + d==0,a - c - d==0,b - c==0],[a,b,c,d])
 [[a == r2 + r1, b == r2, c == r2, d == r1]]

 Here I had to manually copy the entries of C into solve, which is a
 problem for larger matrices. Ideally, something like

 solve(C==0,[a,b,c,d])

 should work, but of course it doesn't. Is there any way of doing this?

 Mladen
 


--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Hermite Normal Form

2009-01-21 Thread Craig Citro

Hi Paul,

Are you using the most recent version of Sage? There was a performance
regression I accidentally introduced at some point to fix a bug, which
was corrected in Sage 3.2.2.

If that's not it, hopefully William will pipe in ...

-cc

On Wed, Jan 21, 2009 at 1:25 PM, Paul Zimmermann
paul.zimmerm...@loria.fr wrote:

   Hi,

 on http://www.loria.fr/~zimmerma/exemple40.sage you can find a 500x360
 integer matrix for which computing the Hermite Normal Form takes about
 10 times longer in Sage than in Magma:

 sage: C
 500 x 360 dense matrix over Integer Ring
 sage: time A=C.hermite_form()
 CPU times: user 22.91 s, sys: 0.09 s, total: 23.01 s
 Wall time: 23.02 s

 (it takes 2.440s with Magma on the same machine)

 Is there a faster way to compute a HNF in Sage? Does IML do that?

 Paul

 


--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Factorization class

2008-12-02 Thread Craig Citro

 Thanks. That works, but Sage automatically expands things so you
 need to do,
 [(i^j).factor() for i,j in f]

 To ensure that each polynomial term is shown factorized.


Do you want a list of pairs of the form (p,e) for each term in the
factorization of f? (That's actually how the factorization is stored
internally, so there's definitely no need to call back into factor to
do this.)

Is this what you'd want?

sage: R.x = ZZ[]
sage: f = x**10-1
sage: F = f.factor() ; F
(x - 1) * (x + 1) * (x^4 - x^3 + x^2 - x + 1) * (x^4 + x^3 + x^2 + x + 1)
sage: list(F)
[(x - 1, 1),
 (x + 1, 1),
 (x^4 - x^3 + x^2 - x + 1, 1),
 (x^4 + x^3 + x^2 + x + 1, 1)]

I know you also wanted a nice way to move between symbolic expressions
and polynomials (or, alternately, a partial fraction decomposition on
fraction fields of polynomial rings that seems to act consistently). I
agree that all of these should exist -- but in the interim, here's an
easy way to move from polynomials to symbolic expressions:

sage: R.x = ZZ[]
sage: f = x**10-1
sage: y = var('y',ns=1)
sage: type(f)
type 
'sage.rings.polynomial.polynomial_integer_dense_flint.Polynomial_integer_dense_flint'
sage: f(y)
y^10 - 1
sage: type(f(y))
type 'sage.symbolic.expression.Expression'

Maybe some of that is useful ...

-cc

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Doc-testing cdef'd methods

2008-12-01 Thread Craig Citro

 Question for all: is there a good reason for writing cdef functions?  Or
 should we make all cython functions cpdef?  Python convention seems to
 be to expose the internals of the class, but just mark (with _ or
 __) the functions that are considered internal and may change without
 warning.


There are definitely some cases where you have to -- for instance, if
the return type of your function is something like int *, you're not
going to be able to cpdef that. (Or, if you can, it's news to me.) I'm
sure there are other reasons -- Rob will probably chime in with some
as I'm typing this message. :)

That said, there are a *huge* number of functions that do just need
cdef turned into cpdef in the sage library.

 I'm facing the doctesting dilemma brought up here with some other cdef
 functions in another class.


Yeah, I agree that seeing def _doctest_this_cdef_function and
writing a little wrapper can be annoying, but I just don't think
there's another way around it in some cases.

-cc

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Fwd: A sage question

2008-11-30 Thread Craig Citro

You can just use the random_matrix command:

sage: random_matrix(GF(5), 4, 4)
[3 0 4 3]
[4 1 1 4]
[2 3 3 4]
[4 4 1 0]

-cc

On Sun, Nov 30, 2008 at 5:34 PM, Minh Nguyen [EMAIL PROTECTED] wrote:

 Hi folks,

 Perhaps someone can give a better answer to the question below? I
 haven't explored enough with random matrices and finite fields in Sage
 to competently answer the question.

 -- Forwarded message --
 From: Alasdair McAndrew [EMAIL PROTECTED]
 Date: Mon, Dec 1, 2008 at 12:30 PM
 Subject: A sage question
 To: [EMAIL PROTECTED]


 How do I create a 4x4 matrix whose elements are randomly chosen from a
 finite field?

 Thanks,
 Alasdair

 --
 Blog: http://amca01.wordpress.com

 --
 Regards
 Minh Van Nguyen

 Web: http://nguyenminh2.googlepages.com
 Blog: http://mvngu.wordpress.com

 


--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Method of Unknown Coefficients

2008-11-15 Thread Craig Citro

 In trying to utilize the method of unknown coefficients I ended up
 with this doozy:

 y=A*Exp(3*t)+B*t*Exp(3*t)+C*t^2*Exp(3*t)+D

 How can I get sage to treat A-D as arbitrary constants when
 differentiating.

You just have to tell sage to think of them as variables:

sage: var('A B C D t')
(A, B, C, D, t)

sage: y = A*exp(3*t) + B*t*exp(3*t) + C*t^2*exp(3*t) + D

sage: y.differentiate(t)
3*t^2*e^(3*t)*C + 2*t*e^(3*t)*C + 3*t*e^(3*t)*B + e^(3*t)*B + 3*e^(3*t)*A

Hope that helps ...

-cc

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: new user: latex fails

2008-11-03 Thread Craig Citro

This should do something pretty close:

%% margins
\oddsidemargin  0.0in
\evensidemargin 0.0in
\textwidth  6.45in
\topmargin  0.0in
\headheight 0.0in
\headsep0.0in
\textheight 9.0in

-cc

On Mon, Nov 3, 2008 at 7:57 PM, William Stein [EMAIL PROTECTED] wrote:

 On Mon, Nov 3, 2008 at 5:23 PM, Matthew J [EMAIL PROTECTED] wrote:

 If anyone else comes across this problem and installing gs and
 imagemagick does not solve it, I also had to install tetex-extra.


 I realized when I was getting the error: fullpage.sty could not be
 found.

 Thanks.  Maybe we should get rid of dependence on fullpage.sty,
 since probably there is an easy direct way to do about the same thing.

 William

 


--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Sage Days 11: November 7-10, Austin, Texas

2008-09-21 Thread Craig Citro

Hi all,

This is a reminder that Sage Days 11 is fast approaching! The topic is
Special functions and computational number theory meet scientific
computing. The plan is to bring together a bunch of number theorists
and scientific computing/supercomputing experts, and Austin's
incredible supercomputing facilities make this the perfect place for
it.

If you're new to Sage, and interested in this topic, attending a Sage
Days is the perfect way to get more involved. (For those of you who've
been around a while, you know the drill -- just go ahead and skip this
paragraph.) Sage Days are friendly and very intensive focused
development workshops, which are probably fairly different from other
math-related conferences and workshops you've attended. There are
usually only one to two talks per day, in order to allow for the
maximum time for working discussions and coding sprints. The groups
are organized on the first day, and there are regular progress reports
throughout the workshop.

We have a webpage:

  http://www.math.utexas.edu/sage

and a wiki page:

  http://wiki.sagemath.org/days11

If you're planning on joining us in Austin, please register soon at
http://www.ma.utexas.edu/sage/rform1.php, and add your name to the
wiki. We do have some limited funding available, so please let us know
if you'll need funding. We have a block of rooms reserved at the
Doubletree Guest Suites in Austin, and we'll let you know more details
on that soon.

If you have any questions, feel free to email me or any of the other organizers!

On behalf of the organizing committee,
-Craig Citro

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: bug with sums of matrices

2008-09-15 Thread Craig Citro

Pierre,

You'll be happy to hear that I got the following response from the
Singular team this morning:

=

Hello Craig Citro,
thanks for the bug report.
The bug is in the gcd computation for multivariate polynomials
over a field extension: therefore it does not show up in the case
of univariate polynomials or if all coefficients are in Q.
The next Singular version (3-1-0) uses a different algorithm at that place,
which is not affected by this error.

Hans Schoenemann

==

So it looks like this will be fixed on the other end soon ...

-cc

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: bug with sums of matrices

2008-09-11 Thread Craig Citro

Hi Pierre,

 perhaps i should have posted to sage-devel instead ? i don't even know
 how to properly report a bug.


No, this was the right place to report the bug. Probably no one has
responded just because no one has had a chance to look at the bug. I
just went ahead and took a look, and it turns out this is actually a
bug in Singular! Here's a simpler bit of code that is creating the
underlying error (or, at least, the first underlying error):

sage: K.I = CyclotomicField(4) ; R.x0,x1,x2,x3,x4 = K[]
sage: x = (7+I)*x1^2*x2*x3*x4 + x1*x2^2*x3*x4 + x1*x2*x3^2*x4 + x1*x2*x3*x4^2
sage: y = x1*x2*x3*x4
sage: x.gcd(y)
(I - 7)*x1^2*x2*x3*x4

We just call singular for this; in fact, here's the same bug in
singular (thanks to Martin Albrecht for translating this for me):

 ring r = (0,I),(x0,x1,x2,x3,x4),dp;
 minpoly = I^2 + 1;
 poly x = (7+I)*x1^2*x2*x3*x4 + x1*x2^2*x3*x4 + x1*x2*x3^2*x4 + x1*x2*x3*x4^2;
 poly y = x1*x2*x3*x4;
 gcd(x,y);
(I-7)*x1^2*x2*x3*x4

I'm going to go ahead and report this upstream; I'll reply to this
thread again when I find out what they say.

For the record, though, people on this list definitely respond faster
if you try to whittle down your examples to the smallest case you can
find that creates the error.

Sorry I don't have a workaround, but I hear the Singular people are
usually quite quick to respond.

-cc

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: bug with sums of matrices

2008-09-11 Thread Craig Citro

 don't worry about that, i've found a way to do my computation
 (everything happens in fact in a ring of laurent polynomials, so i've
 worked with them instead of the full ring of rational functions). I
 just wanted to report the bug.


Thanks for reporting it, and helping track it down!

-cc

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Number theory/group of units: Are

2008-09-05 Thread Craig Citro

  * K.complex_embeddings()  gives all the embeddings of K into CC (the
 complex numbers).
 You would need to  eliminate one of ecah conjugate pair of embeddings.

 TODO: implement a flag to complex_embeddings() which only gives one of
 each pair.


Actually, this code already exists:

sage: x = polygen(QQ); K.a = NumberField(x^3-2)
sage: K.places()
[Ring morphism:
  From: Number Field in a with defining polynomial x^3 - 2
  To:   Real Field with 106 bits of precision
  Defn: a |-- 1.259921049894873164767210607278,
 Ring morphism:
  From: Number Field in a with defining polynomial x^3 - 2
  To:   Complex Field with 53 bits of precision
  Defn: a |-- -0.629960524947437 + 1.09112363597172*I]

sage: K.places(prec=53)
[Ring morphism:
  From: Number Field in a with defining polynomial x^3 - 2
  To:   Real Double Field
  Defn: a |-- 1.25992104989,
 Ring morphism:
  From: Number Field in a with defining polynomial x^3 - 2
  To:   Complex Double Field
  Defn: a |-- -0.629960524947 + 1.09112363597*I]

It doesn't do anything remarkably clever, and makes the choice to
always take the embedding with positive imaginary part. One could
easily add a flag to make this more customizable ...

-cc

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Incorrect computations of Eisenstein series

2008-09-04 Thread Craig Citro

Hi Peter,

I've actually been planning on going back and cleaning up/speeding up
the Eisenstein series code at some point in the near future anyway.
I'm on vacation this week, but I'll look at this at the beginning of
next week. In the interim, this is now:

http://trac.sagemath.org/sage_trac/ticket/4062

-cc

On Thu, Sep 4, 2008 at 4:21 AM, Peter Bruin [EMAIL PROTECTED] wrote:

 Hi,

 When computing Eisenstein series with a given character, Sage may
 return some forms with a wrong character.  The following lines show an
 example of this:

 sage: G = DirichletGroup(7)
 sage: E = EisensteinForms(G[4]).eisenstein_series()
 sage: E[0].character() == G[4]
 False

 The problem appears to be caused by the condition

  if chi*psi == eps:

 in the function __find_eisen_chars in modular/modform/eis_series.py.
 According to Miyake, _Modular Forms_, Lemma 7.1.1 (cited in a comment
 in this function), it should be

  if chi == eps*psi:

 Another bug is that Sage uses an incorrect formula to compute q-
 expansions of Eisenstein series.  Here the origin of the problem seems
 to be formula (5.3.1) in Stein, _Modular Forms: A Computational
 Approach_, where the psi(n) should be replaced by its complex
 conjugate (cf. Miyake, _Modular Forms_, Theorem 4.7.1 and the first
 three lines of page 271).  The method __compute_general_case of the
 class EisensteinSeries in modular/modform/element.py reproduces this
 formula in the form

  v.append(sum([psi(n)*chi(m/n)*n**(k-1) for n in rings.divisors(m)]))

 Here psi should be ~psi.

 Thanks,

 Peter Bruin

 


--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: sparse Polynomial Quotient Ring troubles

2008-05-22 Thread Craig Citro

Yep, this was a bug. Fix is up here:

http://trac.sagemath.org/sage_trac/ticket/3272

Give it a try, and let me know if you run into any more trouble.

-cc

On Thu, May 22, 2008 at 11:13 AM, Kirill Vankov [EMAIL PROTECTED] wrote:

 Is there any way to define a polynomial ring over a sparse quotient
 ring?

 This works:
 sage: p = 5
 sage: A.T = PolynomialRing(Integers(p))
 sage: f = T^2+1
 sage: B = A.quo(f)
 sage: print B
 sage: C.s = PolynomialRing(B)
 sage: print C
 Univariate Quotient Polynomial Ring in Tbar over Ring of integers
 modulo 5 with modulus T^2 + 1
 Univariate Polynomial Ring in s over Univariate Quotient Polynomial
 Ring in Tbar over Ring of integers modulo 5 with modulus T^2 + 1

 But this does not work:
 sage: p = 5
 sage: A.T = PolynomialRing(Integers(p),sparse=True)
 sage: f = T^2+1
 sage: B = A.quo(f)
 sage: print B
 sage: C.s = PolynomialRing(B)
 Univariate Quotient Polynomial Ring in Tbar over Ring of integers
 modulo 5 with modulus T^2 + 1
 Traceback (most recent call last):
  File stdin, line 1, in module
  File /home/kvankov/.sage/sage_notebook/worksheets/admin/16/code/
 189.py, line 11, in module
exec compile(ur'C = PolynomialRing(B,names=(\u0027s\u0027,)); (s,)
 = C._first_ngens(Integer(1))' + '\n', '', 'single')
  File /usr/local/sage-2.11-ubuntu32-intel-i686-Linux/local/lib/
 python2.5/site-packages/sympy/plotting/, line 1, in module

  File /usr/local/sage-2.11-ubuntu32-intel-i686-Linux/local/lib/
 python2.5/site-packages/sage/rings/polynomial/
 polynomial_ring_constructor.py, line 256, in PolynomialRing
R = _single_variate(base_ring, name, sparse)
  File /usr/local/sage-2.11-ubuntu32-intel-i686-Linux/local/lib/
 python2.5/site-packages/sage/rings/polynomial/
 polynomial_ring_constructor.py, line 329, in _single_variate
elif base_ring.is_field():
  File /usr/local/sage-2.11-ubuntu32-intel-i686-Linux/local/lib/
 python2.5/site-packages/sage/rings/polynomial/
 polynomial_quotient_ring.py, line 412, in is_field
return self.base_ring().is_field() and
 self.modulus().is_irreducible()
  File polynomial_element.pyx, line 3762, in
 sage.rings.polynomial.polynomial_element.Polynomial.is_irreducible
  File polynomial_element.pyx, line 2109, in
 sage.rings.polynomial.polynomial_element.Polynomial.factor
  File polynomial_element.pyx, line 2118, in
 sage.rings.polynomial.polynomial_element.Polynomial._factor_pari_helper
  File /usr/local/sage-2.11-ubuntu32-intel-i686-Linux/local/lib/
 python2.5/site-packages/sage/rings/polynomial/polynomial_ring.py,
 line 243, in __call__
return C(self, x, check, is_gen, construct=construct)
  File /usr/local/sage-2.11-ubuntu32-intel-i686-Linux/local/lib/
 python2.5/site-packages/sage/rings/polynomial/
 polynomial_element_generic.py, line 95, in __init__
self.__coeffs[i] = R(z)
  File /usr/local/sage-2.11-ubuntu32-intel-i686-Linux/local/lib/
 python2.5/site-packages/sage/rings/integer_mod_ring.py, line 579, in
 __call__
return integer_mod.IntegerMod(self, x)
  File integer_mod.pyx, line 129, in
 sage.rings.integer_mod.IntegerMod
  File integer_mod.pyx, line 1380, in
 sage.rings.integer_mod.IntegerMod_int.__init__
  File integer_ring.pyx, line 274, in
 sage.rings.integer_ring.IntegerRing_class.__call__
  File integer.pyx, line 377, in sage.rings.integer.Integer.__init__
  File gen.pyx, line 750, in sage.libs.pari.gen.gen.__hex__
 TypeError: gen must be of PARI type t_INT

 K.
 


--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: bug in DirichletGroup?

2008-04-19 Thread Craig Citro

Yep, that's my fault. Fix is up at #2959; if you try it out and run
into any issues, just let me know.

-cc

On Sat, Apr 19, 2008 at 1:55 PM, David Joyner [EMAIL PROTECTED] wrote:

  Hi:

  I wonder if this behavior is a bug?

  sage: G = DirichletGroup(21)
  sage: chi = G.0; chi
  [-1, 1]
  sage: chi.values()
  [0, 1, -1, 0, 1, -1, 0, 0, -1, 0, 1, -1, 0, 1, 0, 0, 1, -1, 0, 1, -1]

  So far, so good (similar code is in the tutorial:
  http://www.sagemath.org/doc/html/tut/node15.html).
  Now use a different base ring:


  sage: G = DirichletGroup(21, GF(37))
  sage: chi = G.0; chi
  [36, 1]
  sage: chi.values()
  ---
  type 'exceptions.IndexError'Traceback (most recent call last)

  /mnt/drive_hda1/sagefiles/sage-3.0.alpha5/ipython console in module()

  
 /mnt/drive_hda1/sagefiles/sage-3.0.alpha5/local/lib/python2.5/site-packages/sage/modular/dirichlet.py
  in values(self)
1056 
1057 # record character value on n
  - 1058 result_list[n.ivalue] = R_values[value.ivalue]
1059 # iterate:
1060 #   increase the exponent vector by 1,

  type 'exceptions.IndexError': list index out of range


  Should I report this to trac?

  - David Joyner

  


--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Sage-2.9

2007-12-16 Thread Craig Citro

 Sage 2.9 has been released. It is available at

http://sagemath.org/download.html



So this built with no reported errors on my Mac Pro (Intel, 10.4.11).
However, make check reported one error:

sage -t  devel/sage-main/sage/stats/test.py
**
File test.py, line 5:
sage: import rpy
Exception raised:
Traceback (most recent call last):
  File /Users/craigcitro/sage-2.9/local/lib/python2.5/doctest.py,
line 1212, in __run
compileflags, 1) in test.globs
  File doctest __main__.example_0[0], line 1, in module
import rpy###line 5:
sage: import rpy
ImportError: No module named rpy
**
1 items had failures:
   1 of   1 in __main__.example_0
***Test Failed*** 1 failures.

Looking at the install.log, it turns out that rpy failed to build, but
this error wasn't propogated back to the r-2.6.1.p6 make process. So
there are two issues:

1) Why did rpy fail?
2) Should this stop the build of R, or at least inform the user more noticeably?

For (1), the answer was easy: the rpy setup.py uses tail -1 for
tail -n 1, which fails on some systems (namely mine). I'm running
the most current version of textutils:

[EMAIL PROTECTED] ~/sage-2.9/spkg/standard]  $ tail --version
tail (textutils) 2.1
Written by Paul Rubin, David MacKenzie, Ian Lance Taylor, and Jim Meyering.

Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

That's the most recent version according to the webpage, but the same
version is installed on sage.math, where tail -1 works just fine.
(This might have to do with the POSIX settings when tail was compiled?
I vaguely got this impression from the FAQ on the textutils webpage.)
So I'll report this upstream, but I suspect I should also add a patch
to the rpy-1.0.1.spkg we ship, because I doubt I'm the only one with
this issue. This is now trac ticket #1543, with a new rpy-1.0.1.spkg
attached (since there's no mercurial repository in the spkg).

2) I would assume that we should halt the build if rpy fails for any
reason; this is a simple 3-line fix in spkg-install, which I'm going
to post on trac right now. (...) It's trac ticket #1542, with the
simple patch attached.

-cc

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~--~~~~--~~--~--~---