Squircle

Author

Eric W. Weisstein
February 20, 2012

This notebook downloaded from http://mathworld.wolfram.com/notebooks/PlaneCurves/Squircle.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/Squircle.html.

©2012 Wolfram Research, Inc. except for portions noted otherwise

Wikipedia Definition

ContourPlot[x^4+y^4==1^4,{x,-1,1},{y,-1,1},Frame->False,Axes->True,Ticks->None,ContourStyle->Red]

(((r(Sqrt[Cos[t]])))^4)+(((r(Sqrt[Sin[t]])))^4)//Simplify

{
ParametricPlot[{Sqrt[Cos[t]],Sqrt[Sin[t]]},{t,0,π/2}],
ParametricPlot[{-Sqrt[Cos[t]],Sqrt[Sin[t]]},{t,0,π/2}],
ParametricPlot[{-Sqrt[Cos[t]],-Sqrt[Sin[t]]},{t,0,π/2}],
ParametricPlot[{Sqrt[Cos[t]],-Sqrt[Sin[t]]},{t,0,π/2}]
}

Properties

Inequality

ineq[x_,y_]:=x^4+y^4≤1

Arc Length Function

Arc Length

(s=4ArcLength[{Sqrt[Cos[t]],Sqrt[Sin[t]]},{t,0,π/2}])//Timing

FullSimplify[(Sqrt[(1/4) Cos[t] Cot[t]+(1/4) Sin[t] Tan[t]]),0<t<π/2]

2NIntegrate[(Sqrt[Cos[t] Cot[t]+Sin[t] Tan[t]]),{t,0,π/2}]

Factor[Cos[t] Cot[t]+Sin[t] Tan[t]/.{Cos[t_]->cos[t],Sin[t_]->sin[t],Tan[t_]->sin[t]/cos[t],Cot[t_]->cos[t]/sin[t]}]

(((cos[t]+sin[t]) (1-cos[t] sin[t]))/(cos[t] sin[t]))

Solve[x^4+y^4==1,y]

FullSimplify[(Sqrt[1+D[(((1-(x^4)))^(1/4)),x]^2]),0<x<1]

4NIntegrate[(Sqrt[1+((x^6)/(((1-(x^4)))^(3/2)))]),{x,0,1},WorkingPrecision->100,PrecisionGoal->20,MaxRecursion->20]

4NIntegrate[(Sqrt[1+((x^6)/(((1-(x^4)))^(3/2)))]),{x,0,1},WorkingPrecision->100,PrecisionGoal->30,MaxRecursion->20]

4Integrate[(Sqrt[1+((x^6)/(((1-(x^4)))^(3/2)))]),{x,0,1}]

Integrate[(Sqrt[1+((x^6)/(((1-(x^4)))^(3/2)))]),x]

Arc Length try 1.5

Solve[1+x^6/(1-x^4)^(3/2)==1+y^4,y]//FullSimplify

Arc Length try 2

Michael Trott
Oct. 21, 2011

If you have a nested algebraic functions that Mathematica cannot integrate, the standard approach is to find a new variable that removes the inner radicals (Guidebook for Symbolics, ex. 22d).  In this case, a moment of inspection suggests:

1+x^6/(1-x^4)^(3/2)==1+y^6

Solve[1+x^6/(1-x^4)^(3/2)==1+y^6,y]//FullSimplify

Plot[(x/(((1-(x^4)))^(1/4))),{x,0,1}]

FullSimplify[D[(x/(((1-(x^4)))^(1/4))),x]/.x->(y/(((1+(y^4)))^(1/4))),y>0]

∫f(x)\[DifferentialD]x==∫f(y)((((( \[DifferentialD]y)/(\[DifferentialD]x))))^(-1))\[DifferentialD]y

{Limit[(x/(((1-(x^4)))^(1/4))),x->0,Direction->-1],Limit[(x/(((1-(x^4)))^(1/4))),x->1,Direction->1]}

4NIntegrate[((Sqrt[1+y^6])/(((1+(y^4)))^(5/4))),{y,0,∞}]

Changing variables gives

and the integral can be done in closed form:

Plot[(x/(((1-(x^4)))^(1/4))),{x,0,1}]

FullSimplify[D[(x/(((1-(x^4)))^(1/4))),x]/.x->(y/(((1+(y^4)))^(1/4))),y>0]

∫f(x)\[DifferentialD]x==∫f(y)((((( \[DifferentialD]y)/(\[DifferentialD]x))))^(-1))\[DifferentialD]y

{Limit[(x/(((1-(x^4)))^(1/4))),x->0,Direction->-1],Limit[(x/(((1-(x^4)))^(1/4))),x->1,Direction->1]}

4NIntegrate[((Sqrt[1+y^6])/(((1+(y^4)))^(5/4))),{y,0,∞}]

Changing variables gives

and the integral can be done in closed form:

Arc Length try 2

Michael Trott
Oct. 21, 2011

If you have a nested algebraic functions that Mathematica cannot integrate, the standard approach is to find a new variable that removes the inner radicals (Guidebook for Symbolics, ex. 22d).  In this case, a moment of inspection suggests:

1+x^6/(1-x^4)^(3/2)==1+y^6

Solve[1+x^6/(1-x^4)^(3/2)==1+y^6,y]//FullSimplify

Plot[(x/(((1-(x^4)))^(1/4))),{x,0,1}]

FullSimplify[D[(x/(((1-(x^4)))^(1/4))),x]/.x->(y/(((1+(y^4)))^(1/4))),y>0]

∫f(x)\[DifferentialD]x==∫f(y)((((( \[DifferentialD]y)/(\[DifferentialD]x))))^(-1))\[DifferentialD]y

{Limit[(x/(((1-(x^4)))^(1/4))),x->0,Direction->-1],Limit[(x/(((1-(x^4)))^(1/4))),x->1,Direction->1]}

4NIntegrate[((Sqrt[1+y^6])/(((1+(y^4)))^(5/4))),{y,0,∞}]

Changing variables gives

and the integral can be done in closed form:

(s=4*Integrate[((Sqrt[1+(y^6)])/(((1+(y^4)))^(5/4))),{y,0,Infinity}])//Timing

s=-(((3^(1/4)) MeijerG[{{(1/3),(2/3),(5/6),1,(4/3)},{}},{{(1/12),(5/12),(7/12),(3/4),(13/12)},{}},1])/(16 (Sqrt[2]) (π^(7/2)) Gamma[(5/4)]));

N[s]//Chop//Timing

N[s,10]//Chop//Timing

N[s,20]//Chop//Timing

N[s,100]//Chop//Timing

N[s,200]//Chop//Timing

RealDigits[N[s,100]//Chop,10][[1]]

TraditionalForm[s]

FunctionExpand[s]

FullSimplify[s]

Area

RegionPlot[x^4+y^4≤1,{x,-1,1},{y,-1,1},AspectRatio->Automatic]

Area[ineq[x,y],{x,y}]

N[%]

FullSimplify[(-Root[-1+(x^4)+((#1)^4)&,1]+Root[-1+(x^4)+((#1)^4)&,2]),-1<x<1]

Integrate[(((1-(x^4)))^(1/4))-Root[-1+(x^4)+((#1)^4)&,1],{x,-1,1}]//FullSimplify

4Integrate[(((1-(x^4)))^(1/4)),{x,0,1}]//FunctionExpand

N[%]

FullSimplify[((2 Gamma[(1/4)] Gamma[(5/4)])/(Sqrt[π]))-((8 ((Gamma[(5/4)])^2))/(Sqrt[π]))]

Area Moment of Inertia

AreaInertiaTensor[ineq[x,y],{x,y}]//Timing

FullSimplify[(-Root[-1+(x^4)+((#1)^4)&,1]+Root[-1+(x^4)+((#1)^4)&,2]),-1<x<1]

Integrate[x^2((((1-(x^4)))^(1/4))-Root[-1+(x^4)+((#1)^4)&,1]),{x,-1,1}]

Centroid

Centroid[ineq[x,y],{x,y}]//Timing

FullSimplify[x(-Root[-1+(x^4)+((#1)^4)&,1]+Root[-1+(x^4)+((#1)^4)&,2]),-1<x<1]

FullSimplify[(-Root[-1+(x^4)+((#1)^4)&,1]+Root[-1+(x^4)+((#1)^4)&,2]),-1<x<1]

((Integrate[x ((((1-(x^4)))^(1/4))-Root[-1+(x^4)+((#1)^4)&,1]),{x,-1,1}])/(Integrate[(((1-(x^4)))^(1/4))-Root[-1+(x^4)+((#1)^4)&,1],{x,-1,1}]))

Curvature

SortBy[FullSimplify[Curvature[x^4+y^4-r^4,{x,y}]],ByteCount]

RadiiOfGyration

Assuming[a>0&&b>0,FullSimplify[RadiiOfGyration[ineq[x,y],{x,y}]]]//Timing

Slope

Slope[x^4+y^4==r^4,{x,y}]//FullSimplify

SpecialAffineCurvature

Tangential Angle

Gusati Definition

TimeConstrained[Solve[s (x^2)(y^2)-((x^2)+(y^2))+1==x^4+y^4-1,s],300]//Timing

g1=ContourPlot[Evaluate[(# (x^2)(y^2)-((x^2)+(y^2))+1==0)&/@Range[0,1,.2]],{x,-1.01,1.01},{y,-1.01,1.01},ContourStyle->{Red,Orange,Yellow,Green,Blue,Purple},Frame->False,Axes->True,Ticks->None]

g2=ContourPlot[Evaluate[(# (x^2)(y^2)-((x^2)+(y^2))+1==0)&/@Range[0,1,.2]],{x,-5,5},{y,-5,5},ContourStyle->{Red,Orange,Yellow,Green,Blue,Purple},Frame->False,Axes->True,Ticks->None]

GraphicsRow[{g1,g2}]

Properties

Inequality

ineq[x_,y_]:=(s^2)((x^2)/(k^2))((y^2)/(k^2))-(((x^2)/(k^2))+((y^2)/(k^2)))+1>=0

Arc Length Function

Arc Length

Solve[(s^2)((x^2)/(k^2))((y^2)/(k^2))-(((x^2)/(k^2))+((y^2)/(k^2)))+1==0,y]

FullSimplify[D[((Sqrt[-(k^2)+(x^2)])/(Sqrt[-1+(((s^2) (x^2))/(k^2))])),x]^2]

Assuming[0<s<1&&k>0,Integrate[(Sqrt[1+(((k^6) (((-1+(s^2)))^2) (x^2))/(((k^2)-(x^2)) ((((k^2)-(s^2) (x^2)))^3)))]),{x,0,k}]]

Area

Block[{s=.8,k=1},RegionPlot[(s^2)((x^2)/(k^2))((y^2)/(k^2))-(((x^2)/(k^2))+((y^2)/(k^2)))+1≥0,{x,-k,k},{y,-k,k},AspectRatio->Automatic]]

Block[{s=.8,k=1},RegionPlot[(s^2)((x^2)/(k^2))((y^2)/(k^2))-(((x^2)/(k^2))+((y^2)/(k^2)))+1≥0,{x,-5,5},{y,-5,5},AspectRatio->Automatic]]

Assuming[k>0&&0<s<1,FullSimplify[Integrate[Boole[ineq[x,y]],{x,-k,k},{y,-k,k}]]]//Timing

Limit[((4 EllipticE[ArcSin[s],(1/(s^2))])/s),s->#]&/@{0,1}

Plot[((4 EllipticE[ArcSin[s],(1/(s^2))])/s),{s,-1,1},WorkingPrecision->20]

((4 EllipticE[ArcSin[s],(1/(s^2))])/s)/.s->1`50*^-5

Limit[((4 EllipticE[ArcSin[s],(1/(s^2))])/s),s->0]

Limit[((4 EllipticE[ArcSin[s],(1/(s^2))])/s),s->0,Direction->#]&/@{-1,1}

Area Moment of Inertia

AreaInertiaTensor[{x,y}]

Assuming[k>0&&0<s<1,FullSimplify[Integrate[{{(y^2),-x y},{-x y,(x^2)}} Boole[ineq[x,y]],{x,-k,k},{y,-k,k}]]]//Timing

Centroid

Assuming[k>0&&0<s<1,Integrate[{x,y}Boole[ineq[x,y]],{x,-k,k},{y,-k,k}]]//Timing

Curvature

Assuming[{k>0&&0<s<1},SortBy[FullSimplify[Curvature[(s^2)((x^2)/(k^2))((y^2)/(k^2))-(((x^2)/(k^2))+((y^2)/(k^2)))+1,{x,y}]],ByteCount]]

RadiiOfGyration

Assuming[a>0&&b>0,FullSimplify[RadiiOfGyration[ineq[x,y],{x,y}]]]//Timing

Slope

Slope[s x^2/k^2 y^2/k^2-(x^2/k^2+y^2/k^2)+1==0,{x,y}]//FullSimplify

ByteCount/@%

SpecialAffineCurvature

Tangential Angle