[sage-support] Re: Problem with matrix
That worked perfectly! Thank guys. On Oct 29, 1:39 am, William Stein wrote: > On Wed, Oct 28, 2009 at 9:08 PM, Jo wrote: > > > Hi, > > > I need to replace some part of a matrix with an another matrix. I > > tried to use matrix.set_block, but I got an error. I tried few other > > alternative, but they returned all the same error: > > > "TypeError: unable to convert x (=sin(t1)) to an integer" > > > I made up a very simple example of a code that actually cause the > > error: > > > t1=var('t1'); > > m1=Matrix([[sin(t1)]]); > > m2=Matrix([[0]]); > > m2[0,0]=m1[0,0]; #error happen here. > > m2; > > > Can anyone tell me what i'm doing wrong? Or did I just ended up in a > > bug > > Try > > m2=Matrix(SR, [[0]]); > > Here SR = "symbolic ring". All entries of a matrix belong to the > same ring. Your m2 above has entries that are all integers, which is > the smallest ring that contains 0. > > 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 URL: http://www.sagemath.org -~--~~~~--~~--~--~---
Fwd: [sage-support] Jacobian Element over HyperElliptic Curves
-- Forwarded message -- From: Nick Alexander Date: Wed, Oct 28, 2009 at 10:56 PM Subject: Re: [sage-support] Jacobian Element over HyperElliptic Curves To: William Stein , Daniel Ribeiro > (x^2 + 23*x + 15, y + 18*x + 3) > > Which does not seem right, since D was supposed to be represented by > [x**2 + 23 *x +15, 13*x + 28], and > > sage: (18 *x + 3) == (13*x + 28) > False It seems that y + 18*x + 3 == y - (13*x + 28) over GF(31). So this is correct, you're just seeing a different convention -- we're making this a polynomial in F[y][x] that after you substitute in the correct x, you can solve for y. Nick -- William Stein Associate Professor of Mathematics University of Washington http://wstein.org --~--~-~--~~~---~--~~ 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: Problem with matrix
On Wed, Oct 28, 2009 at 9:08 PM, Jo wrote: > > Hi, > > I need to replace some part of a matrix with an another matrix. I > tried to use matrix.set_block, but I got an error. I tried few other > alternative, but they returned all the same error: > > "TypeError: unable to convert x (=sin(t1)) to an integer" > > I made up a very simple example of a code that actually cause the > error: > > t1=var('t1'); > m1=Matrix([[sin(t1)]]); > m2=Matrix([[0]]); > m2[0,0]=m1[0,0]; #error happen here. > m2; > > Can anyone tell me what i'm doing wrong? Or did I just ended up in a > bug > Try m2=Matrix(SR, [[0]]); Here SR = "symbolic ring". All entries of a matrix belong to the same ring. Your m2 above has entries that are all integers, which is the smallest ring that contains 0. 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 URL: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Problem with matrix
Hello, On Thu, Oct 29, 2009 at 11:08 AM, Jo wrote: > t1=var('t1'); > m1=Matrix([[sin(t1)]]); > m2=Matrix([[0]]); > m2[0,0]=m1[0,0]; #error happen here. > m2; The issue is that m2 is a matrix with integer entries. Since sin(t1) isn't an integer, you get a failure. When constructing the second matrix, you can explicitly say what type the entries are. See the following session: sage: t1=var('t1'); sage: m1=Matrix([[sin(t1)]]); sage: m2=Matrix([[0]]); sage: m1.parent() Full MatrixSpace of 1 by 1 dense matrices over Symbolic Ring sage: m2.parent() Full MatrixSpace of 1 by 1 dense matrices over Integer Ring sage: sin(t1) in ZZ False sage: m3 = Matrix(SR,[[0]]); sage: m3[0,0] = m1[0,0] sage: m3 [sin(t1)] --Mike --~--~-~--~~~---~--~~ 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] Problem with matrix
Hi, I need to replace some part of a matrix with an another matrix. I tried to use matrix.set_block, but I got an error. I tried few other alternative, but they returned all the same error: "TypeError: unable to convert x (=sin(t1)) to an integer" I made up a very simple example of a code that actually cause the error: t1=var('t1'); m1=Matrix([[sin(t1)]]); m2=Matrix([[0]]); m2[0,0]=m1[0,0]; #error happen here. m2; Can anyone tell me what i'm doing wrong? Or did I just ended up in a bug Jo --~--~-~--~~~---~--~~ 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] Jacobian Element over HyperElliptic Curves
Hi, I was doing some tests with the jacobian over HyperElliptic Curves, and I did not quite understand the output of __str__ method of the elements of such set. For instance: field = GF(2**5, 'a') a = field.gen() Px = PolynomialRing(field, 'x') x = Px.gen() f = x**5 + x**3 + 1 h = x**2 + x C = HyperellipticCurve(f, h) J = C.jacobian() dd = [x * (x + a **30), a * x + 1] D = J(dd) sage: D (x^2 + (a^4 + a)*x, y + a*x + 1) which is ok, since I asked for the element represented by [x * (x + a **30), a * x + 1], and sage: a**30 == a**4 + a True However, using another curve over another field: Px = PolynomialRing(GF(31), 'x') x = Px.gen() f = x**5 + 13*x**4 + 2*x**3 + 4*x**2 + 11*x + 1 C = HyperellipticCurve(f) J = C.jacobian() dd = [x**2 + 23 *x +15, 13*x + 28] D = J(dd) sage: D (x^2 + 23*x + 15, y + 18*x + 3) Which does not seem right, since D was supposed to be represented by [x**2 + 23 *x +15, 13*x + 28], and sage: (18 *x + 3) == (13*x + 28) False Am I missing something? Thanks, - Daniel --~--~-~--~~~---~--~~ 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: How to use a previous result in a current evaluation without copy/paste
On Wed, Oct 28, 2009 at 3:46 PM, Erik wrote: > > The first two solutions did what I intended. The 3rd one did not, but > I may have erred. > > Is the use of "_" documented anywhere? It is discussed in the Python tutorial pretty quickly: http://docs.python.org/tutorial/introduction.html It is a really good idea to read that, and we should probably encourage it more. > Does my difficulty finding it > suggest it should be described in either the tutorial or FAQ? I > suspect it is commonly used. > > Thanks everyone for your assistance. > > On Oct 28, 12:18 pm, Marshall Hampton wrote: >> Slightly different solution to generate and store the values: >> >> def f(x): >> return (1/5)*(x**3+x**2-3) >> answers = [f(0)] >> for i in range(5): >> answers.append(f(answers[-1])) >> >> ..and then answers will be a list of the first 6 iterated values. >> >> -Marshall Hampton >> >> On Oct 28, 8:55 am, Erik wrote: >> >> >> >> > I would like to iterate a function: >> >> > def f(x): >> > return( (1/5)*(x**3+x**2-3) ) >> > f(0) >> >> > Running evaluate on the above yields the quantity -3/5. Rather than >> > evaluating f(-3/5), is there a way to reference the previous output >> > from evaluate, i.e. to evaluate f(previous) or some similar syntax? >> > Similarly, is there a way to use the syntax "for i in range()" to >> > define the next i as f(i)? I know that "for i in range(-2,2,i=f(i))" >> > does not work. I've briefly searched the tutorial, this Google group, >> > and Google generally without finding solutions. However, today is my >> > first day using Sage. >> >> > I'm running Sage 4.1.2 pre-compiled 32 bit binary for Debian Lenny. >> >> > Thanks. > > > -- William Stein Associate Professor of Mathematics University of Washington http://wstein.org --~--~-~--~~~---~--~~ 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: How to use a previous result in a current evaluation without copy/paste
The first two solutions did what I intended. The 3rd one did not, but I may have erred. Is the use of "_" documented anywhere? Does my difficulty finding it suggest it should be described in either the tutorial or FAQ? I suspect it is commonly used. Thanks everyone for your assistance. On Oct 28, 12:18 pm, Marshall Hampton wrote: > Slightly different solution to generate and store the values: > > def f(x): > return (1/5)*(x**3+x**2-3) > answers = [f(0)] > for i in range(5): > answers.append(f(answers[-1])) > > ..and then answers will be a list of the first 6 iterated values. > > -Marshall Hampton > > On Oct 28, 8:55 am, Erik wrote: > > > > > I would like to iterate a function: > > > def f(x): > > return( (1/5)*(x**3+x**2-3) ) > > f(0) > > > Running evaluate on the above yields the quantity -3/5. Rather than > > evaluating f(-3/5), is there a way to reference the previous output > > from evaluate, i.e. to evaluate f(previous) or some similar syntax? > > Similarly, is there a way to use the syntax "for i in range()" to > > define the next i as f(i)? I know that "for i in range(-2,2,i=f(i))" > > does not work. I've briefly searched the tutorial, this Google group, > > and Google generally without finding solutions. However, today is my > > first day using Sage. > > > I'm running Sage 4.1.2 pre-compiled 32 bit binary for Debian Lenny. > > > 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 URL: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: sorry for the little issue
Done On Wed, Oct 28, 2009 at 2:26 PM, Afonso Henriques Slva Leite wrote: > > But I can't unsubscribe using the email provided in the messages! Please > unsubscribe me! > > > > > --~--~-~--~~~---~--~~ 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: Workaround or way to avoid notebook TinyMCE bug of shuffling/deleting text?
On Wed, Oct 28, 2009 at 11:31 AM, Chris Seberino wrote: > > On Oct 27, 1:44 pm, William Stein wrote: >> (3) install the posted binary, then type the following in SAGE_ROOT >> >> rm spkg/installed/mpir* spkg/installed/atlas*; make > > Beautiful! It worked. You seemed to have known that this was the > cause of "Illegal Instruction" errors. It's now under "Other Questions" in the FAQ: http://wiki.sagemath.org/faq#Otherquestions > Would it be a good idea to make the binary automatically detect a > problem with these 2 packages and print instructions like what you > provided in this email? Yes. It would be even better to just fix the root cause of the problem. Why nobody (including me) has done so already is completely baffling to me. -- 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 URL: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Workaround or way to avoid notebook TinyMCE bug of shuffling/deleting text?
On Oct 27, 1:44 pm, William Stein wrote: > (3) install the posted binary, then type the following in SAGE_ROOT > > rm spkg/installed/mpir* spkg/installed/atlas*; make Beautiful! It worked. You seemed to have known that this was the cause of "Illegal Instruction" errors. Would it be a good idea to make the binary automatically detect a problem with these 2 packages and print instructions like what you provided in this email? Thanks! cs --~--~-~--~~~---~--~~ 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] sorry for the little issue
But I can't unsubscribe using the email provided in the messages! Please unsubscribe me! --~--~-~--~~~---~--~~ 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: Sage 4.2 restart worksheet does not work
Ichnich wrote: > Hi, > > yesterday I installed the notebook 0.4 and since that I could not do > "Restart worksheet" in the "Action..." menu of the notebook. It just > remains in the "Restart worksheet" position. > This was with 4.1.2, but after installing 4.2, this hasn't changed. > Can anyone confirm? > Or do I have to do something else with the newer notebook to restart? > Is there a command to restart from the cell? > I'm using sage 4.2 ubuntu 9.04 64 bit version. I'm posting up details of what just happened to me, culminating in exactly what you describe. I'm posting it to the sage-notebook mailing list. The short version is that I saw an error in the Firebug console: D is null cell_set_not_evaluated()main.js (line 831) set_all_cells_to_be_not_evaluated()main.js (line 1243) restart_sage()main.js (line 1244) eval()4 (line 1) go_option()main.js (line 436) function onchange(event) { go_option(this); }(change )3 (line 2) (831 out of range 2) (see my forthcoming post to sage-devel for more details). Jason --~--~-~--~~~---~--~~ 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: sage on a netbook
Christopher Olah wrote: > If you are going with Ubuntu, you may wish to know that 9.10 will be > released tomorrow. More importantly though: the version of sage in the > repository of the last release is pretty old... (3. something) I have > no clue if someone fixed that for 9.10. It's not fixed. It's still the old version, 3.0.4 or something. Downloading the newest version and installing by hand is strongly recommended. Jason --~--~-~--~~~---~--~~ 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] Sage 4.2 restart worksheet does not work
Hi, yesterday I installed the notebook 0.4 and since that I could not do "Restart worksheet" in the "Action..." menu of the notebook. It just remains in the "Restart worksheet" position. This was with 4.1.2, but after installing 4.2, this hasn't changed. Can anyone confirm? Or do I have to do something else with the newer notebook to restart? Is there a command to restart from the cell? I'm using sage 4.2 ubuntu 9.04 64 bit version. Thanks a lot, Stefan --~--~-~--~~~---~--~~ 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: sage on a netbook
If you are going with Ubuntu, you may wish to know that 9.10 will be released tomorrow. More importantly though: the version of sage in the repository of the last release is pretty old... (3. something) I have no clue if someone fixed that for 9.10. If you're comfortable downloading it and installing it by hand it doesn't matter, though. That's what I do. On Wed, Oct 28, 2009 at 12:44 PM, Daniel Harris wrote: > > > On Wed, Oct 28, 2009 at 2:28 PM, chu-ching huang > wrote: >> >> >> >> On Oct 28, 2:01 pm, Dan Drake wrote: >> >... >> > >> >> There are several sage modules, only for slax linux, made and put in >> the our site: >> >> http://diffusion.cgu.edu.tw/ftp/modules/python/ >> >> It can run on Asus EeePC and Acer Aspire one (tested). By the way, the >> iso-image file for Slax system with Python-2.6 and other CAS is also >> over there. The last sage is 4.2 with MayaVI/TVTK and Maxima-5.19.2 >> which is a little different from the official source. Therefore, I >> suggest to use image to run sage. >> > Thanks everybody for the reply > > slax is a new one on me and looks promising. I had initially thought about > going with ubuntu so this has thrown a bit of spanner in the works as slax > is definitely worth a look especially with all the extras. I guessan atom > n1.66 or z1.2 with 1gb ram should be responsive enough. > > Thanks > > Dan > >> >> chu-ching huang >> > > > > > -- Christopher Olah Email: christopherolah...@gmail.com --~--~-~--~~~---~--~~ 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: deprecation warnings related to matplotlibrc on sage 4.2
I think it's in home/sage/ - kcrisman On Oct 28, 1:06 pm, Stan Schymanski wrote: > Thanks, Jason! Where do I find it? It's not in home nor in > home/.matplotlib/. > > Stan > > > > Jason Grout wrote: > > Stan Schymanski wrote: > > >> Dear all, > > >> I noticed a lot of deprecation warnings related to matplotlibrc in the > >> terminal after running notebook() on sage 4.2 (see below). Are they a > >> reason to be concerned? > > > If you have never touched your matplotlibrc, then it would be okay to > > delete it. By default, Sage uses the matplotlib defaults. The errors > > are from an old matplotlibrc which has deprecated options in it. > > > Thanks, > > > Jason --~--~-~--~~~---~--~~ 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: deprecation warnings related to matplotlibrc on sage 4.2
Thanks, Jason! Where do I find it? It's not in home nor in home/.matplotlib/. Stan Jason Grout wrote: > Stan Schymanski wrote: > >> Dear all, >> >> I noticed a lot of deprecation warnings related to matplotlibrc in the >> terminal after running notebook() on sage 4.2 (see below). Are they a >> reason to be concerned? >> >> > > If you have never touched your matplotlibrc, then it would be okay to > delete it. By default, Sage uses the matplotlib defaults. The errors > are from an old matplotlibrc which has deprecated options in it. > > Thanks, > > Jason > > > > > > > --~--~-~--~~~---~--~~ 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: deprecation warnings related to matplotlibrc on sage 4.2
Stan Schymanski wrote: > Dear all, > > I noticed a lot of deprecation warnings related to matplotlibrc in the > terminal after running notebook() on sage 4.2 (see below). Are they a > reason to be concerned? > If you have never touched your matplotlibrc, then it would be okay to delete it. By default, Sage uses the matplotlib defaults. The errors are from an old matplotlibrc which has deprecated options in it. Thanks, Jason --~--~-~--~~~---~--~~ 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: import and global namespace
On Wed, Oct 28, 2009 at 5:16 AM, zeliboba wrote: > > dear all > > in documentation for var() it is stated "variables ... automatically > injected into the global namespace". I'd like to define variable in > module and then use it from several scripts, but variable is not > exported actually. my prog.sage looks like: > > from mod import * > createVar('A') Do: A = var('A') > f = A^2 > print f > > and module mod.py : > > from sage.all import * > def createVar(s): > return var(s) > > it gives: > > $ sage prog.sage > Traceback (most recent call last): > File "prog.py", line 7, in > f = A**_sage_const_2 > NameError: name 'A' is not defined > > A is definitely not in global namespace. it only works correctly if I > change > from mod import * > to > attach mod.py > > is it intended behavior? > > > > -- William Stein Associate Professor of Mathematics University of Washington http://wstein.org --~--~-~--~~~---~--~~ 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: sage on a netbook
On Wed, Oct 28, 2009 at 2:28 PM, chu-ching huang wrote: > > > > On Oct 28, 2:01 pm, Dan Drake wrote: > >... > > > > There are several sage modules, only for slax linux, made and put in > the our site: > > http://diffusion.cgu.edu.tw/ftp/modules/python/ > > It can run on Asus EeePC and Acer Aspire one (tested). By the way, the > iso-image file for Slax system with Python-2.6 and other CAS is also > over there. The last sage is 4.2 with MayaVI/TVTK and Maxima-5.19.2 > which is a little different from the official source. Therefore, I > suggest to use image to run sage. > > Thanks everybody for the reply slax is a new one on me and looks promising. I had initially thought about going with ubuntu so this has thrown a bit of spanner in the works as slax is definitely worth a look especially with all the extras. I guessan atom n1.66 or z1.2 with 1gb ram should be responsive enough. Thanks Dan > chu-ching huang > > > --~--~-~--~~~---~--~~ 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: GIS, Sage and shp
ellian wrote: > Can anyone point me at GIS resources for sage? I am particularly > interested in finding replacements for matlab's > > shaperead() and shapewrite() > > functions to read and write *.shp files. The thing to do is look for python GIS packages. A quick google search for "GIS python" and some clicking around turns up a few interesting pages: http://gispython.org/ http://www.gis.usu.edu/~jlowry/python/ http://invisibleroads.com/tutorials/ (this looks very useful to you, particularly http://invisibleroads.com/tutorials/gdal-shapefile-points-load.html; the video looks like it does not apply to the page, though! The video shows how to make a call through skype totally in python, even having python controlling a text-to-speech interface to navigate through a 411 voice menu.) You can install any python module into Sage just by following the directions for installation after typing "sage -sh" (which sets up the sage environment so things get installed into Sage). Thanks, Jason --~--~-~--~~~---~--~~ 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: How to use a previous result in a current evaluation without copy/paste
Slightly different solution to generate and store the values: def f(x): return (1/5)*(x**3+x**2-3) answers = [f(0)] for i in range(5): answers.append(f(answers[-1])) ..and then answers will be a list of the first 6 iterated values. -Marshall Hampton On Oct 28, 8:55 am, Erik wrote: > I would like to iterate a function: > > def f(x): > return( (1/5)*(x**3+x**2-3) ) > f(0) > > Running evaluate on the above yields the quantity -3/5. Rather than > evaluating f(-3/5), is there a way to reference the previous output > from evaluate, i.e. to evaluate f(previous) or some similar syntax? > Similarly, is there a way to use the syntax "for i in range()" to > define the next i as f(i)? I know that "for i in range(-2,2,i=f(i))" > does not work. I've briefly searched the tutorial, this Google group, > and Google generally without finding solutions. However, today is my > first day using Sage. > > I'm running Sage 4.1.2 pre-compiled 32 bit binary for Debian Lenny. > > 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 URL: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: maxima's '
Simon, The reason I don't like \over is because I am using Asciimath for the pretty print output on my servers. I couldn't get sMath to work. When I use SR on an integral it calculates the integral. I do have a Python book and have read it. It is too bad Sage doesn't have a hold function. It doesn't look like what I want is doable. Thanks for your help (William and Simon). On Oct 28, 3:05 am, Simon King wrote: > Mikie, > > On 28 Okt., 08:36, Simon King wrote: > > > On 27 Okt., 23:48, Mikie wrote: > > > > I have it kind of working. When I do the latex on the integral or > > > answer if their is fraction I get an \over. I get to get \frac{?} > > > {?}. Is there anyway to do this? > > > Did you read the post to which you answered? > > Or perhaps I did not properly read (but honestly, I find it often > enough very difficult to understand what your real concern is). Sorry. > > Say, you came as far as in my example session > sage: x=sage.calculus.calculus.maxima('x') > sage: f = getattr(x,"'integrate")(x) > sage: g = SR(f) > sage: latex(f) > \int {x}{\;dx} > sage: latex(g) > \int x\,{d x} > > Do I understand correctly that one of these latex typesettings for the > integral suites you? > > As you see, MaximaElement (the type of f) has a different latex > typesetting than Expression (the type of g). > > Let's evaluate the integral: > sage: r = sage_eval(str(g),globals()) > sage: type(r) > > This is because of the above re-definition of x as a MaximaElement in > the global namespace. > > And again, there are different typesettings available for different > data types: > > sage: latex(r) > {{x^2}\over{2}} > > I understand that you don't like it. So, why not try this: > sage: latex(SR(r)) > \frac{1}{2} \, x^{2} > > Cheers, > Simon --~--~-~--~~~---~--~~ 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: How to use a previous result in a current evaluation without copy/paste
Hi Erik, On Thu, Oct 29, 2009 at 1:55 AM, Erik wrote: > > I would like to iterate a function: > > def f(x): >return( (1/5)*(x**3+x**2-3) ) > f(0) > > Running evaluate on the above yields the quantity -3/5. Rather than > evaluating f(-3/5), is there a way to reference the previous output > from evaluate, i.e. to evaluate f(previous) or some similar syntax? Is the following what you want to do? {{{ [mv...@sage ~]$ sage -- | Sage Version 4.2, Release Date: 2009-10-24 | | Type notebook() for the GUI, and license() for information.| -- sage: def f(x): : return( (1/5) * (x**3 + x**2 - 3) ) : sage: f(0) -3/5 sage: f(_) -357/625 sage: f(_) -698265543/1220703125 sage: f(_) -5202240827516755391321839257/9094947017729282379150390625 sage: f(_) -2151599640664253715605723175336621357676825636894981382634097915842012994460122338843/376158192263132002549995691986169019729781670680068828005460090935230255126953125 }}} Notice that the underscore symbol "_" accesses the result of the immediately previous computation. -- Regards Minh Van Nguyen --~--~-~--~~~---~--~~ 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: How to use a previous result in a current evaluation without copy/paste
Hello, On Wed, Oct 28, 2009 at 9:55 PM, Erik wrote: > > I would like to iterate a function: > > def f(x): > return( (1/5)*(x**3+x**2-3) ) > f(0) > > Running evaluate on the above yields the quantity -3/5. Rather than > evaluating f(-3/5), is there a way to reference the previous output > from evaluate, i.e. to evaluate f(previous) or some similar syntax? On the Sage command line, the previous result is stored in _. So, you can do f(_). > Similarly, is there a way to use the syntax "for i in range()" to > define the next i as f(i)? I know that "for i in range(-2,2,i=f(i))" I'm not exactly sure what you want, but here's my best guess. You could use a while loop. i = -2 while i < 2: do_something() i = f(i) --Mike --~--~-~--~~~---~--~~ 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: sage on a netbook
I have a windows XP dell mini at work and sage runs fine as a vmware application. The 3d plotting is a bit slow though. I'll try out the new virtualbox image when I get a chance. On Wed, Oct 28, 2009 at 9:11 AM, Daniel Harris wrote: > Hello > > I have just bought some ou maths courses on ebay that recommend mathcad but > I am going to try to complete them using sagemath. At the moment I have > sage installed on my main pc and it runs great, but I would also like to use > sage on a netbook, so is anybody using it successfully on a netbook and if > so what requirements are needed for decent performance. > > Thanks in Advance > > Dan > > > > --~--~-~--~~~---~--~~ 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] How to use a previous result in a current evaluation without copy/paste
I would like to iterate a function: def f(x): return( (1/5)*(x**3+x**2-3) ) f(0) Running evaluate on the above yields the quantity -3/5. Rather than evaluating f(-3/5), is there a way to reference the previous output from evaluate, i.e. to evaluate f(previous) or some similar syntax? Similarly, is there a way to use the syntax "for i in range()" to define the next i as f(i)? I know that "for i in range(-2,2,i=f(i))" does not work. I've briefly searched the tutorial, this Google group, and Google generally without finding solutions. However, today is my first day using Sage. I'm running Sage 4.1.2 pre-compiled 32 bit binary for Debian Lenny. 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 URL: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] GIS, Sage and shp
Can anyone point me at GIS resources for sage? I am particularly interested in finding replacements for matlab's shaperead() and shapewrite() functions to read and write *.shp files. --~--~-~--~~~---~--~~ 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: [david.r.guich...@gmail.com: Re: sage server]
Do I need one entry in the server pool for each simultaneous connection? Eventually I'll need perhaps 20 simultaneous sessions. -- David --~--~-~--~~~---~--~~ 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: sage on a netbook
On Oct 28, 2:01 pm, Dan Drake wrote: >... > There are several sage modules, only for slax linux, made and put in the our site: http://diffusion.cgu.edu.tw/ftp/modules/python/ It can run on Asus EeePC and Acer Aspire one (tested). By the way, the iso-image file for Slax system with Python-2.6 and other CAS is also over there. The last sage is 4.2 with MayaVI/TVTK and Maxima-5.19.2 which is a little different from the official source. Therefore, I suggest to use image to run sage. chu-ching huang --~--~-~--~~~---~--~~ 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] deprecation warnings related to matplotlibrc on sage 4.2
Dear all, I noticed a lot of deprecation warnings related to matplotlibrc in the terminal after running notebook() on sage 4.2 (see below). Are they a reason to be concerned? Cheers, Stan /Users/sschym/Downloads/Free/sage-4.2/local/lib/python2.6/site- packages/twisted/persisted/sob.py:12: DeprecationWarning: the md5 module is deprecated; use hashlib instead import os, md5, sys /Users/sschym/Downloads/Free/sage-4.2/local/lib/python2.6/site- packages/matplotlib/__init__.py:681: UserWarning: legend.labelsep is deprecated. Update your matplotlibrc to use legend.labelspacing instead. warnings.warn('%s is deprecated. Update your matplotlibrc to use %s instead.'% (key, _deprecated_ignore_map[key])) /Users/sschym/Downloads/Free/sage-4.2/local/lib/python2.6/site- packages/matplotlib/__init__.py:681: UserWarning: legend.pad is deprecated. Update your matplotlibrc to use legend.borderpad instead. and so on... --~--~-~--~~~---~--~~ 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: [david.r.guich...@gmail.com: Re: sage server]
Things are looking up here. I think I'm having some firewall issues with high port numbers. Is there any way to allow sage to open port 443 without running as root? This would be easier than trying to get the computer center to open up a new port campus-wide. If I run the server in the background, is there a way to kill the server cleanly with "kill"? Really I'd like an init.d start/stop script. John--once I've got this worked out I'll try to write something up. Thanks, David --~--~-~--~~~---~--~~ 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: sage on a netbook
On Wed, 28 Oct 2009 at 01:11PM +, Daniel Harris wrote: > I have just bought some ou maths courses on ebay that recommend > mathcad but I am going to try to complete them using sagemath. At the > moment I have sage installed on my main pc and it runs great, but I > would also like to use sage on a netbook, so is anybody using it > successfully on a netbook and if so what requirements are needed for > decent performance. If I had a netbook, I would try to take the "net" part seriously and just use Sage via the web-based notebook interface, or over ssh. If you want to install Sage on the machine, it shouldn't be difficult; look for the "netbook-atom" binaries: http://sagemath.org/mirror/metalinks.html (Those binaries are for Linux, so if you are using Windows, you will pretty much be stuck with using the notebook over the web; I suspect that virtualization software works poorly on netbooks.) Dan -- --- Dan Drake - http://mathsci.kaist.ac.kr/~drake --- signature.asc Description: Digital signature
[sage-support] sage on a netbook
Hello I have just bought some ou maths courses on ebay that recommend mathcad but I am going to try to complete them using sagemath. At the moment I have sage installed on my main pc and it runs great, but I would also like to use sage on a netbook, so is anybody using it successfully on a netbook and if so what requirements are needed for decent performance. Thanks in Advance Dan --~--~-~--~~~---~--~~ 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] import and global namespace
dear all in documentation for var() it is stated "variables ... automatically injected into the global namespace". I'd like to define variable in module and then use it from several scripts, but variable is not exported actually. my prog.sage looks like: from mod import * createVar('A') f = A^2 print f and module mod.py : from sage.all import * def createVar(s): return var(s) it gives: $ sage prog.sage Traceback (most recent call last): File "prog.py", line 7, in f = A**_sage_const_2 NameError: name 'A' is not defined A is definitely not in global namespace. it only works correctly if I change from mod import * to attach mod.py is it intended behavior? --~--~-~--~~~---~--~~ 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: The resource /javascript/tiny_mce/plugins/table/table.htm cannot be found
Yes, that resolved the issue. Thanks. On Oct 27, 6:18 am, Tim Joseph Dumol wrote: > Things are working fine for me here -- can you try upgrading your sagenb > package by doing the following? > > {{{ > $ sage > -fhttp://sage.math.washington.edu/home/wstein/patches/sagenb/sagenb-0.4... > > }}} > > - Tim Joseph Dumol > > On Tue, Oct 27, 2009 at 6:18 PM, noillagr wrote: > > > When I attempt to add a new table to an html cell in sage (by clicking > > on the 'Insert a new table' toolbar icon), I get a new web page with > > the following error: > > > Not Found > > The resource /javascript/tiny_mce/plugins/table/table.htm cannot be > > found. > > > I believe this is associated with the recent upgrade to sage 4.1.2. > > Prior to the upgrade I was able to insert tables in sage html cells as > > expected. > > > I'm running the 'sage-mathematics-bin 4.1.2-2' package from the 'aur' > > repository on ArchLinux 2.6.31. > > > Any assistance would be appreciated. --~--~-~--~~~---~--~~ 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: [david.r.guich...@gmail.com: Re: sage server]
When you have got this working please could you post somewhere *exactly* what you needed to do? You are doing lots of things which I have never seen before in any of the notebook server documentation. As I have never yet managed to start a notebook server on one machine on campus and connect to it from off campus, I suspect that you are doing some of the things which I should have been doing. John Cremona On Oct 28, 4:16 am, Mike Hansen wrote: > On Wed, Oct 28, 2009 at 11:10 AM, David wrote: > > > I'm getting the picture now I think. I need a user to run the notebook > > server, preferably not root. Then I create ssh keys for that user with > > no passphrase. Then I create authorized_keys files for all the nb? > > users. Start the server as the server-user, and I should be good? > > Yep, that sounds right. > > --Mike --~--~-~--~~~---~--~~ 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: nearest integral vector with LLL
Adam, If I understand correctly you question is not at all about "lattices over number fields", which would be O_K-modules, but rather about the Z-lattices associated to certain abojects in a number field such as the ring of integers (or more generally a fractional ideal, perhaps). I suggest that you look at the code in sage/rings/number_field/ number_field.py for the function K.reduced_basis(), where K is a number field. In that function the lattice you want (the image of the ring of integers under the standard embedding into Euclidean space via all its real and complex embeddings) is contructed, and an LLL-reduced basis is found. You function would work in a similar way; it should not be hard to write. In fact what you need is very similar to the function coordinates(), which I wrote, which works like this: sage: K. = NumberField(x^3-2) sage: OK = K.ring_of_integers() sage: b = (1-10*a+20*a^2)/7 sage: OK.coordinates(b) (1/7, -10/7, 20/7) sage: [c.round() for c in OK.coordinates(b)] [0, -1, 3] sage: OK([c.round() for c in OK.coordinates(b)]) 3*a^2 - a except that you need to make sure that the integral basis being used is the one returned by K.reduced_basis() (which in this example is the same). I think that this thread would belong better on sage-nt. John Cremona On Oct 27, 1:17 pm, adam mohamed wrote: > I would like an exact result, and the lattice I am dealing with is just the > ring of integers. Say for an element in my field, I would like to have a > nearest integer with respect to the usual complex norm or the norm map. Is > that possible in sage? > > Regards, > > On Tue, Oct 27, 2009 at 10:37 AM, domingo.domingogo...@gmail.com < > > > > domingo.domingogo...@gmail.com> wrote: > > > Hi Adam, > > What do you need, the exact result or just an approximation is > > sufficient? > > NTL has a function to search for the nearest vector, however, it > > applies only to > > full-rank lattices. > > Best Regards, > > Domingo > > > On Oct 26, 7:39 pm, adam mohamed wrote: > > > Hi All, > > > > I would like to know if the search for the nearest vector using LLL in > > a > > > lattice over a number field is implemented in Sage. The documentation > > does > > > not say anything about that, unfortunately. Thanks. > > > > Regards, > > > > -- > > > adam > > -- > adam --~--~-~--~~~---~--~~ 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: maxima's '
Mikie, On 28 Okt., 08:36, Simon King wrote: > On 27 Okt., 23:48, Mikie wrote: > > > I have it kind of working. When I do the latex on the integral or > > answer if their is fraction I get an \over. I get to get \frac{?} > > {?}. Is there anyway to do this? > > Did you read the post to which you answered? Or perhaps I did not properly read (but honestly, I find it often enough very difficult to understand what your real concern is). Sorry. Say, you came as far as in my example session sage: x=sage.calculus.calculus.maxima('x') sage: f = getattr(x,"'integrate")(x) sage: g = SR(f) sage: latex(f) \int {x}{\;dx} sage: latex(g) \int x\,{d x} Do I understand correctly that one of these latex typesettings for the integral suites you? As you see, MaximaElement (the type of f) has a different latex typesetting than Expression (the type of g). Let's evaluate the integral: sage: r = sage_eval(str(g),globals()) sage: type(r) This is because of the above re-definition of x as a MaximaElement in the global namespace. And again, there are different typesettings available for different data types: sage: latex(r) {{x^2}\over{2}} I understand that you don't like it. So, why not try this: sage: latex(SR(r)) \frac{1}{2} \, x^{2} Cheers, Simon --~--~-~--~~~---~--~~ 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: nearest integral vector with LLL
How are represented the elements of your field? a_1\alpha_1+.+a_n\alpha_n, where a_1,...,a_n are integers and \alpha_1,, \alpha_n are complex numbers? or using floating point? Best Regards, Domingo On Oct 27, 2:17 pm, adam mohamed wrote: > I would like an exact result, and the lattice I am dealing with is just the > ring of integers. Say for an element in my field, I would like to have a > nearest integer with respect to the usual complex norm or the norm map. Is > that possible in sage? > > Regards, > > On Tue, Oct 27, 2009 at 10:37 AM, domingo.domingogo...@gmail.com < > > > > domingo.domingogo...@gmail.com> wrote: > > > Hi Adam, > > What do you need, the exact result or just an approximation is > > sufficient? > > NTL has a function to search for the nearest vector, however, it > > applies only to > > full-rank lattices. > > Best Regards, > > Domingo > > > On Oct 26, 7:39 pm, adam mohamed wrote: > > > Hi All, > > > > I would like to know if the search for the nearest vector using LLL in > > a > > > lattice over a number field is implemented in Sage. The documentation > > does > > > not say anything about that, unfortunately. Thanks. > > > > Regards, > > > > -- > > > adam > > -- > adam --~--~-~--~~~---~--~~ 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: maxima's '
On 27 Okt., 23:48, Mikie wrote: > I have it kind of working. When I do the latex on the integral or > answer if their is fraction I get an \over. I get to get \frac{?} > {?}. Is there anyway to do this? Did you read the post to which you answered? Here is the relevant part, again: > On Oct 27, 4:33 pm, Simon King wrote: > > > On 27 Okt., 23:19, Mikie wrote: > > > > ... {{x^2}\over{2}} no integral. > > > I am using Sage V3.4. Could this be causing the problem? > > > Probably. The whole "symbolics" stuff has changed since then. A > > complete session with version 4.2: > > ... So, in one word: Upgrade. > I also need this to work in > function in a Python script. I hope you read some chapters in a Python book (e.g., about "import"), before you try. --~--~-~--~~~---~--~~ 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: Hpfem status.........
Thanks..Minh Van Nguyen On Wed, Oct 28, 2009 at 12:45 PM, Minh Nguyen wrote: > > Hi Ajay, > > On Wed, Oct 28, 2009 at 5:41 PM, Ajay Rawat > wrote: > > Does any body knows the status of FemHub. It seems to be a nice concept. > > FemHub is a separate project from Sage. Please direct all questions > regarding FemHub to its mailing list. I have CC'd this email to that > list. > > -- > Regards > Minh Van Nguyen > > > > -- Ajay Rawat Kalpakkam, IGCAR - Save Himalayas - --~--~-~--~~~---~--~~ 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: Hpfem status.........
Hi Ajay, On Wed, Oct 28, 2009 at 5:41 PM, Ajay Rawat wrote: > Does any body knows the status of FemHub. It seems to be a nice concept. FemHub is a separate project from Sage. Please direct all questions regarding FemHub to its mailing list. I have CC'd this email to that list. -- Regards Minh Van Nguyen --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---