2020-03-14 02:51:06 -0500 received badge ● Famous Question (source) 2019-11-25 04:08:48 -0500 received badge ● Notable Question (source) 2019-11-25 04:08:48 -0500 received badge ● Popular Question (source) 2019-01-13 19:26:13 -0500 received badge ● Notable Question (source) 2019-01-13 19:26:13 -0500 received badge ● Popular Question (source) 2017-04-10 21:38:13 -0500 received badge ● Famous Question (source) 2017-03-16 04:27:46 -0500 received badge ● Popular Question (source) 2017-01-03 14:49:08 -0500 received badge ● Nice Question (source) 2016-12-02 14:31:02 -0500 commented answer 'object is not callable' error in sagetex (that doesn't occur in a worksheet) Yes, thank you! I think I may have imported random in the worksheet on a different occasion, but I didn't think about that since I thought cells were only executed when you run them. If I import a package in a worksheet, I wonder if it should linger through subsequent sessions? But, yes, that worked; thanks again. 2016-11-28 13:00:55 -0500 asked a question 'object is not callable' error in sagetex (that doesn't occur in a worksheet) I'm generating random numbers to be presented in scientific notation for a quiz I'm typing. In testing this code works fine in a worksheet, but gives an error in a sagesilent block of my .tex document. Here's the code: sci = {} for index in range(1, 14): # Picks random coeffs for sci not. places = ZZ.random_element(0, 4) sci["co{0}".format(index)] = round(10*random(), places) powe = {} for index in range(1, 14): # Picks random powers for use. powe["r{0}".format(index)] = ZZ.random_element(5, 10) sci['co1'] sci['co2'] powe['r1'] powe['r2']  In the worksheet, those last four lines generate output like 3.0 5.566 7 8  But when I use that same code in the .tex document (without the last four lines), Sage returns this error before I can even call my numbers: 'module' object is not callable  My best guess is that rounding needs some package that the worksheet imports automatically but sagetex does not, but I'm afraid I don't know enough about what's really going on. Thank you for any help! 2016-11-28 12:19:34 -0500 received badge ● Notable Question (source) 2016-11-28 12:19:34 -0500 received badge ● Popular Question (source) 2016-11-28 12:16:59 -0500 commented answer Getting the leading term from random polynomials Thanks very much, for that hint especially! 2016-11-24 09:24:30 -0500 received badge ● Nice Question (source) 2016-11-22 12:45:34 -0500 asked a question Getting the leading term from random polynomials Hi there. I'm writing self generating algebra tests for a class I teach. I'm using this code to generate random polynomials of various degrees up to 8 with single digit integer coefficients: R. = PolynomialRing(ZZ) po = {} for index in range(1, 10): # Picks random polynomials for use. deg = ZZ.random_element(0, 8) po["ly{0}".format(index)] = R.random_element(deg, -9, 10)  To make the answer key, I'm attempting to show the polynomial, its degree, its leading term, and its leading coefficient of each polynomial. My code for that looks like: po['ly1'] po['ly1'].degree(x) po['ly1'].lt(x) po['ly1'].lc(x)  Getting the degree works, but not the leading term or the leading coefficient. The errors I get are: AttributeError: 'sage.rings.polynomial.polynomial_integer_dense_flint.Polynomial_integer_dense_flint' object has no attribute 'lt'  and AttributeError: 'sage.rings.polynomial.polynomial_integer_dense_flint.Polynomial_integer_dense_flint' object has no attribute 'lc'  respectively. I have been unable to ascertain from the documentation what the correct commands should actually look like. I have tried both ".lt()" and ".lt(x)" and similar for .lc. Please let me know, if you can, what my error is. Thank you. 2016-10-14 14:50:12 -0500 received badge ● Famous Question (source) 2016-08-07 19:42:35 -0500 commented question Can I show ordered sets in order? A better solution I found is to just LaTeX the parts I want. This makes the answer key look like an answer the student should give. After converting the Set X to the list X, I then put the code below in the answer key. $\{\sage{X[0]}, \sage{X[1]},\sage{X[2]},... , \sage{X[len(X)-1]}\}$  I'm still curious about whether one can show sets in order, so for now I'll leave the question open. 2016-08-07 19:31:39 -0500 commented question Can I show ordered sets in order? A less than 100% satisfactory workaround is to convert the Set to a list, sort the list, then show the list. This works for me ok, but it defeats my purpose if I share an answer key with my students and the answer key has the wrong notation (namely the square brackets of lists instead of the curly braces of sets). 2016-08-07 19:13:27 -0500 asked a question Can I show ordered sets in order? I'm using SageTex to generate random algebra tests, with an answer key at the end. To have my students show they understand roster notation for sets, I'm having them write the set of all two-digit multiples of n for some number n in {2, 3, 4, ... 9}. Asking the question isn't hard. But in generating the answer key, the set shows up in random order. I know it's still the same set, of course, but it's less intuitive to interpret. It seems like Sage is going out of it's way to randomize the set. Here's some minimal working code: n = Set(range(2, 10)).random_element() X = Set() for i in range(10, 100): if i % n == 0: X = X.union(Set([i])) show(n) show(X)  This shows, for example: 8 {32, 64, 48, 40, 80, 96, 16, 24, 56, 72, 88} Is there some way to have Sage show the elements of the set in order? 2016-02-18 15:09:14 -0500 received badge ● Notable Question (source) 2016-02-18 15:09:14 -0500 received badge ● Popular Question (source) 2015-03-26 22:09:34 -0500 marked best answer axis_thickness ? I would like to like to increase the thickness of my axes on my plots. How might I do this? Background: I am a teacher who uses sage to make my own graph paper. The axes look good on paper (although I'd like to have arrows on them), but when I project the pdf onto my white board (to draw on) the axes don't look much thicker than the gridlines (I'm using greyed instead of dashed gridlines). Here's my code: k = 8 p = plot(k, (x, -k, k), thickness = 0, aspect_ratio = 1, gridlines = True, axes_labels=['$x$','$y$'], ticks=[[-k..k],[-k..k]], tick_formatter = [['$-8$', '', '$-6$', '', '$-4$', '', '$-2$', '', '', '', '$2$', '', '$4$', '', '$6$', '', '$8$'], ['$-8$', '', '$-6$', '', '$-4$', '', '$-2$', '', '', '', '$2$', '', '$4$', '', '$6$', '', '$8$']], gridlinesstyle = dict(color = "gray", linestyle = "-") ) p += plot(0, (x, -k, k), thickness = 0) #to establish graph width p += plot(-k, (x, -k, k), thickness = 0) #to establish graph height show(p) p.save('graph8l.pdf')  2014-12-10 13:22:46 -0500 asked a question LaTeX in plot not showing Greek letter Hello. I'm using the following code to generate an image of a triangle for a trigonometry quiz. p = polygon2d([[0,0], [0,3], [4,0]], fill = False, axes = False) p += text("$\theta$", (3, 0.2), fontsize = 22) show(p)  The issue is that Sage doesn't seem to recognise $\theta$ as LaTeX, even though it's in dollar signs. In the corner of the triangle, it puts "heta". Why isn't this typesetting correctly? How can I fix it? Thank you. 2014-11-28 13:12:13 -0500 commented answer How can I recover the command to generate an object already created randomly? The other answer helps me better, but I'm glad to know now how I might use the random seeds to my advantage. Thank you. 2014-11-28 13:11:21 -0500 commented answer How can I recover the command to generate an object already created randomly? The string was all I needed; "matrix(QQ,%s)"%B.rows()  is exactly what I was looking for. I'm glad to know what will do the trick now, but I don't completely understand it. Can you explain the %s and the %B.rows() notation, particularly the % part of it, or else point me to the documentation for it? Again it's proving difficult to search for. Thanks again, though; it's a big help... I was getting tired of copying the matrix and then filling in a bunch of commas by hand! 2014-11-27 19:00:04 -0500 asked a question How can I recover the command to generate an object already created randomly? I'm working in Sage side by side with a linear algebra test I'm writing in LaTeX (using sagetex). I'm generating random matrices until I find one I really like. Say I get this in Sage: B = random_matrix(ZZ, 3, 3, algorithm='echelonizable', rank=3, upper_bound=10); B [ 1 -2 1] [ 0 1 -2] [-1 -2 8]  Is there a way to get Sage to generate the command to generate this matrix nonrandomly, i.e, return the command B = matrix(QQ, [[1, -2 ,1], [0, 1, -2], [-1, -2, 8]])  so that I can copy and paste it into a sagesilent environment in my .tex file? I can't think of what I might search for in the Sage documentation for such a command so I must ask here. Many thanks. 2014-09-09 10:32:00 -0500 commented question Can I get a matrix to show with brackets instead of parentheses? I found some discussion of the matter [on google](https://groups.google.com/forum/#!topic/sage-support/pP_DjwoYUGs), but I don't think I'm savvy enough to edit latex.py, especially since a search of my computer shows 9 seperate files called latex.py. 2014-09-09 10:28:54 -0500 asked a question Can I get a matrix to show with brackets instead of parentheses? I'm using Sage and SageTeX to make worksheets and quizzes for my Linear Algebra course. I'd like my presentation to match the book's, and the book uses brackets around its matrices instead of parentheses. Is that doable? Is there a way, for example, to get latex(A) to generate \left[\begin{array}{rrr} 6 & 6 & 1 \\ 7 & 0 & 6 \\ 4 & -7 & -7 \end{array}\right]  instead of \left(\begin{array}{rrr} 6 & 6 & 1 \\ 7 & 0 & 6 \\ 4 & -7 & -7 \end{array}\right)  for some matrix A. 2014-09-09 09:22:23 -0500 received badge ● Supporter (source) 2014-09-09 09:22:12 -0500 commented answer "showing" both input and output I see. So it looks like untill the 'hold' command works on all (or almost all) input, I won't quite get what I want. Thank you for the effort. 2014-09-06 15:45:03 -0500 received badge ● Scholar (source) 2014-09-06 15:41:45 -0500 asked a question "showing" both input and output Is there a way to get Sage to show the "pretty" versions of both the input and the output of a calculation, instead of just the output? (sort of like the TI-89 and such) For example, when I enter as input "integrate(x^2, x, 0, 3)" it correctly returns 9. But can I get it to return something like (the typeset version of) \int_0^3 x^2 dx = 9 ? It's obvious enough in this example what I'm asking for but some queries get complicated and seeing them as they would be printed helps make sure I'm asking Sage for what I mean to ask for. 2014-08-14 15:44:23 -0500 commented answer axis_thickness ? Thank's a ton. I looked all through the 2D Plotting page and didn't think to look at Graphics objects. I should probably read through the documentation completely some time. I aim to continue my LaTeX/Sage integration as well. I haven't had a ton of success on my home or work setup. Maybe that tkz-fct package will help. Thanks again. (Edit: spelling) 2014-08-14 11:59:01 -0500 received badge ● Student (source)