[sage-support] Re: inline function declaration in Cython

2009-06-16 Thread Robert Bradshaw
On Jun 16, 2009, at 7:21 AM, Ethan Van Andel wrote: > I'm transferring some code to Cython to speed things up. > In my SAGE/python code, I have a function which takes as one of its > arguments, a function G. > I then declare a series of intermediate functions like this: > > Gprime = derivativ

[sage-support] Re: factor

2009-06-16 Thread Robert Bradshaw
On Jun 16, 2009, at 3:10 PM, Mikie wrote: > > Yes, and as you can see it works great in sage command line. When I > use it in a python script I get a syntax error for the period in > R.. > Clearly you are not using the preparser. What you could do is x = QQ['x'].gen(0) f = 2*x**2 - x f.factor(

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

2009-06-16 Thread Robert Bradshaw
On Jun 16, 2009, at 11:18 PM, Craig Citro wrote: > >> How about >> >> sage: p = 7 >> sage: K. = QQ[p^(1/p)] >> sage: q^p >> 7 >> sage: F. = 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/

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

2009-06-16 Thread Craig Citro
> How about > > sage: p = 7 > sage: K. = QQ[p^(1/p)] > sage: q^p > 7 > sage: F. = 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). > A

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

2009-06-16 Thread Robert Bradshaw
On Jun 16, 2009, at 6:16 PM, bonzerpotato wrote: > Does anyone know how to deal with non-integer modulo arithmetic on > sage? What about using mathematica? > > I'm referring to a situation such as, for p prime, q a p-th root of p, > then dealing with an element a of K = Q(q) using > > a = n mod q

[sage-support] Re: Pretty printing in sage 4.0.1 console?

2009-06-16 Thread Robert Bradshaw
On Jun 16, 2009, at 8:28 PM, Alasdair wrote: > In Sage 3.4 (running in a linux console), I could enter > > print expand((1+1/x)^3) > > and receive a nice 2D ascii representation of the result. In Sage > 4.0.1, all I get is > > 3/x + 3/x^2 + 1/x^3 + 1 > > What's happened to the pretty printing he

[sage-support] Pretty printing in sage 4.0.1 console?

2009-06-16 Thread Alasdair
In Sage 3.4 (running in a linux console), I could enter print expand((1+1/x)^3) and receive a nice 2D ascii representation of the result. In Sage 4.0.1, all I get is 3/x + 3/x^2 + 1/x^3 + 1 What's happened to the pretty printing here? Thanks, Alasdair --~--~-~--~~~---

[sage-support] non-integer modulo arithmetic

2009-06-16 Thread bonzerpotato
Does anyone know how to deal with non-integer modulo arithmetic on sage? What about using mathematica? I'm referring to a situation such as, for p prime, q a p-th root of p, then dealing with an element a of K = Q(q) using a = n mod q, ie there exists x such that a = n + qx, (nhttp://groups.goo

[sage-support] Re: tricky preparser bug in 4.01

2009-06-16 Thread Dan Drake
On Tue, 16 Jun 2009 at 05:09PM -0700, Utpal Sarkar wrote: > After a lot of headaches over some mysterious behaviour in some > scripts, I found the following: > I have two files: > test1.sage contains: > attach test2.sage > print "test1", 1/2 > > test2.sage contains: > print "test2", 1/2 > > When

[sage-support] tricky preparser bug in 4.01

2009-06-16 Thread Utpal Sarkar
After a lot of headaches over some mysterious behaviour in some scripts, I found the following: I have two files: test1.sage contains: attach test2.sage print "test1", 1/2 test2.sage contains: print "test2", 1/2 When I say on the command line of sage 3.3: attach test1.sage, the output is (correc

[sage-support] Re: bug: no local scope for symbolic variables

2009-06-16 Thread Dan Drake
I ran into the problem discussed in this thread just the other day, and my solution was to use sage.symbolic.ring. How does this solution compare to the others posted in this thread? Here's (basically) what I did: from sage.symbolic.ring import var as symbvar def foo(n, k): t = sy

[sage-support] Re: bug: no local scope for symbolic variables

2009-06-16 Thread Mike Hansen
On Tue, Jun 16, 2009 at 3:55 PM, Utpal Sarkar wrote: > > I think global=False would be a nice option, also because there seem > to be more differences between a symbolic variable created using "var" > and "new_var" than just the scope; I noticed that while "var" creates > a symbolic variable, "new

[sage-support] Re: bug: no local scope for symbolic variables

2009-06-16 Thread Utpal Sarkar
I think global=False would be a nice option, also because there seem to be more differences between a symbolic variable created using "var" and "new_var" than just the scope; I noticed that while "var" creates a symbolic variable, "new_var" creates an expression (class 'sage.symbolic.expression.Ex

[sage-support] Re: factor

2009-06-16 Thread Mikie
Yes, and as you can see it works great in sage command line. When I use it in a python script I get a syntax error for the period in R.. On Jun 16, 12:30 pm, David Joyner wrote: > Is this what you mean? > > sage: R. = PolynomialRing(ZZ,"x") > sage: f = 2*x**2-x > sage: f.factor() > x * (2*x - 1

[sage-support] Re: bug: no local scope for symbolic variables

2009-06-16 Thread Utpal Sarkar
Thanks! On Jun 16, 9:30 pm, William Stein wrote: > On Tue, Jun 16, 2009 at 9:12 PM, Utpal Sarkar wrote: > > > Hi, > > > It looks like locally defined symbolic variables are always global, in > > particular they overwrite globally defined variables of the same name: > > sage: d = 0 > > sage: def

[sage-support] Re: drawing graphs

2009-06-16 Thread Robert Miller
> Please -- Emily and Robert -- don't be at all offended by this email. > You two have both dramatically improved graph plotting in Sage over > what networkx offers, and Emily's predesigned layouts for the graph > families are beautiful.    I just think it is important to acknowledge > that on ran

[sage-support] Re: Interior points of a parametric graph

2009-06-16 Thread Ethan Van Andel
Apologies, I changed my google search terms and immediately found an effective algorithm. All is well. --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@g

[sage-support] Re: Interior points of a parametric graph

2009-06-16 Thread Ethan Van Andel
I think I've found the source code for that. However, It seems that it is a bit too deep/complex for me to use it as an effective base. Therefore, does anyone know a good way to find points on the interior of a figure? --~--~-~--~~~---~--~~ To post to this group, se

[sage-support] Re: bug: no local scope for symbolic variables

2009-06-16 Thread William Stein
On Tue, Jun 16, 2009 at 9:12 PM, Utpal Sarkar wrote: > > Hi, > > It looks like locally defined symbolic variables are always global, in > particular they overwrite globally defined variables of the same name: > sage: d = 0 > sage: def f(): > :     d = var('d') > :     d = 1 > : > sage:

[sage-support] bug: no local scope for symbolic variables

2009-06-16 Thread Utpal Sarkar
Hi, It looks like locally defined symbolic variables are always global, in particular they overwrite globally defined variables of the same name: sage: d = 0 sage: def f(): : d = var('d') : d = 1 : sage: d 0 sage: f() sage: d d (I put the d = 1 in the function definition to sh

[sage-support] Re: factor

2009-06-16 Thread David Joyner
Is this what you mean? sage: R. = PolynomialRing(ZZ,"x") sage: f = 2*x**2-x sage: f.factor() x * (2*x - 1) On Tue, Jun 16, 2009 at 11:12 AM, Mikie wrote: > > When I use Sage to factor lets say 2*x**2-x it factors the  2 out and > leaves a fraction in the expression.  I would like to have it no

Re: [linbox-devel] Re: [sage-support] linbox bug?

2009-06-16 Thread Clement Pernet
Just for the record, I'm answering to myself: > I'm also thinking of Danilevskii's elimination: although it could be > viewed as a Krylov method, it does not use any randomization, so could > it always give the whole minpoly ? I checked that this does not solve our pb: Danilevskii's alg is deter

[sage-support] Re: factor

2009-06-16 Thread Mikie
When I use Sage to factor lets say 2*x**2-x it factors the 2 out and leaves a fraction in the expression. I would like to have it not factor the polynomial unless their is an integer factor. By the way I have created a Twisted API that works. On Jun 15, 4:51 pm, William Stein wrote: > On Mon,

[sage-support] unsupported operand type(s) for +: 'sage.symbolic.function.SFunction' and 'sage.symbolic.function.SFunction'

2009-06-16 Thread Nicolas
Hi all, I was trying to add symbolic functions into another one. sage does seem to handle it. Is there any workaround ? See : -- | Sage Version 4.0.1, Release Date: 2009-06-06 | | Type notebook() for the GU

[sage-support] inline function declaration in Cython

2009-06-16 Thread Ethan Van Andel
I'm transferring some code to Cython to speed things up. In my SAGE/python code, I have a function which takes as one of its arguments, a function G. I then declare a series of intermediate functions like this: Gprime = derivative(G) Hconj(t) = 1/(2*pi*i)*(Gprime(t)/abs(Gprime(t))/(a-G(t)

Re: [linbox-devel] Re: [sage-support] linbox bug?

2009-06-16 Thread Clement Pernet
Oups, I missed this discussion. So I confirm, that we are using the Krylov based dense minpoly that returns a probabilistic minpoly, and I'm the one to blame for not taking care of this. So far, I don't know of any better certificate for minpoly than checking Pmin(A) = 0 (improved by using the fa

[sage-support] Re: drawing graphs

2009-06-16 Thread mark mcclure
On Jun 16, 2:36 am, Rado wrote: > > Here, for example, is the Cayley graph of the alternating group A5: > > > A = AlternatingGroup(5) > > G = Graph(A.cayley_graph()) > > s = G.graphviz_string() > > f = open('graphfile.dot', 'w') > > f.write(s) > > f.close() > > Actually for this example graphviz'