Superformula definition:
r\left(\theta\right) =
\left(
\left|
\frac{\cos\left(\frac{m\theta}{4}\right)}{a}
\right| ^{n_2}
+
\left|
\frac{\sin\left(\frac{m\theta}{4}\right)}{b}
\right| ^{n_3}
\right) ^{-\frac{1}{n_{1}}}Curvature definition:
{\kappa (\theta )={\frac {\left|r^{2}+2{r'}^{2}-r\,r''\right|}{\left(r^{2}+{r'}^{2}\right)^{\frac {3}{2}}}}}In order to minimize the total curvature of the entire curve, let's minimize the definite integral of the curvature function over the range of 0 to 2 PI, subject to the constraint that the curvature is non-negative and that the integral is less than or equal to 1 (the maximum curvature of a superformula when m = n = 1).
\int_{0}^{2\pi} {\kappa (\theta )} d\theta > 0
((abs(cos(t))^4) + (abs(sin(t))^4))^(-1/n1)
r(t) = 1/((\left|\cos\left(t\right)\right|^4) + (\left|\sin\left(t\right)\right|^4))^{\frac{1}{4}}-(4cos(t)sin(t)^3-4cos(t)^3sin(t))/((sin(t)^4+cos(t)^4)^(1/n1)(n1sin(t)^4+n1*cos(t)^4))
r'(t) = -\frac{4\cos\left(t\right)\sin\left(t\right)^3-4\cos\left(t\right)^3\sin\left(t\right)}{\left(\sin\left(t\right)^4+\cos\left(t\right)^4\right)^{\frac{1}{4}}\left(n_{1}\sin\left(t\right)^4+n_{1}\cos\left(t\right)^4\right)}(4n1sin(t)^8+(16-8n1)cos(t)^2sin(t)^6+((-24n1)-32)cos(t)^4sin(t)^4+(16-8n1)cos(t)^6sin(t)^2+4n1cos(t)^8)/((sin(t)^4+cos(t)^4)^(1/n1)(n1^2sin(t)^8+2n1^2cos(t)^4sin(t)^4+n1^2*cos(t)^8))
ORIGINAL abs((((abs(c)^4) + (abs(s)^4))^(-1/n1))^2+2*(-(4cs^3-4c^3s)/((s^4+c^4)^(1/n1)(n1s^4+n1c^4)))^2-(((abs(c)^4) + (abs(s)^4))^(-1/n1))((4n1s^8+(16-8n1)c^2s^6+((-24n1)-32)c^4s^4+(16-8n1)c^6s^2+4n1c^8)/((s^4+c^4)^(1/n1)(n1^2s^8+2n1^2c^4s^4+n1^2c^8))))/((((abs(c)^4) + (abs(s)^4))^(-1/n1))^2 + (-(4cs^3-4c^3s)/((s^4+c^4)^(1/n1)(n1s^4+n1c^4)))^2)^1.5
Simplified ((s^4+c^4)^(1/n)(ns^4+c^4n)abs((n^2-4n)s^8+(8c^2n+16c^2)s^6+(2c^4n^2+24c^4n-32c^4)s^4+(8c^6n+16c^6)s^2+c^8n^2-4c^8n))/(n^2s^8+16c^2s^6+(2c^4n^2-32c^4)s^4+16c^6s^2+c^8*n^2)^(3/2)
cos/sin back ((sin(t)^4+cos(t)^4)^(1/n1)(n1sin(t)^4+cos(t)^4n1)abs((n1^2-4n1)sin(t)^8+(8cos(t)^2n1+16cos(t)^2)sin(t)^6+(2cos(t)^4n1^2+24cos(t)^4n1-32cos(t)^4)sin(t)^4+(8cos(t)^6n1+16cos(t)^6)sin(t)^2+cos(t)^8n1^2-4cos(t)^8n1))/(n1^2sin(t)^8+16cos(t)^2sin(t)^6+(2cos(t)^4n1^2-32cos(t)^4)sin(t)^4+16cos(t)^6sin(t)^2+cos(t)^8*n1^2)^(3/2)
Solve simplified for n (discard negative root)
n1 = (2sqrt(s^16-8c^2s^14+8c^6s^10+62c^8s^8+8c^10s^6-8c^14s^2+c^16)+2s^8-4c^2s^6-12c^4s^4-4c^6s^2+2c^8)/(s^8+2c^4*s^4+c^8)
n1 = (2Math.sqrt(s**16-8c2*s14+8c**6s10+62*c8s**8+8c10*s6-8c**14s2+c16)+2s**8-4c2*s6-12c**4s4-4*c6s**2+2c8)/(s8+2c**4s4+c8)