Update 2: Using tr
with ContourPlot
and ContourPlot3D
:
ClearAll[tr]
tr[n_] := (2 n^2 + (-1)^n)/4;
ContourPlot[Evaluate[(x - tr[#])^2 + y^2 == #^2 & /@ Range[10]],
{x, -1, 65}, {y, -10, 10},
AspectRatio -> Automatic, PlotRange -> {{-1, 65}, {-15, 15}}, Frame -> False]
ContourPlot3D[Evaluate[(x - tr[#])^2 + y^2 + z^2 == #^2 & /@ Range[10]],
{x, -1, 65}, {y, -10, 10}, {z, -15, 15},
Mesh -> None,
ContourStyle -> Opacity[.5], BoxRatios -> Automatic,
PlotRange -> {{-1, 65}, {-15, 15}, {-15, 15}}, ViewPoint -> Front,
Boxed -> False, Axes -> False , PlotPoints -> 60]
Update: To generate a list of spheres similar to the circles in OP (sphere k
just touching sphere k-2
):
ClearAll[tr]
tr[n_] := (2 n^2 + (-1)^n)/4;
Graphics[Circle[{tr @ #, 0}, #] & /@ Range[10]]
Graphics3D[{Opacity[.5], Sphere[{tr @ #, 0, 0}, #] & /@ Range[10]}, Boxed -> False]
Original answer:
You can use Translate
and Scale
Sphere[]
as follows:
radii = Range[5];
Graphics3D[Translate[Scale[Sphere[], #], {#^2, 0, 0}] & /@ radii]
or translate to leave gaps between spheres:
translations = 2 Accumulate[radii];
Graphics3D[MapThread[Translate[Scale[Sphere[], #], {#2, 0, 0}] &, {radii, translations}]]