The Python code shown in your forum link handles the minutiae of setting up grids/meshes for 3D plots and converting spherical and cylindrical coordinates to rectangular. This is unnecessary in Maple; the **plot3d** command handles that in the background.

(* Original Python code:
from matplotlib import pyplot as plt
from math import sqrt, pi, cos, sin
import numpy as np
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
t_grid = np.linspace(-1 - sqrt(7), -1 + sqrt(7), 50)
s_grid = np.linspace(-1, 1, 50)
T, S = np.meshgrid(t_grid, s_grid)
theta_fun = lambda t, s: 0.2 * pi * (t + 1 + sqrt(7)) / sqrt(7) - 0.4 * pi + 0.1
phi_fun = lambda t, s: pi * s / (4 * sqrt(2)) * sqrt(max(2 - t ** 2 / abs(t - 3), 0))
for k in range(1, 16):
phi0 = 0.4 * pi * k
r = 14 - 0.8 * k
x_fun = lambda t, s: r * cos(phi0 + phi_fun(t, s)) * cos(theta_fun(t, s))
y_fun = lambda t, s: r * sin(phi0 + phi_fun(t, s)) * cos(theta_fun(t, s))
z_fun = lambda t, s: r * sin(theta_fun(t, s))
X = np.array(list(map(x_fun, T.flatten(), S.flatten()))).reshape((50, 50))
Y = np.array(list(map(y_fun, T.flatten(), S.flatten()))).reshape((50, 50))
Z = np.array(list(map(z_fun, T.flatten(), S.flatten()))).reshape((50, 50))
ax.plot_surface(X, Y, Z, cmap='Reds')
z = np.linspace(-25, -10, 50)
p = np.linspace(0, 2 * pi, 50)
Z, P = np.meshgrid(z, p)
X = np.cos(P)
Y = np.sin(P)
ax.plot_surface(X, Y, Z, cmap='Greens')
ax.set_box_aspect(aspect=(1, 1, 1.5))
*)

The original author plotted the petals using a nonstandard form of spherical coordinates that has the **cos(theta)** and **sin(theta)** exchanged, where **theta** is the altitude angle. I adjusted this to standard spherical coordinates by replacing **theta **with **Pi/2 - theta**. The original stem was done using standard **cylindrical **coordinates.

I don't know the exact details of the Python coloring function **cmap**. I made an approximation using plot option **colorscheme **and the **ColorTools **package.

For the **lightmodel**, I simply chose what looked best to me from the very limited choices (five) Maple offers. I chose an **orientation **that looked good to me.

My algebraic formulas are *mathematically* equivalent to the Python; however, I simplified them, so they're not *syntactically* identical. If Python has some difference between **math.sin** and **numpy.sin** (likewise for **cos**), I don't know what it is. The original author used both (perhaps unintentionally).

Surprisingly, Maple has no plot option equivalent to **aspect**, so I used **plottools:-scale**, which will do essentially the same thing provided that the options **axes= none** and **scaling= constrained** are used and that one doesn't care about the actual numerical values stored in the plot.

**#Maple translation:**
**cmap:= C-> colorscheme= ([ColorTools:-Lighten, ColorTools:-Darken] @@~ 2)(C):
aspect:= (S::And(list(realcons), 3 &under nops))-> (P::specfunc(PLOT3D))->
plots:-display(plottools:-scale(P, S[]), 'axes'= 'none', 'scaling'= 'constrained')
:
k:= [$1..16]:
(aspect([1, 1, 3/2]) @ plots:-display)(
plot3d(
`[]`~(
14 -~ 4/5*~k,
Pi*~(2/5*~k +~ s*sqrt(max(2 - t^2/abs(t-3), 0)/32)),
(Pi*(7 - 2/sqrt(7)*(t+1)) - 1)/10
),**
**t= -1-sqrt(7)..-1+sqrt(7), s= -1..1, coords= spherical, cmap("Red")
),
plot3d(1, theta= 0..2*Pi, z= -25..-10, coords= cylindrical, cmap("Green")),
style= surface, lightmodel= light4, orientation= [49, 52, 27]
);**