Function Repository Resource:

InsideOutsidePlot

Source Notebook

Make an inside-outside plot of a function

Contributed by: Jan Mangaldan

ResourceFunction["InsideOutsidePlot"][f,z]

generates an inside-outside plot of the function f depending on complex argument z.

ResourceFunction["InsideOutsidePlot"][f,{x,y}]

generates an inside-outside plot of the two-variable function f.

Details and Options

An inside-outside plot shows the behavior of a function near and far from the origin simultaneously. Inside the inversion circle, the plot shows the actual value of the function, while outside the circle, the plot shows the inversion of the function.
ResourceFunction["InsideOutsidePlot"] treats the variables in the second argument as local, effectively using Block.
ResourceFunction["InsideOutsidePlot"] has attribute HoldAll, and evaluates f only after assigning specific numerical values to the independent variables.
In some cases, it may be more efficient to use Evaluate to evaluate f symbolically before specific numerical values are assigned to the independent variables.
ResourceFunction["InsideOutsidePlot"] has the same options as DensityPlot, with the following additions and changes:
AspectRatioAutomaticratio of height to width
FrameFalsewhether to put a frame around the plot
"InversionCircleStyle"Automaticstyle specifications for the inversion circle
"InversionRadius"1radius of the inversion circle
ScalingFunctionsLogisticSigmoidscaling function applied to the function values
ScalingFunctions is supplied with a single argument, given by the value of f.

Examples

Basic Examples (2) 

Inside-outside plot of :

In[1]:=
ResourceFunction["InsideOutsidePlot"][Im[Log[z]], z]
Out[1]=

Inside-outside plot of a bivariate function:

In[2]:=
ResourceFunction["InsideOutsidePlot"][Floor[Abs[x^y - y^x]], {x, y}]
Out[2]=

Options (5) 

ColorFunction (2) 

Explicitly specify a color function:

In[3]:=
ResourceFunction["InsideOutsidePlot"][Im[Sin[2 \[Pi] z]], z, ColorFunction -> (Hue[0.78 #] &)]
Out[3]=
In[4]:=
ResourceFunction["InsideOutsidePlot"][Tan[x] + Sec[y], {x, y}, ColorFunction -> (Hue[0.78 #] &)]
Out[4]=

Use a named color gradient:

In[5]:=
ResourceFunction["InsideOutsidePlot"][Im[Sech[z]], z, ColorFunction -> "TemperatureMap"]
Out[5]=

InversionCircleStyle (1) 

Change the style of the inversion circle:

In[6]:=
ResourceFunction["InsideOutsidePlot"][Re[ArcTan[z]], z, "InversionCircleStyle" -> Directive[Dashed, White]]
Out[6]=

InversionRadius (1) 

Compare inside-outside plots with different inversion radii:

In[7]:=
Table[ResourceFunction["InsideOutsidePlot"][Im[Cos[z]], z, "InversionRadius" -> r], {r, {\[Pi], 2 \[Pi]}}]
Out[7]=

ScalingFunctions (1) 

Use different scaling functions:

In[8]:=
Table[ResourceFunction["InsideOutsidePlot"][Sec[x] - Sec[y], {x, y}, ScalingFunctions -> f], {f, {Tanh, Identity}}]
Out[8]=

Applications (2) 

Inside-outside plot of a rational function:

In[9]:=
ResourceFunction["InsideOutsidePlot"][Im[z^5 + z^-5], z]
Out[9]=

Visualize a partial sum of "Zagier's strange function":

In[10]:=
ResourceFunction["InsideOutsidePlot"][
 Evaluate[Im[Sum[QPochhammer[q, q, n], {n, 11}]]], q]
Out[10]=

Properties and Relations (1) 

InsideOutsidePlot[f[z],z] is equivalent to InsideOutsidePlot[f[x+Iy],{x,y}]:

In[11]:=
{ResourceFunction["InsideOutsidePlot"][Re[ArcTan[z]], z], ResourceFunction["InsideOutsidePlot"][
   Re[ArcTan[x + I y]], {x, y}]} // GraphicsRow
Out[11]=

Neat Examples (3) 

Inside-outside plot of a doubly-periodic function:

In[12]:=
ResourceFunction["InsideOutsidePlot"][Im[JacobiSN[z, 1/2]], z, ColorFunction -> "ThermometerColors", "InversionCircleStyle" -> Directive[Thick, Gray], "InversionRadius" -> 2 EllipticK[1/2], PlotRange -> All]
Out[12]=

Inside-outside plot of a Blaschke product:

In[13]:=
ResourceFunction["InsideOutsidePlot"][
 Evaluate[Arg[
   Product[Sign[a] (a - z)/(1 - Conjugate[a] z), {a, RandomPoint[Disk[], 25] . {1, I}}]]], z, ColorFunction -> "MidShiftBalancedHue", ScalingFunctions -> Identity]
Out[13]=

Inside-outside plot of a random superposition of waves:

In[14]:=
ResourceFunction["InsideOutsidePlot"][
 Evaluate[Sign[
   Sum[RandomVariate[NormalDistribution[]] Cos[
      12 AngleVector[RandomReal[{-\[Pi], \[Pi]}]] . {x, y} + RandomReal[{-\[Pi], \[Pi]}]], {36}]]], {x, y}, ColorFunction -> "AvocadoColors", "InversionRadius" -> \[Pi]/2, PlotPoints -> 180]
Out[14]=

Version History

  • 1.0.0 – 22 January 2021

Related Resources

Author Notes

The implementation is based on code originally written by Michael Trott.

License Information