Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168759
Image: ubuntu2004

Polar coordinates have the form (r,θ)(r, \theta) where rr represents a distance from the origin or 'pole', and θ\theta represents an angle of rotation.

The same point is specified by (r,θ)(r, \theta) in polar coordinates, (rcosθ,rsinθ)(r \cdot cos \theta, r \cdot sin \theta) in rectangular coordinates, and r(cosθ+isinθ)r(\cos \theta + i\sin \theta) in complex coordinates.

def polar(r, theta): return (r*cos(theta), r*sin(theta)) @interact def _(r = (0..10), theta = (0..2*pi, step = pi/180)): P = polar(r, theta) radius = line([(0,0), P]) arc = points([polar(r,x) for x in [0..theta, step = pi/180]], color = 'red') cosP = line([P, (r*cos(theta), 0)], linestyle = '--') sinP = line([P, (0, r*sin(theta))], linestyle = '--') print 'Polar:\t\t',(r, theta),'=',(r, theta.n(digits = 4)) print 'Rectangular:\t','(',r,'*cos(',theta.n(digits = 4),'),',r,'*sin(',theta.n(digits = 4),'))','=', print (n(r*cos(theta), digits = 4), n(r*sin(theta), digits = 4)) print 'Complex:\t',r,'*(cos(',theta,') + sin(',theta,')*I) =', r*n((cos(theta), sin(theta)), digits = 4) show(circle((0,0),r)+radius+arc+cosP+sinP, aspect_ratio = 1)

A polar equation r=f(θ)r = f(\theta) defines a distance rr as a function of an angle of rotation θ\theta:

var('theta') def r(theta): return theta domain = [0..2*pi, step = pi/180] r(theta)

To understand the graph of a polar equation, think of the function r(θ)r(\theta) as computing the distance you travel in the direction of θ\theta.

Here is a graph of rr using polar coordinates (r(θ),θ)(r(\theta), \theta):

P = [(r(theta)*cos(theta), r(theta)*sin(theta)) for theta in domain] show(points(P), aspect_ratio = 1)

For comparison, here is a graph of rr using rectangular coordinates in the way you have seen previously where the horizontal axis represents θ\theta and the vertical axis represents r(θ)r(\theta)(θ,r(θ))(\theta, r(\theta)):

P = [(theta, r(theta)) for theta in domain] show(points(P), aspect_ratio = 1)

Circles

r=acos(θ)r = a \cos(\theta) or r=asin(θ)r = a \sin(\theta)

def polar(r, theta): return (r*cos(theta), r*sin(theta)) pole = (0, 0) domain = [0..2*pi, step = pi/60] @interact def _(a = (-10..10), kind = ['cos', 'sin']): f = eval(kind) r(theta) = a*f(theta) print 'r =',a,kind,'(',theta,')' L = [line([pole, polar(r(x), x)]) for x in domain] show(sum(L), aspect_ratio = 1)
@interact def _(a = (-10..10), kind = ['cos', 'sin']): f = eval(kind) r(theta) = a*f(theta) print 'r =',a,kind,'(',theta,')' show(polar_plot(r, 0, 2*pi), aspect_ratio = 1)

Rose Curves

r=asin(nθ)r = a \sin(n\theta)  or  r=acos(nθ)r = a \cos(n\theta)

@interact def _(a = (0..20), n = (0..20), kind = ['sin', 'cos']): f = eval(kind) r(theta) = a*f(n*theta) print r(theta) show(polar_plot(r, 0, 2*pi), aspect_ratio = 1)

Limacons

r=a+bsinθr = a + b \sin\theta  or  r=a+bcosθr = a + b \cos\theta

@interact def _(a = (-10..10), b = (-10..10), kind = ['sin', 'cos']): f = eval(kind) r(theta) = a + b*f(theta) print r(theta) show(polar_plot(r, 0, 2*pi), aspect_ratio = 1)

Lemniscates

r2=a2sin2θr^2 = a^2 \sin 2\theta or r2=a2cos2θr^2 = a^2\cos 2\theta

@interact def _(a = (-5..5), kind = ['sin', 'cos']): f = eval(kind) r(theta) = a*sqrt(f(2*theta)) if f == sin: P = polar_plot(r, 0, pi/2) + polar_plot(-r, 0, pi/2) elif f == cos: P = polar_plot(r, -pi/4, pi/4) + polar_plot(-r, -pi/4, pi/4) print r^2 show(P, aspect_ratio = 1)
def polar(r, theta): return (r*cos(theta), r*sin(theta)) @interact def _(a = (-10..10), b = (-10..10), n = (1..10), kind = ['sin', 'cos'], start = 0, end = 2*pi, inc = pi/60): f = eval(kind) r(theta) = a + b*f(n*theta) print 'r =',a,'+',b,'*',kind,'(',n,'*',theta,')' pole = (0, 0) domain = [start..end, step = inc] L = [line([pole, polar(r(x), x)]) for x in domain] show(sum(L), aspect_ratio = 1)
@interact def _(a = (-10..10), b = (-10..10), n = (1..10), kind = ['sin', 'cos']): f = eval(kind) r(theta) = a + b*f(n*theta) print r show(polar_plot(r, 0, 2*pi), aspect_ratio = 1)

In the following graph each point is determined by (r(θ),θ)(r(\theta), \theta):

Q1 = [(r(theta)*cos(theta), r(theta)*sin(theta)) for theta in [0..1/2*pi, step = pi/120]] Q2 = [(r(theta)*cos(theta), r(theta)*sin(theta)) for theta in [1/2*pi..pi, step = pi/120]] Q3 = [(r(theta)*cos(theta), r(theta)*sin(theta)) for theta in [pi..3/2*pi, step = pi/120]] Q4 = [(r(theta)*cos(theta), r(theta)*sin(theta)) for theta in [3/2*pi..2*pi, step = pi/120]] show(points(Q1)+points(Q2, color = 'red')+points(Q3, color='green')+points(Q4, color = 'black'), aspect_ratio = 1)
r(theta) = sqrt(theta) polar_plot(r, 0, 2*pi).show(aspect_ratio = 1)
P = [(r(theta)*cos(theta), r(theta)*sin(theta)) for theta in [0..2*pi, step = pi/60]] show(points(P), aspect_ratio=1)
r(theta) = cos(3*theta) r
show(polar_plot(r, 0, 2*pi), aspect_ratio = 1)
P = [(r(theta)*cos(theta), r(theta)*sin(theta)) for theta in [0..2*pi, step = pi/120]] show(points(P), aspect_ratio=1)
r(x) = 1-2*cos(x) polar_plot(r, 0, 2*pi).show(aspect_ratio = 1)
P = [(r(theta)*cos(theta), r(theta)*sin(theta)) for theta in [0..2*pi, step = pi/120]] show(points(P), aspect_ratio=1)
r(x) = 1 - x*sin(4*x) polar_plot(r, 0, 2*pi).show(aspect_ratio = 1)
r(x) = 1 - x*sin(2*x) domain = [0..4*pi, step = pi/180] points([(r(x)*cos(x), r(x)*sin(x)) for x in domain]).show(aspect_ratio = 1)
r(pi/180).n()
r(x) = 1 - x*sin(2*x) show(polar_plot(r, 0, pi), aspect_ratio = 1)
r(theta) = 1-2*cos(theta) def polar_point(r, theta): return (r*cos(theta), r*sin(theta)) domain = [0..2*pi, step = pi/180] L = sum([line([(0,0),polar_point(r(theta), theta)], color = (random(), random(), random())) for theta in domain]) show(L, aspect_ratio = 1)