<p>The <code>R</code> part generates a cone where the point is at (0, 0, 1) and it spreads out below that. It meets the x-y plane at the unit circle:</p>

<p><a href="https://i.sstatic.net/jtZdE.png" rel="noreferrer"><img src="https://i.sstatic.net/jtZdE.png" alt="A cone with the point at (0, 0, 1) and spreading out downward"></a></p>

<p>The <code>cos</code> component defines an extruded cosine wave along the X-axis:</p>

<p><a href="https://i.sstatic.net/dsszO.png" rel="noreferrer"><img src="https://i.sstatic.net/dsszO.png" alt="The graph of cos(2*π*x)"></a></p>

<p>So the final equation takes the cosine wave and multiplies its amplitude by the cone. It will have full amplitude at the origin, and decrease to 0 at the unit circle on the x-y plane. Past that it becomes negative:</p>

<p><a href="https://i.sstatic.net/EviPs.png" rel="noreferrer"><img src="https://i.sstatic.net/EviPs.png" alt="Multiplying the second equation by the first"></a></p>

<p>The <code>phi</code> component shifts the sine wave forward or backward along the x axis.</p>

CC BY-SA 4.0
2019-10-14T18:30:55.167Z
2019-10-14T18:30:55.167Z
user1118321
<p>This is a screen shot from an animation generated by <a href="https://matplotlib.org/1.2.1/examples/mplot3d/wire3d_animation_demo.html" rel="nofollow noreferrer">a matplotlib example</a></p>

<p><a href="https://i.sstatic.net/JbI9h.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/JbI9h.png" alt="enter image description here"></a></p>

<p>the key part in the code is </p>

<pre><code>    R = 1 - np.sqrt(X**2 + Y**2)
    Z = np.cos(2 * np.pi * X + phi) * R
</code></pre>

<p>corresponding equation is</p>

<p><span class="math-container">$\left(- \sqrt{X^{2} + Y^{2}} + 1\right) \cos{\left (2 \pi X + \phi \right )}$</span></p>

<p>Could some give an explanation or hint about this kind of equation?</p>

<p>Is there a name of this type of graphics?</p>

<p>usually cosine/sine could generate something like a (half) circle, what does <code>R</code> part do?</p>

<3d>
Could some give an explanation or hint about this kind of equation? $\left(- \sqrt{X^{2} + Y^{2}} + 1\right) \cos{\left (2 \pi X + \phi \right )}$
JJJohn
# Could some give an explanation or hint about this kind of equation? $\left(- \sqrt{X^{2} + Y^{2}} + 1\right) \cos{\left (2 \pi X + \phi \right )}$

(Asked by: username_0 on 2019-10-14)

This is a screen shot from an animation generated by [a matplotlib example](https://matplotlib.org/1.2.1/examples/mplot3d/wire3d_animation_demo.html)

[![enter image description here](https://i.sstatic.net/JbI9h.png)](https://i.sstatic.net/JbI9h.png)

the key part in the code is

```
    R = 1 - np.sqrt(X**2 + Y**2)
    Z = np.cos(2 * np.pi * X + phi) * R

```

corresponding equation is

$\left(- \sqrt{X^{2} + Y^{2}} + 1\right) \cos{\left (2 \pi X + \phi \right )}$

Could some give an explanation or hint about this kind of equation?

Is there a name of this type of graphics?

usually cosine/sine could generate something like a (half) circle, what does `R` part do?

**Tags:** 3d


---

## 1 answers

### Answer by username_1 on 2019-10-14. Score: 6 | Accepted answer

The `R` part generates a cone where the point is at (0, 0, 1) and it spreads out below that. It meets the x-y plane at the unit circle:

[![A cone with the point at (0, 0, 1) and spreading out downward](https://i.sstatic.net/jtZdE.png)](https://i.sstatic.net/jtZdE.png)

The `cos` component defines an extruded cosine wave along the X-axis:

[![The graph of cos(2*π*x)](https://i.sstatic.net/dsszO.png)](https://i.sstatic.net/dsszO.png)

So the final equation takes the cosine wave and multiplies its amplitude by the cone. It will have full amplitude at the origin, and decrease to 0 at the unit circle on the x-y plane. Past that it becomes negative:

[![Multiplying the second equation by the first](https://i.sstatic.net/EviPs.png)](https://i.sstatic.net/EviPs.png)

The `phi` component shifts the sine wave forward or backward along the x axis.


---

