Thursday, December 26, 2019

Functions with Conditions


rho[phi_,r_,n_] :=If[ n ==1&&r*Cos[r*phi]>=0,
Sqrt[r*Cos[r*phi]],If[n==2,2r*Cos[r*phi-Pi/4]^2,
If[n==3&&3r*Cos[r*phi]>=3,3r*Cos[r*phi],0]]];
Show[Table[PolarPlot[rho[phi,r,i],{phi,0,2Pi},
PlotStyle->Hue[i/3]],{r,{2,3,4}},{i,3}],
Frame->True,GridLines->Automatic,
PlotRange->All,ImageSize->600]


No comments:

Post a Comment