# Polar coordinates with negative angle

Following the sagemanifolds tutorial 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?

edit retag close merge delete

Sort by » oldest newest most voted

Sorry, I cannot reproduce your error on SageMathCloud: it works for me, cf.
https://cloud.sagemath.com/projects/5... 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).

more

Ohh... 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...)

1

Yes, 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).