Test Counting With Method

We want to count how many times this page appears in the lineup. The question is, how to initialize the count.

The Count So Far 1 More for Here SUM The Count So Far

Now, building on this technique we imagine a cartesian space defined by floor tiles and try to dance one step at a time in a perfect circle.

10 North Tiles 10 West Tiles 0.6179 Twist Each Step

Question: What initial conditions would bring the dance around to the exact starting point in ten steps? What would make the circle round?

I try solving this experimentally in ruby.

ruby -e ' x=10; y=10; d=0.6179; 5.times { 10.times { x+=d*y; y-=d*x; puts "#{x} #{y} #{x*x+y*y}" } puts } '

I print r2 with each iteration. I'm hoping for a constant 200.

See Surprising Stability where I have explored this computation before with much smaller steps.

.

It turns out the essential magic of turtle graphics is a state machine and basic trigonometry, especially the unit circle. Given the turtle knows its own position and orientation, its next step is computed with the size of the next step multiplied by `sin` and `cos` of the orientation.

move: function move (pixels) { var p = parseFloat(pixels); this.position({ x: Math.cos(this._position.direction) * p \ + this._position.x, y: Math.sin(this._position.direction) * p \ + this._position.y }); return this; }

I took a few minutes on the bus this morning to try out Mike Bostock's newest `d3js` thing: Observable. I created a javascript table of data which includes ten steps, the computed orientation (which is a function of which step I'm on) and the `sin` and `cos` of that orientation. See observable

// javascript... paste this into the browser console stepAngle = Math.PI*2/10; //10 is the number of steps data = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map( (step) => { return { cos: Math.cos(stepAngle*step), sin: Math.sin(stepAngle*step), cosSqSinSq: Math.cos(stepAngle*step)**2 + Math.sin(stepAngle*step)**2, } })

Not sure yet how to model this with the method plugin. Might need to add support for `sin` and `cos` to the markup.