|
From: Andre' Walker-L. <wal...@gm...> - 2012-12-17 23:55:00
|
> http://en.wikipedia.org/wiki/Polar_coordinate_system#Uniqueness_of_polar_coordinates quoting from the site ''' Where a unique representation is needed for any point, it is usual to limit r to non-negative numbers (r ≥ 0) and θ to the interval [0, 360°) or (−180°, 180°] (in radians, [0, 2π) or (−π, π]).[12] One must also choose a unique azimuth for the pole, e.g., θ = 0. ''' Of course I don't have anything close to a scientific study of the following statement, but I suspect in practice (ie as polar coordinates are used in practice by working scientists), they expect to find values of "r" consistent with the above definition of unique - however, still wanting theta to not be bounded. Taking another quote form the site ''' Also, a negative radial coordinate is best interpreted as the corresponding positive distance measured in the opposite direction. ''' How does one define opposite in polar coordinates? The natural definition for "opposite" direction is presumably theta --> theta + pi, as that definition would correspond to the same notion of "opposite" in Cartesian coordinates (take whatever direction you were drawing a line, and go in "-" that direction. If we agree that this is the sensible definition of opposite, then pyplot.polar is not representing this definition of opposite. Attached are two plots. The first uses ''' as matplotlib is - neg_r.png ''' import numpy as np import matplotlib.pyplot as plt t = np.linspace(-np.pi, np.pi, 60) r = t plt.polar(t,r) The second produces a curve which I say represents the natural definition of "opposite". Note, the tangents of the curves are also opposite as well ''' as matplotlib "should be" - neg_r_opposite.png ''' import numpy as np import matplotlib.pyplot as plt t = np.linspace(0, np.pi, 30) r = t plt.polar(t,r) t_opp = np.linspace(np.pi,2*np.pi,30) r_opp = t_opp - np.pi plt.polar(t_opp,r_opp) I have three points to make with these plots: 1) my definition of opposite makes more sense than the default behavior of matplotlib 2) other people may have different ideas about what is best 3) matplotlib should at least raise a NOISY warning about what it is doing. Andre |