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

[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, cylinderplot, densityplot, display, displ...
[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, cylinderplot, densityplot, display, displ...
[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, cylinderplot, densityplot, display, displ...
[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, cylinderplot, densityplot, display, displ...
[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, cylinderplot, densityplot, display, displ...

>   

>    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);

R1 := 2+3*sin(theta)

>    R2 := 0+2*cos(theta);

R2 := 2*cos(theta)

>   

>    AnimatePolarCurve( R1, theta=0..2*Pi, frames=20, scaling=constrained );

[Maple Plot]

>   

>    AnimatePolarCurve( R2, theta=0..2*Pi, frames=20, scaling=constrained );

[Maple Plot]

>   

>   

>    A := [ (3-i/10) $ i=0..60 ]:

>    Limacon := (a,b) -> a+b*sin(theta);

Limacon := proc (a, b) options operator, arrow; a+b*sin(theta) end proc

>   

>    display( [seq( polarplot( Limacon(a,2), theta=0..2*Pi,

>                              title=sprintf("r=%a+3sin(theta)", a, b) ), a=A )],

>             insequence=true );

[Maple Plot]

>   

>    polarplot( [seq( Limacon(a,2), a=A )], theta=0..2*Pi );

[Maple Plot]

>   

>    polarplot( theta*cos(theta), theta=-4*Pi..4*Pi );

[Maple Plot]

>   

>    AnimatePolarCurve( theta*cos(theta), theta=-4*Pi..4*Pi, frames=50 );

[Maple Plot]

>   

>    polarplot( sqrt(1-sin(theta)^2/2), theta=0..2*Pi );

[Maple Plot]

>   

>    polarplot( cos(13*theta/5), theta=0..80*Pi/13 );

[Maple Plot]

>   

>    AnimatePolarCurve( cos(13*theta/5), theta=0..5*Pi, frames=20 );

[Maple Plot]

>   

>    polarplot( [ sqrt(3)*sin(theta), 1+cos(theta) ], theta=0..2*Pi );

[Maple Plot]

>   

>    AnimatePolarCurve( 4*cos(3*theta), theta=0..Pi, scaling=constrained );

[Maple Plot]

>   

>    polarplot( 4*cos(3*theta), theta=-Pi/6..Pi/6, scaling=constrained );

[Maple Plot]

>   

>