[sage-support] Re: Square root problem
isqrt returns the integer part (floor) of a square root. On Jul 17, 7:33 am, Santanu Sarkar sarkar.santanu@gmail.com wrote: Thank you. 2009/7/16 Marshall Hampton hampto...@gmail.com I'm not quite sure what you want, but for example sage: B = sqrt(1000) sage: floor(B) 31 would give you the integer part (rounded down since its floor). The round() function might be what you want instead (round(B) is 32.0). -Marshall Hampton On Jul 16, 10:05 am, Santanu Sarkar sarkar.santanu@gmail.com wrote: Suppose we want to find just integer part of square root 1000. Say B=sqrt(1000). Then how can I use digits function i,e. B.digits() to find the bits of B. --~--~-~--~~~---~--~~ 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: bug: no local scope for symbolic variables
Thanks for the replies. I noticed something funny: if you call x = var(X) in some scope, it is X that is injected into the global scope, not x. In fact I thought that the argument was merely a print name. On Jun 17, 1:49 am, Dan Drake dr...@kaist.edu wrote: 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 = symbvar('t') return exp(t^k).series(t, n+1).coefficient(t, n)*factorial(n) Comments? Dan -- --- Dan Drake dr...@kaist.edu - KAIST Department of Mathematical Sciences --- http://mathsci.kaist.ac.kr/~drake signature.asc 1KViewDownload --~--~-~--~~~---~--~~ 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] bug: no local scope for symbolic variables
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 show the difference in behaviour) --~--~-~--~~~---~--~~ 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: bug: no local scope for symbolic variables
Thanks! On Jun 16, 9:30 pm, William Stein wst...@gmail.com wrote: On Tue, Jun 16, 2009 at 9:12 PM, Utpal Sarkardoe...@gmail.com 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: d 0 sage: f() sage: d d (I put the d = 1 in the function definition to show the difference in behaviour) Use new_var: sage: d=0 sage: def foo(n): ... d = sage.calculus.var.new_var('d') ... print d^n ... ... sage: foo(10) d^10 sage: d 0 Maybe var(global=False) should be an option? William --~--~-~--~~~---~--~~ 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: bug: no local scope for symbolic variables
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.Expression') which cannot be used in the same way, e.g. solve_mod(3*x == 1, 10) is ok for x created using var but causes an error for x created using new_var. On Jun 16, 9:53 pm, Utpal Sarkar doe...@gmail.com wrote: Thanks! On Jun 16, 9:30 pm, William Stein wst...@gmail.com wrote: On Tue, Jun 16, 2009 at 9:12 PM, Utpal Sarkardoe...@gmail.com 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: d 0 sage: f() sage: d d (I put the d = 1 in the function definition to show the difference in behaviour) Use new_var: sage: d=0 sage: def foo(n): ... d = sage.calculus.var.new_var('d') ... print d^n ... ... sage: foo(10) d^10 sage: d 0 Maybe var(global=False) should be an option? William --~--~-~--~~~---~--~~ 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] tricky preparser bug in 4.01
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 (correctly): sage: attach test1.sage test2 1/2 test1 1/2 But on sage 4.01, the output is: sage: attach test1.sage test2 0 test1 1/2 It looks as if on a file that is attached from another attached file, no preparsing takes place. If within this same session I touch test2.sage, it works fine. --~--~-~--~~~---~--~~ 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: Numerical approximation
sage: round(x,2) 0.0 To show it really does what you want: sage: round(1.2345,2) 1.23 On May 2, 8:35 pm, Fidel fidel.barr...@gmail.com wrote: Hello, I think I tried to post this about an hour ago, but the discussion didn't show up. So I'm doing it again, sorry in case it is repeated. I am working in sage 3.4.1 I am trying to define a function to get the LaTeX string of a graph, so I am trying to convert a number to string. I have x=6.1230317691118863e-17, which I got from sage: x=graphs.PetersenGraph().get_pos()[0][0] I would like a two decimal approximation of x, that is 0.00. I have tried sage: numerical_approx(x,digits=2) 6.1e-17 sage: n(x,digits=2) 6.1e-17 Is there a way to get 0.00 as output? Thanks in advance for your attention and help. Greetings, Fidel --~--~-~--~~~---~--~~ 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] Problem with Hilbert class field of degree 1
Hi, I found some strange behaviour of the Hilbert class field of a quadratic number field when the class number is 1, so the Hilbert class field is equal to the ground field: sage: K.w = QuadraticField(-5); KX.X = K[]; H.h = K.hilbert_class_field() sage: (X + w + 1).base_extend(H) X + w + 1 No problem: the Hilbert class field is a proper extension, and the polynomial remains the same. sage: K.w = QuadraticField(-1); KX.X = K[]; H.h = K.hilbert_class_field() sage: (X + w + 1).base_extend(H) X + 1 In this case the Hilbert class field is equal to K, and the part of the polynomial that is not in QQ disappears. --~--~-~--~~~---~--~~ 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] precision in pari elliptic curve accessed from sage
Hi, I have an elliptic curve E in sage (over Q) and for a certain complex number tau I try to compute the image under the uniformization provided by the Weierstrass P-function associated to E. For this I use the function ellztopoint of pari: sage: E = EllipticCurve(14) sage: tau = ComplexField(1000)(pi) # just an example sage: pari(E).ellztopoint(pari(tau)) [1.23763244564628 + 5.42101086 E-19*I, 0.329632363358045 + 8.13151629 E-19*I] My question is how I can control the precision in the result. If tau has a certain precision in sage, then pari(tau) will have the corresponding precision in pari. I tried 1) converting E to pari with a specified precision: sage: pari.new_with_bits_prec(E,1000).ellztopoint(pari(tau)) [1.2376324456462778242 + 5.42101086 E-19*I, 0.3296323633580451282 + 8.13151629 E-19*I] 2) setting the pari precision globally, by calling pari.set_real_precision(1000) before the call. This didn't work: sage: pari.set_real_precision(1000) 15 sage: pari(E).ellztopoint(pari(tau)) [1.2376324456462778242 + 5.42101086 E-19*I, 0.3296323633580451282 + 8.13151629 E-19*I] In both cases I get the same result. The only thing that works is 3) setting the pari precision globally and passing a string to pari: sage: pari.set_real_precision(1000) 15 pari(ellztopoint(ellinit(%s),%s) % (E.a_invariants(), tau)) [1.237632445645734830919483 + 3.567678178 E-1001*I, 0.329632363353691950256 + 2.973065149 E-1001*I] Should the first two have worked as well? Thanks --~--~-~--~~~---~--~~ 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: bug: problem with arithmetic in SL_2(Z)
Thanks! On May 23, 10:05 am, Craig Citro [EMAIL PROTECTED] wrote: Hi Uptal, Yep, you're exactly right about what's causing this issue -- each time you call SL2Z(), it creates a new object. However, there's no need for this -- after all, SL2Z is a real mathematical object, so it should be a distinct object in Sage, just like ZZ or QQ. So I've made this change, and posted a patch at: http://trac.sagemath.org/sage_trac/ticket/3275 It'll be in the next version of Sage (3.0.2). Note that this means you'll want to use it slightly differently -- so your example would become: sage: S = SL2Z([0,-1,1,0]) sage: T = SL2Z([1,1,0,1]) sage: S*T [ 0 -1] [ 1 1] Or better yet: sage: S = SL2Z.0 ; S [ 0 -1] [ 1 0] Definitely let us know if you run into any more trouble! -cc On Thu, May 22, 2008 at 2:14 PM, Utpal Sarkar [EMAIL PROTECTED] wrote: Hi, There are problems doing arithmetic in SL_2(Z): S,T = SL2Z().gens() S*T; # no problem S^2*T^3; # no problem S^-2*T^-3; # no problem but when I multiply two elements with different exponent: S^-2*T^3; S^2*T^-3; T^2*T^-3; I get a type 'exceptions.TypeError': Cannot convert sage.matrix.matrix_integer_2x2.Matrix_integer_2x2 to sage.matrix.matrix_integer_dense.Matrix_integer_dense However, T.parent() and (T^-1).parent() return the same thing (both equal string values Modular Group SL(2,Z) and equal when directly compared with == and even with 'is'). When I do sage: S = SL2Z()([0,-1,1,0]) sage: T = SL2Z()([1,1,0,1]) sage: S*T I even get a runtime error: type 'exceptions.RuntimeError': There is a bug in the coercion code in SAGE. In this case in fact the parents are not equal: they are when compared with ==, but not with 'is'. (That's fine, that is more something of the implementation) Finally, if I do sage: G = SL2Z() sage: S = G([0,-1,1,0]) sage: T = G([1,1,0,1]) then I can work correctly with S and T. --~--~-~--~~~---~--~~ 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] bug: problem with arithmetic in SL_2(Z)
Hi, There are problems doing arithmetic in SL_2(Z): S,T = SL2Z().gens() S*T; # no problem S^2*T^3;# no problem S^-2*T^-3; # no problem but when I multiply two elements with different exponent: S^-2*T^3; S^2*T^-3; T^2*T^-3; I get a type 'exceptions.TypeError': Cannot convert sage.matrix.matrix_integer_2x2.Matrix_integer_2x2 to sage.matrix.matrix_integer_dense.Matrix_integer_dense However, T.parent() and (T^-1).parent() return the same thing (both equal string values Modular Group SL(2,Z) and equal when directly compared with == and even with 'is'). When I do sage: S = SL2Z()([0,-1,1,0]) sage: T = SL2Z()([1,1,0,1]) sage: S*T I even get a runtime error: type 'exceptions.RuntimeError': There is a bug in the coercion code in SAGE. In this case in fact the parents are not equal: they are when compared with ==, but not with 'is'. (That's fine, that is more something of the implementation) Finally, if I do sage: G = SL2Z() sage: S = G([0,-1,1,0]) sage: T = G([1,1,0,1]) then I can work correctly with S and T. --~--~-~--~~~---~--~~ 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 AbelianGroup
I think it should be considered a bug, because it is sage, not the user, that decides what presentation to use. In this example, the group A is not considered equal to the subgroup generated by its generators (groups that are not only isomorphic, but really equal), because internally the presentation of the subgroup differs from that of the ambient group. On the other hand, there are isomorphic groups with different presentations that are considered equal: AbelianGroup([6]) == AbelianGroup([1,6]) True On May 8, 10:16 am, John Cremona [EMAIL PROTECTED] wrote: Is this actually a bug? It would certainly wrong if the test being performed was isomorphism rather than equality, but I think it is actually reasonable for two finite abelian groups to only be reported as equal when they are presented the same way. John Cremona 2008/5/7 William Stein [EMAIL PROTECTED]: On Wed, May 7, 2008 at 3:18 PM, Utpal Sarkar [EMAIL PROTECTED] wrote: Hi there, When I define an abelian group A = AbelianGroup(1,[6]) and then generate a subgroup that actually is the whole group itself, and then compare it to the original group: A.subgroup(list(A.gens())) == A the result may be either True or False. In this example it is False. When defining A as A = AbelianGroup(2,[3,2]) it is False as well, but when I define it as A = AbelianGroup(2,[2,3]) it is True. My guess is that this is because comparison of finite Abelian groups is implemented using their invariant factors, but when you create the group using factors that are not in canonical form or not in increasing order, these are used instead of the ordered list of invariant factors anyway. Greetings, Utpal Thanks for reporting this bug! We are tracking it here: http://trac.sagemath.org/sage_trac/ticket/3127 -- 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] Bug in AbelianGroup
Hi there, When I define an abelian group A = AbelianGroup(1,[6]) and then generate a subgroup that actually is the whole group itself, and then compare it to the original group: A.subgroup(list(A.gens())) == A the result may be either True or False. In this example it is False. When defining A as A = AbelianGroup(2,[3,2]) it is False as well, but when I define it as A = AbelianGroup(2,[2,3]) it is True. My guess is that this is because comparison of finite Abelian groups is implemented using their invariant factors, but when you create the group using factors that are not in canonical form or not in increasing order, these are used instead of the ordered list of invariant factors anyway. Greetings, Utpal --~--~-~--~~~---~--~~ 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] Galois theory
Hi, 1) Does anyone know if sage has functions that compute the fixed field for a given subgroup of the Galois group? 2) Is there a function to obtain the Artin map of an Abelian extension, or at least for the Hilbert class field of a quadratic field? Thanks, Utpal --~--~-~--~~~---~--~~ 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/ -~--~~~~--~~--~--~---
[sage-support] Re: Galois theory
On Nov 1, 5:50 pm, William Stein [EMAIL PROTECTED] wrote: On 11/1/07, Utpal Sarkar [EMAIL PROTECTED] wrote: 1) Does anyone know if sage has functions that compute the fixed field for a given subgroup of the Galois group? Short answer -- no, not yet. Just out of curiosity, do you want to do this in a setting where the computation is very difficult? Or just sort of routine small computations? E.g., could you give an example of the field, etc.? For the moment I just need it for some easy case in which it can be done by hand easily, namely the fixed field under an involution of a number field. It was more out of curiosity and for possible later use. 2) Is there a function to obtain the Artin map of an Abelian extension, or at least for the Hilbert class field of a quadratic field? Maybe PARI (included in SAge) can do some of this. I don't think Sage itself has an easy interface to this functionality yet. William Ok, thanks! --~--~-~--~~~---~--~~ 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/ -~--~~~~--~~--~--~---
[sage-support] Bugs in class group?
Hi, I'm doing some simple things with class groups, and some things don't work as expected. Let G be a class group of a number field. I am interested in obtaining the actual ideal classes (is there an easy direct way? list(G) returns abstract elements. Is it possible to obtain a map from the class group to the ideal group, mapping class group elements to representatives?) Since generators of G can be obtained as ideal classes, to obtain all of them you just have to multiply powers of the generators, and for that it would be useful to know the orders of the generators. When I call (G.0).order() it shows an error message saying that it is not implemented (which seems strange). I tried to work around this by generating the subgroups of G generated by these generators of G in turn to obtain their orders, but when I say G.subgroup([G.0]) or G.subgroup(G.gens()) an error results, saying that the elements passed don't belong to G. --~--~-~--~~~---~--~~ 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/ -~--~~~~--~~--~--~---
[sage-support] Re: Bugs in class group?
Thanks! On Nov 1, 8:35 pm, William Stein [EMAIL PROTECTED] wrote: On 11/1/07, Utpal Sarkar [EMAIL PROTECTED] wrote: I'm doing some simple things with class groups, and some things don't work as expected. Let G be a class group of a number field. sage: K.a = NumberField(x^2 + 23) sage: G = K.class_group(); G Class group of order 3 with structure C3 of Number Field in a with defining polynomial x^2 + 23 I am interested in obtaining the actual ideal classes (is there an easy direct way? list(G) returns abstract elements. Is it possible to obtain a map from the class group to the ideal group, mapping class group elements to representatives?) This is not implemented yet (the function list is just something implemented in the base abstract abelian group class, which is inherited -- it doesn't do anything useful in this case, really.) Class groups were only added to sage very recently, and aren't fully implemented. Adding code to enumerate all elements will show up in Sage soon, but it will take some work. Since generators of G can be obtained as ideal classes, to obtain all of them you just have to multiply powers of the generators, and for that it would be useful to know the orders of the generators. When I call (G.0).order() it shows an error message saying that it is not implemented (which seems strange). It isn't implemented. You could implement a dumb order function though: sage: K.a = NumberField(x^2 + 23) sage: G = K.class_group(); G Class group of order 3 with structure C3 of Number Field in a with defining polynomial x^2 + 23 sage: G.gens() [Fractional ideal class (2, 1/2*a - 1/2)] sage: a = G.0 sage: def myorder(I): ... n = 1 ... J = I ... while J != 1: ... J = J * I ... n += 1 ... return n sage: myorder(a) 3 -- I don't recommend doing this -- it's much better to understand how fractional ideals, etc. are represented using the PARI C library in Sage, then use a call to PARI to determine the order of the fractional ideal class. This is what I'll do when I implement this in the Sage library. I tried to work around this by generating the subgroups of G generated by these generators of G in turn to obtain their orders, but when I say G.subgroup([G.0]) or G.subgroup(G.gens()) an error results, saying that the elements passed don't belong to G. That's because creating subgroups of ideal class groups is not implemented. Sage should produce a NotImplementedError in this case too. I've created trac ticket #1052 http://trac.sagemath.org/sage_trac/ticket/1052 which is to implement more functionality for class groups of number fields in Sage.The class I'm teaching right now starts on class groups tomorrow, incidentally... http://wiki.wstein.org/ant07/sched -- 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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/ -~--~~~~--~~--~--~---
[sage-support] Re: rational solutions to a bivariate polynomial
There is not always a solution. Whether or not there is a solution is the contents of the Hasse-Minkowski theorem. I couldn't find a function in sage that immediately tells you whether there is a rational solution. There is a function that tells you whether there is a local solution at a prime p, namely hilbert_symbol(-N, d, p) (this is 1 when there is a solution, otherwise -1), and the Hasse-Minkowski theorem actually states that there is a global (rational) solution if and only if there is a local solution at every prime p including infinity (in sage you have to pass p = -1). In fact this only has to be checked for primes that divide N or d, for 2 and for infinity. In sage you could write a function like this, in one line if you use some fancy python constructs (using the N and d as in your equation (2), check just in case I made a mistake): def has_rational_solution(N,d): return reduce(lambda P,Q: P and Q, [prod([hilbert_symbol(a,b,p) for a in [-N.numerator(), N.denominator()] for b in [d.numerator(), d.denominator()]]) == 1 for p in prime_divisors(2*N*d) + [-1]]) If you have magma installed (accessible from sage in that case), then this function will actually give you a rational point (in homogeneous coordinates) if it exists: f := funcN,d| HasRationalPoint(Conic(P2, P2.1^2 - d*P2.2^2 + N*P2.3^2)) where P2 is ProjectiveSpace(Rationals(),2); Hope you find this useful. Greetings, Utpal On Sep 20, 9:40 pm, David Stahl [EMAIL PROTECTED] wrote: I have a non-SAGE question and am hoping someone can point me to a source that discusses the solution. I am trying to find a rational solution for x and y to the equation: Ax^2 + Bxy + Cy^2 + Dx + Ey + F =0(1) where the coefficients are rational. This can be transformed to: xprm^2 - d*yprm^2 + N = 0 (2) There are alot of websites that talk about finding integer solutions to these equations with integer coefficients. I do not think an integer solution always exists when the coefficients of (2) are rational but I do think a rational solution always does exist and I am perfectly happy with a rational solution. Any guidance would be appreciated. Thank you. David --~--~-~--~~~---~--~~ 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/ -~--~~~~--~~--~--~---
[sage-support] Re: Working with class groups + bug?
Ok, I'll just add to this thread whatever I come across. For the moment I think I found a small bug in hilbert_class_field. R.X = PolynomialRing(QQ) K.u = NumberField(X^2 + 5) L.v = K.hilbert_class_field() causes an error. However, when I create K explicitly as a quadratic field: K.u = QuadraticField(-5) L.v = K.hilbert_class_field() everything is ok. On May 31, 2:41 am, William Stein [EMAIL PROTECTED] wrote: Hi Utpal, Unfortunately number fields are not in the best shape in SAGE right now. There's been much discussion about this among some of the SAGE developers recently, and we will have a project about this at Sage Days 4 (which is in two weeks). So, basically, keep your questions and comments coming. They will help. On 5/30/07, Utpal Sarkar [EMAIL PROTECTED] wrote: To compute the abstract class group I can just create a number field K = QuadraticField(-23) and ask for it K.class_group() - Multiplicative Abelian Group isomorphic to C3 Is there a way to obtain representatives of the ideal classes (like in Magma where there is a second return value that is a map from the abstract group to the set of prime ideals? When trying to obtain generators by hand I encountered the following problem: p = K.factor_integer(2)[0][0] is a prime divisor of 2, which happens to have order 3 (the function p.order() is not implemented yet). p.is_principal() - False However: (p^3).is_principal() - False gives the wrong answer. This roundabout gives the correct answer len((p^3).gens_reduced()) == 1 - True but I encountered instances where the reduced set of generators is not as reduced as it could be, so this is not a reliable method. -- William Stein Associate Professor of Mathematics University of Washingtonhttp://www.williamstein.org --~--~-~--~~~---~--~~ 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/ -~--~~~~--~~--~--~---
[sage-support] Error using Jones database of number fields
When trying to use the Jones database I get an error. J = JonesDatabase() works correctly and creates the instance. J.ramified_at([2,3,5]) generates an exception, both at my local installation and when executing it on an online notebook at http://www.sagenb.org/. I copied the stack trace from the second one below. When looking into the code, it turns out that the call that causes the error is self.root = load(JONESDATA+ /jones.sobj) where load is a function from the compiled library sage/structure/ sage_object.so. Traceback (most recent call last): File , line 1, in File /notebooks/server/sage_notebook/worksheets/doetoe/code/5.py, line 4, in J.ramified_at([Integer(2),Integer(3),Integer(5)]) File /notebooks/server/, line 1, in File /sage/local/lib/python2.5/site-packages/sage/databases/ jones.py, line 196, in ramified_at Z = self.get(S, var=var) File /sage/local/lib/python2.5/site-packages/sage/databases/ jones.py, line 167, in get self.root = load(JONESDATA+ /jones.sobj) File sage_object.pyx, line 433, in sage_object.load File sage_object.pyx, line 494, in sage_object.loads RuntimeError: No module named polynomial_element_generic invalid data stream invalid load key, 'x'. Unable to load pickled data. --~--~-~--~~~---~--~~ 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/ -~--~~~~--~~--~--~---
[sage-support] Re: Sage include paths
I thought it could work something like this: As a command line option it could be like an include path or a library path to gcc, i.e. every option -I path (or any other name of the switch, this is the one for includes in gcc) is added to the existing default list of paths. This could be useful e.g. when calling sage from a launcher, in which case you could put these options in the launcher so that it will always be called with these paths when ran from the launcher. As an environment variable it could work just like LD_LIBRARY_PATH, PYTHONPATH or MAGMA_PATH: a list of paths separated by colons (or some other separator) whose constituents are also added to the existing list of paths. For reasons of implementation, maybe it is easier to just use PYTHONPATH for sage files as well. If this list would be directly accessible from sage, as in python where it is stored in sys.path (which is read/write), and moreover there were the possibility to specify a startup script which would be executed just before entering the session (like in magma when called with -s, or in bash and many other linux programs where it is a standard file .bashrc), then you could also append your paths to the standard list in the startup script. When calling load or attach from sage with a non-absolute path, it would cycle through this list, concatenating the paths with the string passed to load or attach, until it finds the file. If you consider this useful, and you could implement any of these in sage, that would be great! Thanks, Utpal On May 25, 4:48 pm, William Stein [EMAIL PROTECTED] wrote: On 5/25/07, doetoe [EMAIL PROTECTED] wrote: Is there a way to set a search path for sage files (for load and attach), e.g. by means of an environment variable or by passing a command line option when starting sage? I looked for it in the documentation, but I couldn't find anything. This feature doesn't exist yet. I hadn't thought to implement it until you just asked. Could you perhaps write a little more about how you think it would work, so I can implement it. If anybody has any other comments about this, please chime up. 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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/ -~--~~~~--~~--~--~---
[sage-support] Re: Sage include paths
Thanks! On May 25, 6:27 pm, William Stein [EMAIL PROTECTED] wrote: On 5/25/07, Utpal Sarkar [EMAIL PROTECTED] wrote: I thought it could work something like this: Thanks for your detailed feedback. [...] and moreover there were the possibility to specify a startup script which would be executed just before entering the session (like in magma when called with -s, or in bash and many other linux programs where it is a standard file .bashrc), then you could also append your paths to the standard list in the startup script. By the way, there is already a file that gets executed on startup in SAGE, namely the file $HOME/.sage/init.sage if you have it. When calling load or attach from sage with a non-absolute path, it would cycle through this list, concatenating the paths with the string passed to load or attach, until it finds the file. If you consider this useful, and you could implement any of these in sage, that would be great! I think it's a great proposal, and can likely easily implement it. 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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/ -~--~~~~--~~--~--~---