# Mathematically is it possible to create a function that represents a shape. Such as a cube or sphere?

Like utilizing vectors, calculus, differential equations? Is it possible, i am specifically looking at cube or sphere as i know a cone can be easily created by rotating a simple function around the y axis by 2(pi) creating a cone but how would one create a function for a sphere or cube?

• Why couldn't you rotate a circle around the y-axis? – Zestylemonzi Nov 27 '16 at 19:48
• You want the domain to be a subset of $\mathbb{R}$? – Vitor Borges Nov 27 '16 at 19:55
• How about sweeping out a volume by translating a square in the $xy$-plane along the $z$ axis? – user137731 Nov 27 '16 at 20:06
• but how would one do this? – Curios and Knowledgeable Nov 27 '16 at 20:07

A sphere can be defined parametrically as follows:

$$(r \cos θ_1 \cosθ_2, r\cos θ_1 \sinθ_2,r\sin θ_1)$$ for $0 ≤ θ_1, θ_2 < 2 π$ where $r$ is the radius of the sphere.

Alternatively, as mentioned by Zestylemonzi, you could rotate the function $y = \sqrt{r^2 - x^2}$ across the x-axis, again where $r$ is the radius of the sphere.

A cube is a little more tricky as it cannot be described by a single function (to my knowledge). However, the three-dimensional region where $0 ≤ x, y, z ≤ s$, where $s$ is the side length of the cube seems to fit the conditions of the problem.

You want to generate a surface area.

Like the cone choose a circle centered on y axis and rotate it around y axis to form a sphere.

To form one of 6 faces of a cube length $2$ define that by varying $x,y,z$ as

$$x=1 \, , (-1<y< 1),\, (-1<z< 1)\,.$$

In Mathematica

ParametricPlot3D[ {1, y, z}, {y, -1, 1}, {z, -1, 1}]