Permalink
Browse files

more math tests

  • Loading branch information...
1 parent f7d1de2 commit bf3266a8a638f86c9b8853c27e7ad6cd041f91e9 @shiffman 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 @@
<h2>Math</h2>
-<span data-type="equation">\vec{u}</span>
-<span data-type="equation">\hat{u}</span>
-<div data-type="equation">\begin{equation}w_x = u_x - v_x w_y = u_y - v_y\end{equation}</div>
+<p><span data-type="equation">\vec{u}</span><br/>
+<span data-type="equation">\hat{u}</span></p>
+
+<div data-type="equation">w_x = u_x - v_x w_y = u_y - v_y</div>
<div data-type="equation">3 + 2 = 2 + 3</div>
View
@@ -1,105 +1,7 @@
<section data-type="chapter" id="test">
-<h1>Chapter 4. Particle Systems</h1>
-<h2>More Math</h2>
-<p>This is inline <span data-type="equation">5 + 5</span> math. The next is a block math element.</p>
+<div data-type="equation">\frac{1}{2}</div>
-<div data-type="equation">10 + 10</div>
-
-<div data-type="equation">F_d = - \frac{1}{2}\rho\nu^2 A C_d\hat{u}</div>
-
-<h2>Some code splitting</h2>
-
-<pre data-code-language="java" data-type="programlisting" class="codesplit">
-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++;</pre>
-
-<p>paragraph between</p>
-
-<pre data-code-language="java" data-type="programlisting" class="codesplit">
-//{!4 .offset} Separate ArrayLists for each animal
-ArrayList&lt;Dog&gt; dogs = new ArrayList&lt;Dog&gt;();
-ArrayList&lt;Cat&gt; cats = new ArrayList&lt;Cat&gt;();
-ArrayList&lt;Turtle&gt; turtles = new ArrayList&lt;Turtle&gt;();
-ArrayList&lt;Kiwi&gt; kiwis = new ArrayList&lt;Kiwi&gt;();
-
-for (int i = 0; i &lt; 10; i++) {
- dogs.add(new Dog());
-}
-for (int i = 0; i &lt; 15; i++) {
- cats.add(new Cat());
-}
-for (int i = 0; i &lt; 6; i++) {
- turtles.add(new Turtle());
-}
-for (int i = 0; i &lt; 98; i++) {
- kiwis.add(new Kiwi());
-}</pre>
-
-
-<pre data-code-language="java" data-type="programlisting" class="codesplit">
-// 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();
-}</pre>
-
-<p>more</p>
-
-<pre data-code-language="java" data-type="programlisting" class="codesplit">
-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.addParticle();
- ps.run();
-}</pre>
-
-<pre data-code-language="java" data-type="programlisting" class="codesplit">
-class Particle extends VerletParticle2D {
-
- //{!1} Add a radius to every Particle.
- 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!
- physics.addBehavior(new AttractionBehavior(this, r*4, -1));
- }
-
- void display () {
- fill (255);
- stroke (255);
- ellipse (x, y, r*2, r*2);
- }
-}</pre>
</section>
View
@@ -2,7 +2,7 @@
"title":"The Nature of Code",
"destination":"build/:build",
"files":[
- "chapters/01_vectors.html"
+ "chapters/test.html"
],
"addPlugins":[
"magicbook-codesplit",
View
@@ -1,6 +1,6 @@
{
"dependencies": {
"magicbook-codesplit": "0.1.2",
- "magicbook-katex": "0.0.3"
+ "magicbook-katex": "0.0.4"
}
}

0 comments on commit bf3266a

Please sign in to comment.