Plotting in Polar Coordinates
Douglas B. Meade
Department of Mathematics
University of South Carolina
Columbia, SC 29208
E-mail: meade@math.sc.edu
Homepage: http://www.math.sc.edu/~meade/
> |
> | restart; |
> | with( plots ); |
Warning, the name changecoords has been redefined
> |
> | AnimatePolarCurve := proc( R, Domain ) |
> | local FOpt, Frames, Opts, Plist, PP, r, Tlist, X, Xlo, Xhi; |
> | (X,Xlo,Xhi) := lhs(Domain),op(1..2,rhs(Domain)); |
> | r := unapply( R, X ); |
> | if nargs>2 then Opts := [args[3..-1]] else Opts := [] end if; |
> | if has( Opts, frames ) then |
> | (FOpt,Opts) := selectremove( has, Opts, frames ); |
> | Frames := rhs(FOpt[]); |
> | else |
> | Frames := 10 |
> | end if; |
> | Tlist := Xlo + (Xhi-Xlo)/Frames * i $ i=1..Frames; |
> | PP := (r,T,Xlo) -> display( [ polarplot( r(theta), theta=Xlo..T ), |
> | plot( [[0,0],[r(T),T]], coords=polar, color=cyan ) ], |
> | title=sprintf("theta = %a = %8.4f", T, T) ); |
> | Plist := [seq( PP(r,T,Xlo), T=Tlist )]; |
> | display( Plist, insequence=true, Opts[] ); |
> | end proc: |
> |
> | R1 := 2+3*sin(theta); |
> | R2 := 0+2*cos(theta); |
> |
> | AnimatePolarCurve( R1, theta=0..2*Pi, frames=20, scaling=constrained ); |
> |
> | AnimatePolarCurve( R2, theta=0..2*Pi, frames=20, scaling=constrained ); |
> |
> |
> | A := [ (3-i/10) $ i=0..60 ]: |
> | Limacon := (a,b) -> a+b*sin(theta); |
> |
> | display( [seq( polarplot( Limacon(a,2), theta=0..2*Pi, |
> | title=sprintf("r=%a+3sin(theta)", a, b) ), a=A )], |
> | insequence=true ); |
> |
> | polarplot( [seq( Limacon(a,2), a=A )], theta=0..2*Pi ); |
> |
> | polarplot( theta*cos(theta), theta=-4*Pi..4*Pi ); |
> |
> | AnimatePolarCurve( theta*cos(theta), theta=-4*Pi..4*Pi, frames=50 ); |
> |
> | polarplot( sqrt(1-sin(theta)^2/2), theta=0..2*Pi ); |
> |
> | polarplot( cos(13*theta/5), theta=0..80*Pi/13 ); |
> |
> | AnimatePolarCurve( cos(13*theta/5), theta=0..5*Pi, frames=20 ); |
> |
> | polarplot( [ sqrt(3)*sin(theta), 1+cos(theta) ], theta=0..2*Pi ); |
> |
> | AnimatePolarCurve( 4*cos(3*theta), theta=0..Pi, scaling=constrained ); |
> |
> | polarplot( 4*cos(3*theta), theta=-Pi/6..Pi/6, scaling=constrained ); |
> |
> |