[sage-support] Plot in Sage

2011-05-10 Thread Santanu Sarkar
How to plot x^2 +y^2+z^2 =1 and x^2+y^2+2z^2 =1 where -1=x,y,z=1 in 3d? -- 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

[sage-support] Re: Plot in Sage

2011-05-10 Thread ancienthart
var('x,y,z') A = implicit_plot3d(x^2 + y^2 + z^2 == 1, (x,-1,1),(y,-1,1),(z,-1,1),opacity=0.5) B = implicit_plot3d(x^2 + 2*y^2 + 2*z^2 == 1, (x,-1,1),(y,-1,1),(z,-1,1),color='red') show(A+B) -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group,

[sage-support] Preparsing Cython file before compilation

2011-05-10 Thread Alastair Irving
Hi I've got a .sage file that I want to compile using Cython. If I just copy it to a .spyx file and do load myfile.spyx then the sage preparser is not called on the file. What's the simplest way of calling the preparser before compiling? Many thanks Alastair Irving -- To post to this

[sage-support] Re: Categories and parents

2011-05-10 Thread Bruce
I will summarise what I have learnt from Nicolas Thiery: If M is a monoid then the monoid algebra is constructing using Monoid().Algebra() by, say, M.algebra(QQ). For groups the construction GroupAlgebra is being replaced by a similar G.algebra(). This is part of an ongoing program to replace

Re: [sage-support] Re: Categories and parents

2011-05-10 Thread Burcin Erocal
On Tue, 10 May 2011 06:03:14 -0700 (PDT) Bruce brucewestb...@gmail.com wrote: I will summarise what I have learnt from Nicolas Thiery: If M is a monoid then the monoid algebra is constructing using Monoid().Algebra() by, say, M.algebra(QQ). For groups the construction GroupAlgebra is being

[sage-support] Re: Plot in Sage

2011-05-10 Thread ObsessiveMathsFreak
You can also get fancy with the region option to obtain cut away plots of the surfaces. implicit_plot3d(x^2 + 2*y^2 + 2*z^2 == 1,(x,-1,1),(y,-1,1), (z,-1,1),color='red',region=lambda x,y,z: x0 or y0 ) On May 10, 10:12 am, ancienthart joalheag...@gmail.com wrote: var('x,y,z') A =

[sage-support] Re: Notebook data cache

2011-05-10 Thread ObsessiveMathsFreak
This is actually a huge problem for me as I need to transfer sage notebooks between different computers. Some individual sws files I have are upwards of 60MB each! I have often found that the best way to deal with this is to go into the Edit section--at the top of the worksheet--and then copy and

[sage-support] efficient way to convert str to rational

2011-05-10 Thread tvn
I am trying to read in a database containing lines of numbers (in string format) and convert each of these numbers to Rational. For example '1.2 3 4 5/6 7 8.2' becomes [6/5, 3, 4, 5/6, 7, 41/5] I wrote the below small utility function that takes in a string s and converts it to rational if

[sage-support] Re: efficient way to convert str to rational

2011-05-10 Thread ObsessiveMathsFreak
I think you should definitely get rid of the try/except statements. The conversion is either going to work, or it is not, so you really don't need them and they're probably slowing everything down a LOT. If the database is very large, you might want to consider converting outside of sage, with a

[sage-support] Re: Notebook data cache

2011-05-10 Thread Jason Grout
On 5/10/11 9:12 AM, ObsessiveMathsFreak wrote: This is actually a huge problem for me as I need to transfer sage notebooks between different computers. Some individual sws files I have are upwards of 60MB each! I have often found that the best way to deal with this is to go into the Edit

[sage-support] Print huge matrix - notebook: WARNING: Output truncated!

2011-05-10 Thread Jakob Lombacher
Hi, I've got a ugly matrix, that elements consists of huge symbolic expressions. When I try to print it via view(H) I get the message WARNING: Output truncated! full_output.txt By clicking on full_output.txt I get some text file, looking like html but it doesn't seem complete and the

[sage-support] Re: Print huge matrix - notebook: WARNING: Output truncated!

2011-05-10 Thread kcrisman
Dear Jakob, Thanks for your question. You may find http://ask.sagemath.org/question/469/how-do-i-display-the-full-output-that-includes helpful in this regard. Please let us know if that doesn't help. - kcrisman On May 10, 11:26 am, Jakob Lombacher lombac...@googlemail.com wrote: Hi, I've

[sage-support] Re: efficient way to convert str to rational

2011-05-10 Thread tvn
I suggest to use the csv module of Python. but bottleneck is not reading the data file but rater applying the conversion from s - rat .Also I can't just use QQ(s) , because s can be something like '1.2' -- To post to this group, send email to

[sage-support] how to structure conditional

2011-05-10 Thread MathLynx
I am trying to learn basic Sage functionality and need a bit of coaching. Here is one example that I have not been able to figure out. This is all being done within a Notebook. x,y = var('x, y'); A = x+y == 3; bool(A.substitute(x=1,y=2)) returns True, but x,y = var('x, y'); A = x+y == 3; if

[sage-support] Re: how to structure conditional

2011-05-10 Thread Volker Braun
Python uses indentation for blocks: sage: x,y = var('x, y'); sage: A = x+y == 3; sage: if A.substitute(x=1,y=2): : print Yes : else: : print No : Yes -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email

[sage-support] Re: how to structure conditional

2011-05-10 Thread MathLynx
Too easy! I'll start to make them harder as I learn... LOL On May 10, 1:53 pm, Volker Braun vbraun.n...@gmail.com wrote: Python uses indentation for blocks: sage: x,y = var('x, y'); sage: A = x+y == 3; sage: if A.substitute(x=1,y=2): :     print Yes : else: :     print No

[sage-support] degree of poly

2011-05-10 Thread MathLynx
How do I detect the degree of a polynomial (say over Q) in one or several variables? x = var('x'); B = x^2; B.deg() gives an error. How about x,y = var('x , y'); B = x^2 + y^3; and we want degree of B with respect to x? (presuming wrt y is the same) -- To post to this group, send email to

[sage-support] Re: efficient way to convert str to rational

2011-05-10 Thread Simon King
On 10 Mai, 19:23, tvn nguyenthanh...@gmail.com wrote: I suggest to use the csv module of Python. but bottleneck is not reading the data file but rater applying  the conversion from s - rat  .    Also I can't just use QQ(s)  ,  because s can be something like '1.2'   OK. First, I undeerstood

[sage-support] Re: Print huge matrix - notebook: WARNING: Output truncated!

2011-05-10 Thread kcrisman
sage: M = matrix(50) sage: sage: M 50 x 50 dense matrix over Integer Ring (type 'print M.str()' to see all of the entries) sage: M.str() all the entries This answers you immediately preceding question. But I don't think that will look nice in the html. latex(M) gives what you are looking for,

[sage-support] Re: efficient way to convert str to rational

2011-05-10 Thread Simon King
PS On 10 Mai, 20:06, Simon King simon.k...@uni-jena.de wrote:   sage: [QQ(sage_eval(s)) for s in list(R)[0]] That would also work on other number representations, such as 1.3E2: sage: QQ(sage_eval('1.3E2')) 130 Best regards, Simon -- To post to this group, send email to

[sage-support] Re: Print huge matrix - notebook: WARNING: Output truncated!

2011-05-10 Thread kcrisman
This is now http://trac.sagemath.org/sage_trac/ticket/11322. On May 10, 2:08 pm, kcrisman kcris...@gmail.com wrote: sage: M = matrix(50) sage: sage: M 50 x 50 dense matrix over Integer Ring (type 'print M.str()' to see all of the entries) sage: M.str() all the entries This answers you

[sage-support] Re: degree of poly

2011-05-10 Thread Sebastian Ramacher
On 05/10/2011 07:59 PM, MathLynx wrote: How do I detect the degree of a polynomial (say over Q) in one or several variables? x = var('x'); B = x^2; B.deg() gives an error. How about x,y = var('x , y'); B = x^2 + y^3; and we want degree of B with respect to x? (presuming wrt y is

[sage-support] Re: degree of poly

2011-05-10 Thread MathLynx
Is it safe to say that R = PolynomialRing(QQ, 'X,Y') defines a ring over Q in two variables, in which x,y = R.gens() sets x y to be the generators? If this is so, then what exactly is the role of 'X,Y' ? Just to list the number of generators or what? Could we just as well have said R =

[sage-support] Re: degree of poly

2011-05-10 Thread Sebastian Ramacher
On 05/10/2011 08:40 PM, MathLynx wrote: Is it safe to say that R = PolynomialRing(QQ, 'X,Y') defines a ring over Q in two variables, in which Yes. To be precise: R is the polynomial ring on X and Y over Q. x,y = R.gens() sets x y to be the generators? Yes If this is so, then

Re: [sage-support] Re: degree of poly

2011-05-10 Thread Robert Bradshaw
On Tue, May 10, 2011 at 11:40 AM, MathLynx mathl...@gmail.com wrote: Is it safe to say that R = PolynomialRing(QQ, 'X,Y') defines a ring over  Q  in two variables, in which x,y = R.gens() sets x y to be the generators?  If this is so, then what exactly is the role of 'X,Y' ?  Just to

[sage-support] Re: Print huge matrix - notebook: WARNING: Output truncated!

2011-05-10 Thread John H Palmieri
On Tuesday, May 10, 2011 8:26:42 AM UTC-7, Jakob Lombacher wrote: Hi, I've got a ugly matrix, that elements consists of huge symbolic expressions. When I try to print it via view(H) I get the message WARNING: Output truncated! full_output.txt By clicking on full_output.txt I get

[sage-support] Re: degree of poly

2011-05-10 Thread kcrisman
For another point of view, sage: var('y') y sage: f = x^2+y^3 sage: f.degree(x) 2 sage: f.degree(y) 3 which doesn't answer your question, but does raise another one: With respect to this, would it be worth implementing a deg() for SR which tries to get the degree over the polynomial ring of the

[sage-support] Re: efficient way to convert str to rational

2011-05-10 Thread tvn
sorry my question wasn't so clear -- but yes the main bottleneck is applying the conversion function from string to rational . Thanks for the sage_eval function -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to

[sage-support] Re: degree of poly

2011-05-10 Thread Simon King
Hi! On 10 Mai, 19:59, MathLynx mathl...@gmail.com wrote: How do I detect the degree of a polynomial (say over Q) in one or several variables? x = var('x'); B = x^2; B.deg() It is already implicit in the preceding replies to your question, but in fact B is *not* a polynomial, and it is

[sage-support] Re: how to structure conditional

2011-05-10 Thread Simon King
On 10 Mai, 19:57, MathLynx mathl...@gmail.com wrote: Too easy!  I'll start to make them harder as I learn... LOL Since the user language of Sage is Python (at least in a good approximation) and since Python is a nice language anyway, it might be a good idea to read Dive into Python or another

[sage-support] Root finding

2011-05-10 Thread Santanu Sarkar
If I want to find the roots of x^2-2 in reals, I use the following approach. R.x=RR[] f=x^2-2 f.roots() But, it gives the rational approximation. Is it possible to find the exact root (irrational form)? -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from

Re: [sage-support] Root finding

2011-05-10 Thread Robert Bradshaw
On Tue, May 10, 2011 at 10:02 PM, Santanu Sarkar sarkar.santanu@gmail.com wrote: If  I want to find the roots of x^2-2 in reals, I use the following approach. R.x=RR[] f=x^2-2 f.roots() But, it gives the rational approximation.  Is it possible to find the exact root (irrational form)?

Re: [sage-support] Re: efficient way to convert str to rational

2011-05-10 Thread Robert Bradshaw
On Tue, May 10, 2011 at 12:53 PM, tvn nguyenthanh...@gmail.com wrote: sorry my question wasn't so clear --  but yes the main bottleneck is applying the conversion function from string to rational .   Thanks for the sage_eval function If the sage_eval function is faster, then string - Rational