Merge pull request #561 from nature-of-code/notion-update-docs

[Notion] Update docs
This commit is contained in:
Daniel Shiffman 2023-11-11 14:56:42 -05:00 committed by GitHub
commit 9299f66b4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 5 additions and 12 deletions

View file

@ -934,7 +934,7 @@ function draw() {
<p>To begin, while its so far been helpful to have separate <code>Mover</code> and <code>Attractor</code> classes, this distinction is actually a bit misleading. After all, according to Newtons third law, all forces occur in pairs: if an attractor attracts a mover, then that mover should also attract the attractor. Instead of two different classes here, what I really want is a single type of thing—called, for example, a <code>Body</code>—with every body attracting every other body.</p>
<p>The scenario being described here is commonly referred to as the <span data-type="equation">n</span><strong>-body problem</strong>. It involves solving for the motion of a group of objects that interact via gravitational forces. The <em>two</em>-body problem is a famously “solved” problem, meaning the motions can be precisely computed with mathematical equations when only two bodies are involved. However, adding one more body turns the <em>two</em>-body problem into a <em>three</em>-body problem, and suddenly no formal solution exists (see Figure 2.10).</p>
<figure>
<img src="images/02_forces/02_forces_11.jpg" alt="Figure 2.10 Example paths of the two-body (predictable) vs. three-body (complex) problems">
<img src="images/02_forces/02_forces_11.png" alt="Figure 2.10 Example paths of the two-body (predictable) vs. three-body (complex) problems">
<figcaption>Figure 2.10 Example paths of the two-body (predictable) vs. three-body (complex) problems</figcaption>
</figure>
<p>Although less accurate than using precise equations of motion, the examples built in this chapter can model both the two-body and three-body problems. To begin, Ill move the <code>attract()</code> method from the <code>Attractor</code> class into the <code>Mover</code> class (which I will now call <code>Body</code>).</p>

View file

@ -899,14 +899,7 @@ function draw() {
<p>Instead of using <em>linear</em> acceleration and velocity, Im going to describe the motion of the pendulum in terms of <em>angular</em> acceleration and <em>angular </em>velocity, which refer to the change of the arms angle <span data-type="equation">\theta</span> relative to the pendulums resting position. I should first warn you, especially if youre a seasoned physicist, that Im going to conveniently ignore several important concepts here: conservation of energy, momentum, centripetal force, and more. This isnt intended to be a comprehensive description of pendulum physics. My goal is to offer you an opportunity to practice your new skills in trigonometry and further explore the relationship between forces and angles through a concrete example.</p>
<p>To actually calculate the pendulums angular acceleration, Im going to use Newtons second law of motion, but with a little trigonometric twist. Take a look back at Figure 3.16 and tilt your head so that the pendulums arm becomes the vertical axis. The force of gravity suddenly points askew, a little to the left—its at an angle with respect to your tilted head. If this is starting to hurt your neck, dont worry. Ill redraw the tilted figure and relabel the forces <span data-type="equation">F_g</span> for gravity and <span data-type="equation">T</span> for tension (FIgure 3.17, left).</p>
<figure>
<div class="col-list">
<div>
<img src="images/03_oscillation/03_oscillation_17.png" alt="Figure 3.17: On the left, the pendulum is drawn rotated so that the arm is the y-axis. The right shows F_g zoomed in and divided into components F_{gx} and F_{gy}.">
</div>
<div>
<img src="images/03_oscillation/03_oscillation_18.png" alt="">
</div>
</div>
<img src="images/03_oscillation/03_oscillation_17.png" alt="Figure 3.17: On the left, the pendulum is drawn rotated so that the arm is the y-axis. The right shows F_g zoomed in and divided into components F_{gx} and F_{gy}.">
<figcaption>Figure 3.17: On the left, the pendulum is drawn rotated so that the arm is the y-axis. The right shows <span data-type="equation">F_g</span> zoomed in and divided into components <span data-type="equation">F_{gx}</span> and <span data-type="equation">F_{gy}</span>.</figcaption>
</figure>
<p>Lets now take the force of gravity and divide its vector into <span data-type="equation">x</span> and <span data-type="equation">y</span> components, with the arm as the new y-axis<em>.</em> These comonents form a right triangle, with the force of gravity as the hypotenuse (Figure 3.16, right). Ill call them <span data-type="equation">F_{gx}</span> and <span data-type="equation">F_{gy}</span>, but what do these components mean? Well, the <span data-type="equation">F_{gy}</span> component represents the force thats opposite to <span data-type="equation">T</span>, the tension force. Remember, the tension force is what keeps the bob from falling off.</p>
@ -917,7 +910,7 @@ function draw() {
<div data-type="equation">F_{gx} = F_g \times \sin(\theta)</div>
<p>Ill now rename this force <span data-type="equation">F_p</span> for “force of the pendulum.” In Figure 3.18, Ive restored the diagram to its original orientation and relabeled the components. Ive also moved the starting point of <span data-type="equation">F_p</span> from the bottom of the right triangle to the bobs center, to clarify how this force moves the bob.</p>
<figure>
<img src="images/03_oscillation/03_oscillation_19.png" alt="Figure 3.18: F_{gx} is now labeled F_p, the net force in the direction of motion.">
<img src="images/03_oscillation/03_oscillation_18.png" alt="Figure 3.18: F_{gx} is now labeled F_p, the net force in the direction of motion.">
<figcaption>Figure 3.18: <span data-type="equation">F_{gx}</span> is now labeled <span data-type="equation">F_p</span>, the net force in the direction of motion.</figcaption>
</figure>
<p>There it is. The net force of the pendulum that causes the rotation is calculated as follows:</p>
@ -971,7 +964,7 @@ function draw() {
<p>Note that the acceleration calculation now includes a multiplication by 1. When the pendulum is to the right of its resting position, the angle is positive, and so the sine of the angle is also positive. However, gravity should “pull” the bob back toward the resting position. Conversely, when the pendulum is to the left of its resting position, the angle is negative, and so its sine is negative, too. In this case, the pulling force should be positive. Multiplying by 1 is necessary in both scenarios.</p>
<div class="half-width-right">
<figure>
<img src="images/03_oscillation/03_oscillation_20.png" alt="Figure 3.19: A diagram showing the bob position relative to the pivot in polar and Cartesian coordinates">
<img src="images/03_oscillation/03_oscillation_19.png" alt="Figure 3.19: A diagram showing the bob position relative to the pivot in polar and Cartesian coordinates">
<figcaption>Figure 3.19: A diagram showing the bob position relative to the pivot in polar and Cartesian coordinates</figcaption>
</figure>
</div>
@ -1066,7 +1059,7 @@ function draw() {
<h3 id="exercise-316">Exercise 3.16</h3>
<div class="half-width-right">
<figure>
<img src="images/03_oscillation/03_oscillation_21.png" alt="">
<img src="images/03_oscillation/03_oscillation_20.png" alt="">
<figcaption></figcaption>
</figure>
</div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 KiB

After

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 KiB

After

Width:  |  Height:  |  Size: 192 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 159 KiB

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 KiB

After

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 247 KiB

After

Width:  |  Height:  |  Size: 238 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 KiB

After

Width:  |  Height:  |  Size: 251 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 167 KiB

After

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 591 KiB

After

Width:  |  Height:  |  Size: 917 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3 MiB

After

Width:  |  Height:  |  Size: 334 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 MiB

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 KiB

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 336 KiB

After

Width:  |  Height:  |  Size: 328 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 166 KiB

After

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 610 KiB

After

Width:  |  Height:  |  Size: 590 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 235 KiB

After

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 375 KiB

After

Width:  |  Height:  |  Size: 380 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 471 KiB

After

Width:  |  Height:  |  Size: 469 KiB