# Superformula

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Superformula
> Markdown URL: https://mediated.wiki/source/Superformula.md
> Source: https://en.wikipedia.org/wiki/Superformula
> Source revision: 1305278571
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

Equation in polar coordinates

This article is about a generalization of the superellipse. For the Japanese formula racing series, see [Super Formula Championship](/source/Super_Formula_Championship).

The **superformula** is a generalization of the [superellipse](/source/Superellipse) and was proposed by [Johan Gielis](/source/Johan_Gielis_(Mathematician)) in 2003.[1] Gielis suggested that the formula can be used to describe many complex shapes and curves that are found in nature. Gielis has filed a patent application related to the synthesis of patterns generated by the superformula, which expired effective 2020-05-10.[2]

In [polar coordinates](/source/Polar_coordinates), with r {\displaystyle r} the radius and φ {\displaystyle \varphi } the angle, the superformula is:

r ( φ ) = ( | cos ⁡ ( m φ 4 ) a | n 2 + | sin ⁡ ( m φ 4 ) b | n 3 ) − 1 n 1 . {\displaystyle r\left(\varphi \right)=\left(\left|{\frac {\cos \left({\frac {m\varphi }{4}}\right)}{a}}\right|^{n_{2}}+\left|{\frac {\sin \left({\frac {m\varphi }{4}}\right)}{b}}\right|^{n_{3}}\right)^{-{\frac {1}{n_{1}}}}.} By choosing different values for the parameters a , b , m , n 1 , n 2 , {\displaystyle a,b,m,n_{1},n_{2},} and n 3 , {\displaystyle n_{3},} different shapes can be generated.

The formula was obtained by generalizing the superellipse, named and popularized by [Piet Hein](/source/Piet_Hein_(scientist)), a [Danish](/source/Denmark) [mathematician](/source/Mathematician).

## 2D plots

In the following examples the values shown above each figure should be *m*, *n*1, *n*2 and *n*3.

A [GNU Octave](/source/GNU_Octave) program for generating these figures

function sf2d(n, a)
  u = [0:.001:2 * pi];
  raux = abs(1 / a(1) .* abs(cos(n(1) * u / 4))) .^ n(3) + abs(1 / a(2) .* abs(sin(n(1) * u / 4))) .^ n(4);
  r = abs(raux) .^ (- 1 / n(2));
  x = r .* cos(u);
  y = r .* sin(u);
  plot(x, y);
end

## Extension to higher dimensions

It is possible to extend the formula to 3, 4, or *n* dimensions, by means of the [spherical product](/source/Spherical_product) of superformulas. For example, the [3D](/source/Dimension) [parametric surface](/source/Parametric_surface) is obtained by multiplying two superformulas *r*1 and *r*2. The coordinates are defined by the relations:

x = r 1 ( θ ) cos ⁡ θ ⋅ r 2 ( ϕ ) cos ⁡ ϕ , {\displaystyle x=r_{1}(\theta )\cos \theta \cdot r_{2}(\phi )\cos \phi ,} y = r 1 ( θ ) sin ⁡ θ ⋅ r 2 ( ϕ ) cos ⁡ ϕ , {\displaystyle y=r_{1}(\theta )\sin \theta \cdot r_{2}(\phi )\cos \phi ,} z = r 2 ( ϕ ) sin ⁡ ϕ , {\displaystyle z=r_{2}(\phi )\sin \phi ,}

where ϕ {\displaystyle \phi } ([latitude](/source/Latitude)) varies between −*π*/2 and *π*/2 and *θ* ([longitude](/source/Longitude)) between −*π* and *π*.

## 3D plots

3D superformula: *a* = *b* = 1; *m*, *n*1, *n*2 and *n*3 are shown in the pictures.

A [GNU Octave](/source/GNU_Octave) program for generating these figures:

function sf3d(n, a)
  u = [- pi:.05:pi];
  v = [- pi / 2:.05:pi / 2];
  nu = length(u);
  nv = length(v);
  for i = 1:nu
    for j = 1:nv
      raux1 = abs(1 / a(1) * abs(cos(n(1) .* u(i) / 4))) .^ n(3) + abs(1 / a(2) * abs(sin(n(1) * u(i) / 4))) .^ n(4);
      r1 = abs(raux1) .^ (- 1 / n(2));
      raux2 = abs(1 / a(1) * abs(cos(n(1) * v(j) / 4))) .^ n(3) + abs(1 / a(2) * abs(sin(n(1) * v(j) / 4))) .^ n(4);
      r2 = abs(raux2) .^ (- 1 / n(2));
      x(i, j) = r1 * cos(u(i)) * r2 * cos(v(j));
      y(i, j) = r1 * sin(u(i)) * r2 * cos(v(j));
      z(i, j) = r2 * sin(v(j));
    endfor;
  endfor;
  mesh(x, y, z);
endfunction;

## Generalization

The superformula can be generalized by allowing distinct *m* parameters in the two terms of the superformula. By replacing the first parameter m {\displaystyle m} with *y* and second parameter m {\displaystyle m} with *z*:[3] r ( φ ) = ( | cos ⁡ ( y φ 4 ) a | n 2 + | sin ⁡ ( z φ 4 ) b | n 3 ) − 1 n 1 {\displaystyle r\left(\varphi \right)=\left(\left|{\frac {\cos \left({\frac {y\varphi }{4}}\right)}{a}}\right|^{n_{2}}+\left|{\frac {\sin \left({\frac {z\varphi }{4}}\right)}{b}}\right|^{n_{3}}\right)^{-{\frac {1}{n_{1}}}}}

This allows the creation of rotationally asymmetric and nested structures. In the following examples a, b, n 2 {\displaystyle {n_{2}}} and n 3 {\displaystyle {n_{3}}} are 1:

## References

1. **[^](#cite_ref-1)** Gielis, Johan (2003), ["A generic geometric transformation that unifies a wide range of natural and abstract shapes"](https://bsapubs.onlinelibrary.wiley.com/doi/10.3732/ajb.90.3.333), *[American Journal of Botany](/source/American_Journal_of_Botany)*, **90** (3): 333–338, [doi](/source/Doi_(identifier)):[10.3732/ajb.90.3.333](https://doi.org/10.3732%2Fajb.90.3.333), [ISSN](/source/ISSN_(identifier)) [0002-9122](https://search.worldcat.org/issn/0002-9122), [PMID](/source/PMID_(identifier)) [21659124](https://pubmed.ncbi.nlm.nih.gov/21659124)

1. **[^](#cite_ref-2)** [EP patent 1177529](https://worldwide.espacenet.com/textdoc?DB=EPODOC&IDX=EP1177529), Gielis, Johan, "Method and apparatus for synthesizing patterns", issued 2005-02-02

1. **[^](#cite_ref-3)** * Stöhr, Uwe (2004), [*SuperformulaU*](https://web.archive.org/web/20171208231427/http://ftp.lyx.de/Lectures/SuperformulaU.pdf) (PDF), archived from [the original](http://ftp.lyx.de/Lectures/SuperformulaU.pdf) (PDF) on December 8, 2017

## External links

Wikimedia Commons has media related to [Superformula](https://commons.wikimedia.org/wiki/Category:Superformula).

- [Some Experiments on Fitting of Gielis Curves by Simulated Annealing and Particle Swarm Methods of Global Optimization](http://ssrn.com/abstract=913667)

- [Least Squares Fitting of Chacón-Gielis Curves By the Particle Swarm Method of Optimization](http://ssrn.com/abstract=917762)

- [Superformula 2D Plotter & SVG Generator](http://www.perbang.dk/superformula/)

- [Interactive example using JSXGraph](http://jsxgraph.uni-bayreuth.de/wiki/index.php/Superformula)

- [SuperShaper: An OpenSource, OpenCL accelerated, interactive 3D SuperShape generator with shader based visualisation (OpenGL3)](https://sourceforge.net/projects/supershaper)

---
Adapted from the Wikipedia article [Superformula](https://en.wikipedia.org/wiki/Superformula) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Superformula?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
