This blog is again inspired by the interesting lecture from Dr Michael Penn's YouTube Channel (one of the best math channel and approaching 150K subs quickly!) . My goal here is to show a little more generalized result using interactive built-in WL functions. Typically, it is going to show the limit of p-norm as p approaches infinity with a geometric application.
Analysis
Because we have three absolute value adding together, it is nature to link to
p
L
space and using Norm function to generalize this sum. Without the second argument, Norm function returns regular Euclidean metrics.
Norm[{a,b,c}]
Out[]=
2
Abs[a]
+
2
Abs[b]
+
2
Abs[c]
If the second argument is 1, we have something presented in the problem
Norm[{a,b,c},1]
Out[]=
Abs[a]+Abs[b]+Abs[c]
To visualize the region in Michael’s lecture, the following one-liner just works
To make the area computation easily sweep through various
P
values, I defined the following function. Note that I convert any P value greater than a given threshold to infinity, beyond which I don’t see much difference in visualization and numeric result once the variable passes.
In[]:=
normFunc[p_]:=Norm2x-1,2x+1,
4
3
*y,If[p<=11,p,Infinity];
This is where p is at infinity
normFunc["Infinity"]=normFunc[100]
Out[]=
MaxAbs[-1+2x],Abs[1+2x],
4Abs[y]
3
I can compute symbolic result are by Integrate and Boole function. Boole makes the “height” 1 on region bounded by the inequality and 0 elsewhere. There is another value
p2
gives symbolic result quickly,which represents the area of ellipse .Cache the special values
Compute the bounded area at 1-norm, 2-norm, and so on.
In[]:=
areas=areaFunc/@xValue;
Use ListLogLinearPlot to change the x axis to logarithm scale to handle a mixture of large and small numbers. Callout is helpful to read coordinates with the absent of vertical grid lines.
This result is identical to my previous symbolic integration.
Create Animation
As you can see from the beginning of the blog, every frame of the animation is the combination of two plots. They are threaded with Column function to align perfectly in the vertical direction.