Ask Your Question

Ant's profile - activity

2023-05-27 13:00:43 +0200 received badge  Popular Question (source)
2021-04-27 14:06:37 +0200 received badge  Popular Question (source)
2020-12-14 22:53:28 +0200 received badge  Popular Question (source)
2019-10-28 17:18:42 +0200 received badge  Famous Question (source)
2018-09-29 21:40:48 +0200 received badge  Notable Question (source)
2018-07-17 09:42:23 +0200 received badge  Popular Question (source)
2017-11-21 16:43:40 +0200 received badge  Enthusiast
2017-11-16 22:32:46 +0200 received badge  Teacher (source)
2017-11-16 20:30:41 +0200 answered a question how to create a matrix valued function?

Like this?

def g(x,y):
    return matrix(SR,2,2,[1,x,cos(y),x*y])
2017-10-24 01:22:34 +0200 commented answer Laurent series error q^2+O(q) is not O(q)

Sorry, I don't really understand your way of preventing. I showed a simple example of how things can go wrong, which makes computations in Laurent series rings impossible because you can't even perform addition in there. For example,

a=R(1+q+O(q^2))
b=R(-1-q-O(q^4))
c=R(q^3+O(q^4))
print a+b+c

gives an error. I think you are right about the function add_bigoh. I tried to understand how to report bugs in here, but it seems overly complicated tbh, so if you or anyone could report that, it would be great! Also, it just seems that the whole LaurentSeriesRing is underdeveloped (earlier I asked about lifting homomorphisms from the base ring to Laurent series, which is implemented for polynomials but not for series),which is weird because Laurent series are better than power

2017-10-20 15:52:03 +0200 received badge  Editor (source)
2017-10-19 16:08:25 +0200 commented answer Laurent series error q^2+O(q) is not O(q)

The expectation is O(q). The same code works for power series and gives the desired result O(q)

2017-10-18 22:13:58 +0200 asked a question Laurent series error q^2+O(q) is not O(q)

I get an error for the following code:

R.<q>=LaurentSeriesRing(QQ,1)
O(q)+q^2

Any explanation? (works for PowerSeriesRing) Here is the error:

Error in lines 2-2 Traceback (most recent call last): File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 996, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 1, in <module> File "sage/structure/element.pyx", line 1192, in sage.structure.element.Element.__add__ (/ext/sage/sage-8.0/src/build/cythonized/sage/structure/element.c:10640) return (<element>left)._add_(right) File "sage/rings/laurent_series_ring_element.pyx", line 622, in sage.rings.laurent_series_ring_element.LaurentSeries._add_ (/ext/sage/sage-8.0/src/build/cythonized/sage/rings/laurent_series_ring_element.c:8637) return right.add_bigoh(self.prec()) File "sage/rings/laurent_series_ring_element.pyx", line 691, in sage.rings.laurent_series_ring_element.LaurentSeries.add_bigoh (/ext/sage/sage-8.0/src/build/cythonized/sage/rings/laurent_series_ring_element.c:9742) u = self.__u.add_bigoh(prec - self.__n) File "sage/rings/power_series_ring_element.pyx", line 797, in sage.rings.power_series_ring_element.PowerSeries.add_bigoh (/ext/sage/sage-8.0/src/build/cythonized/sage/rings/power_series_ring_element.c:9029) return self._parent(v, prec) File "sage/structure/parent.pyx", line 936, in sage.structure.parent.Parent.__call__ (/ext/sage/sage-8.0/src/build/cythonized/sage/structure/parent.c:9826) return mor._call_with_args(x, args, kwds) File "sage/structure/coerce_maps.pyx", line 173, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_with_args (/ext/sage/sage-8.0/src/build/cythonized/sage/structure/coerce_maps.c:5322) raise File "sage/structure/coerce_maps.pyx", line 166, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_with_args (/ext/sage/sage-8.0/src/build/cythonized/sage/structure/coerce_maps.c:5161) return C._element_constructor(x, *args) File "/ext/sage/sage-8.0/local/lib/python2.7/site-packages/sage/rings/power_series_ring.py", line 783, in _element_constructor_ raise ValueError("prec (= %s) must be non-negative" % prec) ValueError: prec (= -1) must be non-negative

2017-10-16 16:27:20 +0200 received badge  Supporter (source)
2017-10-16 16:26:59 +0200 answered a question Is there a way to get the homogeneous part of certain degree of a (multivariate) polynomial?

If you don't want to write your own functions, you can also try adding O(d+1) in the corresponding power series ring to kill all higher order terms, then extract the polynomial back using .polynomial(), and then using your homogenize idea

2017-10-15 10:07:17 +0200 received badge  Student (source)
2017-10-12 18:37:48 +0200 commented answer laurent series ring induced homomorphism

Yes, I want something like this, but for Laurent series ring instead of Laurent polynomial ring. Somehow inducing homomorphisms in this manner works for Laurent polynomials and power series, but it doesn't seem to work for Laurent series. I know it is not hard to write the corresponding code, but I was just wondering if it is already implemented in sage

2017-10-12 18:15:04 +0200 commented answer Simplifying rational expressions

Let R be as in answer above (rational functions of x,y and z). Now let's consider R((q)) -formal Laurent series with coefficients in R. My problem is that sage keeps coefficients of those series not simplified (probably it thinks that all rational numbers are units and hence all the same) and also expanded. Now if I multiply two such series the coefficients become even worse (in sage's representation, but I know they can be simplified). So my question is: is there a way to make sage keep automatically simplifying coefficients every time I perform operations on Laurent series? Also I would really prefer if the coefficients were saved in a factored form if possible. Even if I call factor() for coefficients, when I print a series, the coefficients are in the expanded form.

2017-10-11 18:05:11 +0200 asked a question laurent series ring induced homomorphism

Can you not lift homomorphism of the base ring to the homomorphism of Laurent series ring in sage? (not manually)

2017-10-11 17:24:46 +0200 commented answer Simplifying rational expressions

That actually works, thanks! And now if I have a power series with coefficients in ring R as in your answer above, is there any way to make sage automatically simplify the coefficients without calling factor() for them? I am computing rather complicated expressions with a lot of steps, so I don't even know at what point I would need to call for it if I had to do it manually

2017-10-11 09:23:17 +0200 asked a question Simplifying rational expressions

I am working with a power series with coefficients being rational functions of several variables (everything over QQ). Is there any way to make sage automatically simplify the coefficients?

Here is an example of what is going on

k=RR.zero()+(-524288*x^2 - 1048576*x*y - 524288*y^2 + 524288*x*z + 524288*y*z)/(-1048576*z^2)
print k
print u
print u-k
print (simplify(u))
print u
print parent(u)
print parent(k)
print factor(u.numerator())/factor(u.denominator())

And results:

(1/2*x^2 + x*y + 1/2*y^2 - 1/2*x*z - 1/2*y*z)/z^2
(-524288*x^2 - 1048576*x*y - 524288*y^2 + 524288*x*z + 524288*y*z)/(-1048576*z^2)
0
(-524288*x^2 - 1048576*x*y - 524288*y^2 + 524288*x*z + 524288*y*z)/(-1048576*z^2)
(-524288*x^2 - 1048576*x*y - 524288*y^2 + 524288*x*z + 524288*y*z)/(-1048576*z^2)
Fraction Field of Multivariate Polynomial Ring in x, y, z over Rational Field
Fraction Field of Multivariate Polynomial Ring in x, y, z over Rational Field
(-1/2) * z^-2 * (-x - y + z) * (x + y)
2017-10-11 09:23:16 +0200 asked a question Simplifying rational expressions

I am working with a power series with coefficients being rational functions of several variables (everything over QQ). Is there any way to make sage automatically simplify the coefficients?

Here is an example of what is going on

k=RR.zero()+(-524288*x^2 - 1048576*x*y - 524288*y^2 + 524288*x*z + 524288*y*z)/(-1048576*z^2)
print k
print u
print u-k
print (simplify(u))
print u
print parent(u)
print parent(k)
print factor(u.numerator())/factor(u.denominator())

And results:

(1/2*x^2 + x*y + 1/2*y^2 - 1/2*x*z - 1/2*y*z)/z^2
(-524288*x^2 - 1048576*x*y - 524288*y^2 + 524288*x*z + 524288*y*z)/(-1048576*z^2)
0
(-524288*x^2 - 1048576*x*y - 524288*y^2 + 524288*x*z + 524288*y*z)/(-1048576*z^2)
(-524288*x^2 - 1048576*x*y - 524288*y^2 + 524288*x*z + 524288*y*z)/(-1048576*z^2)
Fraction Field of Multivariate Polynomial Ring in x, y, z over Rational Field
Fraction Field of Multivariate Polynomial Ring in x, y, z over Rational Field
(-1/2) * z^-2 * (-x - y + z) * (x + y)