# shiffman/The-Nature-of-Code

more math tests

1 parent f7d1de2 commit bf3266a8a638f86c9b8853c27e7ad6cd041f91e9 committed Jul 1, 2016
Showing with 7 additions and 104 deletions.
1. +4 −3 chapters/allmath.html
2. +1 −99 chapters/test.html
3. +1 −1 magicbook.json
4. +1 −1 package.json
 @@ -2,10 +2,11 @@

Math

-\vec{u} -\hat{u} -
$$w_x = u_x - v_x w_y = u_y - v_y$$
+

\vec{u}
+\hat{u}

+ +
w_x = u_x - v_x w_y = u_y - v_y
3 + 2 = 2 + 3
 @@ -1,105 +1,7 @@
-

Chapter 4. Particle Systems

-

More Math

-

This is inline 5 + 5 math. The next is a block math element.

+
\frac{1}{2}
-
10 + 10
- -
F_d = - \frac{1}{2}\rho\nu^2 A C_d\hat{u}
- -

Some code splitting

- -
-int neighbors = 0;
-
-// Top row of neighbors
-if (board[x-1][y-1] == 1) neighbors++;
-if (board[x  ][y-1] == 1) neighbors++;
-if (board[x+1][y-1] == 1) neighbors++;
-
-// Middle row of neighbors
-// (note we don’t count self)
-if (board[x-1][y]   == 1) neighbors++;
-if (board[x+1][y]   == 1) neighbors++;
-
-// Bottom row of neighbors
-if (board[x-1][y+1] == 1) neighbors++;
-if (board[x  ][y+1] == 1) neighbors++;
-if (board[x+1][y+1] == 1) neighbors++;
- -

paragraph between

- -
-//{!4 .offset} Separate ArrayLists for each animal
-ArrayList<Dog> dogs = new ArrayList<Dog>();
-ArrayList<Cat> cats = new ArrayList<Cat>();
-ArrayList<Turtle> turtles = new ArrayList<Turtle>();
-ArrayList<Kiwi> kiwis = new ArrayList<Kiwi>();
-
-for (int i = 0; i < 10; i++) {
-}
-for (int i = 0; i < 15; i++) {
-}
-for (int i = 0; i < 6; i++) {
-}
-for (int i = 0; i < 98; i++) {
-}
- - -
-// Ah, isn’t this main program so simple and lovely?
-ParticleSystem ps;
-
-void setup() {
-  size(640, 360);
-  ps = new ParticleSystem();
-}
-
-void draw() {
-  background(255);
-  ps.run();
-}
- -

more

- -
-void draw() {
-  background(100);
-
-  PVector gravity = new PVector(0, 0.1);
-  //{!1} Applying a force to the system as a whole
-  ps.applyForce(gravity);
-  ps.run();
-}
- -
-class Particle extends VerletParticle2D {
-
-  float r;
-
-  Particle (Vec2D loc) {
-    super(loc);
-    r = 4;
-    //{!1 .offset}  Every time a Particle is made, an AttractionBehavior is
-    // generated and added to the physics world.
-    // Note that when the strength
-    // is negative, it’s a repulsive force!
-  }
-
-  void display () {
-    fill (255);
-    stroke (255);
-    ellipse (x, y, r*2, r*2);
-  }
-}
 @@ -2,7 +2,7 @@ "title":"The Nature of Code", "destination":"build/:build", "files":[ - "chapters/01_vectors.html" + "chapters/test.html" ], "addPlugins":[ "magicbook-codesplit",
 @@ -1,6 +1,6 @@ { "dependencies": { "magicbook-codesplit": "0.1.2", - "magicbook-katex": "0.0.3" + "magicbook-katex": "0.0.4" } }