[sage-support] Re: c++'s "map" equivalent in sage/python

2013-07-03 Thread Sam Math
9:24:42 PM UTC-4, Sam Math wrote: >> >> So as you can see, I'm adding 2 elements (in this case, the values are >> 1... but I have specific values in my program) to the dictionary, but >> removing the "first" (in the sense of its key). Calling th

[sage-support] Re: c++'s "map" equivalent in sage/python

2013-07-03 Thread Sam Math
he data insertion into the dictionary. Now, it may be the case that inserting the data takes the same amount of time as finding the minimum key, but I'm not sure. Thanks On Wednesday, July 3, 2013 8:07:14 PM UTC-5, John H Palmieri wrote: > > > > On Wednesday, July 3, 201

[sage-support] c++'s "map" equivalent in sage/python

2013-07-03 Thread Sam Math
I'm looking for an equivalent to the 'map' function in C++, http://www.cplusplus.com/reference/map/map/. Essentially, I want an associative array. Specifically, I want the array to be indexed by floats. I'm aware of dictionaries in Python, but my program seems to take a lot of time because the

[sage-support] how to keep up to a certain degree of a multivariate polynomial?

2013-06-03 Thread Sam math
I have a multivariate polynomial and want to keep only up to a certain degree. I already know how to do this for the univariate case. For 1 variable, I'd do: R. = PolynomialRing(QQ) f = x^4 + x^2 + x^3 + x + 1 f = f + O(x^3) print f #output would be 1 + x + x^2... which is what I want. How