ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 15 Aug 2016 10:31:01 +0200Polar coordinates with negative anglehttps://ask.sagemath.org/question/34452/polar-coordinates-with-negative-angle/Following the [sagemanifolds tutorial](http://sagemanifolds.obspm.fr/examples/pdf/SM_tutorial.pdf) I can make $\mathbb{R}^2$ with rectangular and polar coordinates:
R2 = Manifold(2, 'R2', r'\mathbb{R}^2', start_index=1)
Rect.<x,y> = R2.chart()
U = R2.open_subset('U', coord_def={Rect : (y != 0, x < 0)})
RectU = Rect.restrict(U)
Polar.<r,th> = U.chart(r'r:(0,+oo) th:(0,2*pi):\theta')
This uses the range $(0,2\pi)$ for $\theta$, excluding the positive $x$-axis. But if I try to use instead the range $(-\pi,\pi)$ for $\theta$, excluding the negative $x$-axis:
R2 = Manifold(2, 'R2', r'\mathbb{R}^2', start_index=1)
Rect.<x,y> = R2.chart()
U = R2.open_subset('U', coord_def={Rect : (y != 0, x > 0)})
RectU = Rect.restrict(U)
Polar.<r,th> = U.chart(r'r:(0,+oo) th:(-pi,pi):\theta')
SageMathCloud gives me "ValueError: Assumption is redundant". But strangely, SageMathCell doesn't complain at all. What is the problem?Fri, 12 Aug 2016 20:54:29 +0200https://ask.sagemath.org/question/34452/polar-coordinates-with-negative-angle/Answer by eric_g for <p>Following the <a href="http://sagemanifolds.obspm.fr/examples/pdf/SM_tutorial.pdf">sagemanifolds tutorial</a> I can make $\mathbb{R}^2$ with rectangular and polar coordinates:</p>
<pre><code>R2 = Manifold(2, 'R2', r'\mathbb{R}^2', start_index=1)
Rect.<x,y> = R2.chart()
U = R2.open_subset('U', coord_def={Rect : (y != 0, x < 0)})
RectU = Rect.restrict(U)
Polar.<r,th> = U.chart(r'r:(0,+oo) th:(0,2*pi):\theta')
</code></pre>
<p>This uses the range $(0,2\pi)$ for $\theta$, excluding the positive $x$-axis. But if I try to use instead the range $(-\pi,\pi)$ for $\theta$, excluding the negative $x$-axis:</p>
<pre><code>R2 = Manifold(2, 'R2', r'\mathbb{R}^2', start_index=1)
Rect.<x,y> = R2.chart()
U = R2.open_subset('U', coord_def={Rect : (y != 0, x > 0)})
RectU = Rect.restrict(U)
Polar.<r,th> = U.chart(r'r:(0,+oo) th:(-pi,pi):\theta')
</code></pre>
<p>SageMathCloud gives me "ValueError: Assumption is redundant". But strangely, SageMathCell doesn't complain at all. What is the problem?</p>
https://ask.sagemath.org/question/34452/polar-coordinates-with-negative-angle/?answer=34461#post-id-34461Sorry, I cannot reproduce your error on SageMathCloud: it works for me, cf.
https://cloud.sagemath.com/projects/551a1e1d-9360-47bf-89ba-91603e96c7fe/files/test_coordinates.sagews
Could it be that you typed the second example in the same worksheet as the first one? In this case, the error arises because one cannot have the symbolic variable theta both in (0,2pi) and (-pi,pi).
Sat, 13 Aug 2016 15:35:31 +0200https://ask.sagemath.org/question/34452/polar-coordinates-with-negative-angle/?answer=34461#post-id-34461Comment by Mike Shulman for <p>Sorry, I cannot reproduce your error on SageMathCloud: it works for me, cf. <br/><a href="https://cloud.sagemath.com/projects/551a1e1d-9360-47bf-89ba-91603e96c7fe/files/test_coordinates.sagews">https://cloud.sagemath.com/projects/5...</a>
Could it be that you typed the second example in the same worksheet as the first one? In this case, the error arises because one cannot have the symbolic variable theta both in (0,2pi) and (-pi,pi).</p>
https://ask.sagemath.org/question/34452/polar-coordinates-with-negative-angle/?comment=34481#post-id-34481Ohh... is that true even if I evaluate the first example and then edit it to change it into the second? (Not a very helpful error message, in that case...)Mon, 15 Aug 2016 06:20:00 +0200https://ask.sagemath.org/question/34452/polar-coordinates-with-negative-angle/?comment=34481#post-id-34481Comment by eric_g for <p>Sorry, I cannot reproduce your error on SageMathCloud: it works for me, cf. <br/><a href="https://cloud.sagemath.com/projects/551a1e1d-9360-47bf-89ba-91603e96c7fe/files/test_coordinates.sagews">https://cloud.sagemath.com/projects/5...</a>
Could it be that you typed the second example in the same worksheet as the first one? In this case, the error arises because one cannot have the symbolic variable theta both in (0,2pi) and (-pi,pi).</p>
https://ask.sagemath.org/question/34452/polar-coordinates-with-negative-angle/?comment=34482#post-id-34482Yes, because assumptions are kept in memory (as you can check by looking at the output of the command `assumptions()`). To have it work, you have to clear all assumptions by running `forget()` before editing to the second example. You could also run `forget(th>0)`.Mon, 15 Aug 2016 10:31:01 +0200https://ask.sagemath.org/question/34452/polar-coordinates-with-negative-angle/?comment=34482#post-id-34482