Ask Your Question

jdc's profile - activity

2018-03-11 03:35:10 -0600 received badge  Notable Question (source)
2017-12-07 10:35:47 -0600 received badge  Famous Question (source)
2017-08-03 21:45:12 -0600 received badge  Famous Question (source)
2017-02-14 04:28:37 -0600 received badge  Good Answer (source)
2016-04-18 21:18:37 -0600 received badge  Popular Question (source)
2015-01-14 05:15:12 -0600 received badge  Famous Question (source)
2014-10-22 04:39:49 -0600 received badge  Notable Question (source)
2014-05-01 10:59:31 -0600 received badge  Notable Question (source)
2013-06-26 06:43:14 -0600 received badge  Popular Question (source)
2013-06-18 20:21:24 -0600 received badge  Notable Question (source)
2013-06-18 20:21:24 -0600 received badge  Notable Question (source)
2013-01-30 09:24:51 -0600 received badge  Popular Question (source)
2013-01-28 01:30:11 -0600 received badge  Nice Question (source)
2013-01-11 00:40:41 -0600 received badge  Popular Question (source)
2012-05-02 10:08:13 -0600 received badge  Enthusiast
2012-04-24 05:46:51 -0600 marked best answer Strange error with multivariate polynomials

This is now Trac #12871

2012-04-24 05:46:48 -0600 commented answer Strange error with multivariate polynomials

Thanks for opening a ticket, Volker. By the way, I managed to get at the resultants I need by using "pari('polresultant(...))",

2012-04-23 03:33:16 -0600 asked a question Strange error with multivariate polynomials

Hi -

I'm trying to calculate the resultant (with respect to one variable, say x) of a pair of 2-variable polynomials. Following some advice I found in this trac ticket, I tried entering something like this:

R.<x,y> = RR[]
P = 4*x^3*y^2 + 7*x^5*y - 3*x*y^4
Q = 5*x^3*y^3 - 9*y^2
P.polynomial(x).resultant(Q.polynomial(x))

However, P.polynomial(x) returns the error:

ValueError: max() arg is an empty sequence

(Full error message pasted below.) Same problem with P.polynomial(y), etc. It seems to work okay if the coefficient ring is ZZ or QQ instead of RR.

Does anyone know why this is happening, or of a different workaround for calculating these resultants?

Thanks!

Full error message:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_28.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("Ui48eCx5PiA9IFJSW10KcCA9IHggKyB5CnEgPSB4KnkKcC5wb2x5bm9taWFsKHgpLnJlc3VsdGFudChxLnBvbHlub21pYWwoeCkp"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>

  File "/private/var/folders/5h/c6x89ch91fjgr43q99g8wbjw0000gn/T/tmpVUVLIc/___code___.py", line 5, in <module>
    exec compile(u'p.polynomial(x).resultant(q.polynomial(x))
  File "", line 1, in <module>

  File "multi_polynomial.pyx", line 452, in sage.rings.polynomial.multi_polynomial.MPolynomial.polynomial (sage/rings/polynomial/multi_polynomial.c:5376)
  File "parent.pyx", line 988, in sage.structure.parent.Parent.__call__ (sage/structure/parent.c:7355)
  File "coerce_maps.pyx", line 82, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (sage/structure/coerce_maps.c:3311)
  File "coerce_maps.pyx", line 77, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (sage/structure/coerce_maps.c:3214)
  File "/Applications/Sage-4.8-OSX-64bit-10.6.app/Contents/Resources/sage/local/lib/python2.6/site-packages/sage/rings/polynomial/polynomial_ring.py", line 407, in _element_constructor_
    return C(self, x, check, is_gen, construct=construct, **kwds)
  File "polynomial_real_mpfr_dense.pyx", line 87, in sage.rings.polynomial.polynomial_real_mpfr_dense.PolynomialRealDense.__init__ (sage/rings/polynomial/polynomial_real_mpfr_dense.c:3418)
ValueError: max() arg is an empty sequence
2012-04-06 03:21:58 -0600 commented question polynomials of derivative operator

I'm trying to understand exactly what you mean. Wouldn't your answer still (possibly) involve d/dx? For instance, wouldn't (d/dx + x^5)^2 = d^2/(d^2 x) + 5x^4 + x^5 d/dx + x^10? Or am I misunderstanding what you mean? Also, I don't understand the purpose of the "1" you put after p(x^2d/dx + a + x - x^2y). (Since you again put a 1 in a similar position in your comment to kcrisman's answer below, I assume it's not a typo.)

2012-03-29 16:10:59 -0600 commented question Backing into a problem

And as a math question, it seems like it could be incredibly difficult to find the optimal answer.

2012-03-29 09:11:01 -0600 marked best answer How to install patches? (Or should we?)

The developer manual has a walk through of the patch applying process. Essentially you can just use the Sage command

hg_sage.apply("http://trac.sagemath.org/sage_trac/raw-attachment/ticket/11329/f2c-20070816.p2-p3.diff")

but really you want to create a clone of the repository first if you want to get rid of the patch later.

2012-03-29 09:11:01 -0600 received badge  Scholar (source)
2012-03-29 08:34:17 -0600 commented answer How to install patches? (Or should we?)

Thanks, Niles. I think I'd better see if I actually am capable of applying a patch before I write instructions telling other people how to do it. But you guys probably will con me into contributing something sooner or later. :)

2012-03-29 06:17:12 -0600 commented answer How to install patches? (Or should we?)

The learning curve feels more like a vertical ascent sometimes. I've tried to read tickets at sage_trac a few times, but the discussion is opaque to me. Even the documentation seems to assume a level of familiarity and expertise that I don't have. But thank heaven for the nice folks at ASKSAGE.

2012-03-29 06:10:19 -0600 commented answer How to install patches? (Or should we?)

If a patch fixes a problem, what would be my motivation for wanting to get rid of it later? Is that just in case the patch turns out not to work, or gets improved later?

2012-03-29 06:09:02 -0600 commented answer How to install patches? (Or should we?)

Okay, that's helpful. It's interesting that the method for downloading patches is buried in the development manual, in a discussion of how to *review* patches, instead of in the main Sage tutorial or FAQ. Also, do I just want to be doing this with .patch files, or are spkg's also a type of patch?

2012-03-29 05:37:02 -0600 commented question Why can't I attach files?

Okay -- thanks! I wasn't able to make much sense of the discussion there. So, near the top of the page for that ticket, I see a long list of "Explicit instructions," as well as two files (a .spkg and a .patch). Are those instructions meant for folks like me, or just for developers working on the fixes? And I am meant to download both/either of those files, or is that done by those "explicit instructions"? I really feel out of my league whenever I look at sage_trac.

2012-03-29 05:27:33 -0600 asked a question How to install patches? (Or should we?)

Hi -

Hopefully this question is basic, but I haven't been able to find a clear answer online. (For the record, I am using the Sage notebook with the app version of Sage on a Mac.)

I consider myself a lowly and ignorant end user of Sage -- maybe one day I'll know enough to be able to contribute to development, but that day is not near. How do I (or should I, even) download and install patches, fixes and updates to Sage, short of doing a whole new installation from scratch?

More specifically: Suppose I encounter some bug or shortcoming with Sage, and I discover that there is already a ticket for that problem on the Sage developer trac. Suppose that that ticket is categorized as "fixed," and I see a link to some file (usually ending with .spkg, .patch, or .diff) near the top of the page. Is that file something that I, the lowly end user, am meant to download and install, hopefully fixing my problem? Or are those files on sage_trac really just meant for development work, and the fix will only trickle down to the end users once those fixes are incorporated into a future version of Sage?

If am I meant to be installing these patches myself, how exactly is that done? That is, where do I put the files, and what do I type where?

I feel like an idiot phrasing it in such basic terms. And I'm sure that the answers to my questions are already floating out there somewhere, but I haven't been able to find them. For example, the help stuff I've found out there for sage_trac is all about how to post or contribute to a trac ticket, rather than how to take advantage of the fixes found for that ticket.

2012-03-28 04:02:02 -0600 commented question Why can't I attach files?

Thanks for your response. I looked through the discussion on that trac, and no mention is made of the "attach" problem, so I'm not sure that the work done there addresses this problem. In the Google Groups discussion that I linked to, after William Stein mentions the problem, there's a short back and forth which seems to end when someone says that he can't replicate it.

2012-03-22 09:53:23 -0600 commented question Backing into a problem

I think you would need to make the problem much more specific before it could become tractable. What kinds of ingredients and operations are allowed on the right side? How do you measure efficiency? And even once you specify this, unless your rules are pretty restrictive, I'm afraid that it's the kind of problem for which there won't be a neat, clean answer. Sorry.

2012-03-22 09:48:05 -0600 asked a question Why can't I attach files?

Hi -

I recently installed Sage on my new Macbook (although I've used Sage before, on my old -- and sadly, recently stolen -- Macbook). I'm using the Sage notebook. (Details of my installation below.)

If I attach a file ("attach foo.sage"), it loads/runs the commands in that file, just like it's supposed to and used to. However, if I make any alteration to the attached file while the Sage notebook is still running, then when I return to the notebook and try to do anything, Sage freaks out.

By "freak out," I mean that if I try to do any computation, even one that doesn't involve the variables or functions in the attached file (e.g., "2+2"), I get a massive error message, which ends with "RuntimeError: maximum recursion depth exceeded in cmp". I've pasted more of the error message below. This behavior continues until I quit and restart that notebook. It seems that the contents of the attached file are irrelevant -- I've tried it with simple files that contain nothing but a single print command, or something basic like "a=5".

I did a little searching, and I turned up this discussion on the sage-notebook Google Group, where William Stein notes this behavior. So obviously somebody who knows something is aware of this. But that was all I could find anywhere, and I have no sense for whether there is a fix/workaround for this.

I briefly tested to see if this also happens when I use Sage from a terminal. I don't get the recursion error then. However, if I re-enter the "attach" command after I've altered the attached file, it appears to run through the commands in that file twice. (So, for instance, if the attached file includes "print 'Hello!'", it will do this twice.) I understand that the command line avoids the error, but I would really prefer to use the notebook if I can.

Any ideas? Please speak slowly and use small words (metaphorically). Thanks!


The error message starts with...

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_14.py", line 10, in <module>
  File "", line 1, in <module>

  File "/private/var/folders/5h/c6x89ch91fjgr43q99g8wbjw0000gn/T/tmphXrluN/___code___.py", line 3, in <module>

  sage.misc.preparser.load(sage.misc.preparser.base64.b64decode("Ii9Vc2Vycy9Kb2huL0Rlc2t0b3AvU2FnZV9zY3JpcHRzL3Rlc3Rlci5zYWdlIg=="),globals(),True)
  File "/Applications/Sage-4.8-OSX-64bit-10.6.app/Contents/Resources/sage/local/lib/python2.6/site-packages/sage/misc/preparser.py", line 1644, in load
    execfile(preparse_file_named(fpath), globals)
  File "/Users/John/.sage/temp/C_K_Dexter_Haven.local/34442/_Users_John_Desktop_Sage_scripts_tester_sage_6.py", line 6, in <module>

Then, the latter 4 lines (starting with "sage.misc.preparser.load") are repeated 492 more times, with the only thing changing being the number following "scripts_tester_sage_" in the last line. Then, it ends with:

sage.misc.preparser.load(sage.misc.preparser.base64.b64decode("Ii9Vc2Vycy9Kb2huL0Rlc2t0b3AvU2FnZV9zY3JpcHRzL3Rlc3Rlci5zYWdlIg=="),globals(),True)
  File "/Applications/Sage-4.8-OSX-64bit-10.6.app/Contents/Resources/sage/local/lib/python2.6/site-packages/sage/misc/preparser.py", line 1644, in ...
(more)
2012-01-30 07:05:48 -0600 commented answer How to make my code available

I was wondering about this exact issue the other day. It would be great to have an easy-to-use repository/sharing site with a low bar of entry. I took a look at sagenb.org, but I found that difficult to wade through. I would be too embarrassed to offer up any of my wobbly, duct-taped code for inclusion in any official library, but I might participate in something more informal. And if something posted there turned out to be very popular or useful, more savvy coders could help bring it up to speed and incorporate it into Sage.

2012-01-26 03:04:52 -0600 commented answer Decrease accuracy for floats (decrease decimal places reported)

Ah... I see. Thanks.

2012-01-25 10:37:41 -0600 answered a question Decrease accuracy for floats (decrease decimal places reported)

Do you mean printing (instead of plotting) the matrices? (Not sure what it would mean to plot a matrix.) If you're just trying to get a floating point number to display with fewer digits, you might try something like

foo.n(digits = 3)

Unfortunately, this simple approach doesn't always give expressions of a uniform "width", in terms of the number of characters. For example:

print pi.n(digits = 3)
print (pi*100000).n(digits = 3)
print (pi*100000000).n(digits = 3)
print (pi/100000).n(digits = 3)
print (pi/100000000).n(digits = 3)

returns

3.14
314000.
3.14e8
0.0000314
3.14e-8
2012-01-07 04:17:41 -0600 received badge  Critic (source)
2012-01-03 03:56:41 -0600 commented question intermediate algebra

I could be wrong, but my hunch is that the poster is asking how to solve an algebra homework problem. If so, then it's not a Sage question at all, and is more appropriate to a website like [math.stackexchange.com](http://math.stackexchange.com/) (if any).

2011-12-18 23:10:53 -0600 received badge  Nice Answer (source)