# VisPy Sinewave Demo

VisPy is quite an interesting tool.  They say it is for “scientific visualization”.  Here is an example of that.  I took a demo from their github page and added a little code to generate a sinewave.  The cool thing is that the graph, scaling, panning, zooming, and redrawing all come out of the box.

I previously wrote about installing VisPy.  Thanks to the great efforts of some unnamed people, Python on Windows is really working nicely now.

Here is a screenshot:

Here is the code:

This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.

view raw

vis.py

hosted with ❤ by GitHub

# How to Calculate Pi

π (pi) is the ratio between a circle’s circumference and it’s diameter. You can check this by using a tape measure. Measure around a circle. Then measure across the circle.

π = Around / Across

Did you know there is a way to calculate π? There are a lot of different ways, but one is called the Leibniz formula for π.

http://en.wikipedia.org/wiki/Leibniz_formula_for_%CF%80

Where the original Leibniz formula for π ends up calculating π/4, I’ve just factored this 4 into the infinite series.

π = 4/1 – 4/3 + 4/5 – 4/7 + 4/9 – 4/11 + 4/13 – 4/15 + 4/17 – … (forever)

The more terms you add/subtract to it, the closer it gets to being accurate. A problem with the Leibniz formula for π is that it takes a lot of calculations to get an accurate version of pi.

Here is a mini-program I wrote in Python 3 to repeat this one million times.

pi = 0
for n in range(1000000):
pi += ((-1)**n*4) / (2*n+1)
print(pi)

Here are some of the numbers from that calculation:
4.00
2.66
3.46
2.89
3.33
2.97
3.28
3.01
3.25
3.04
3.23
3.05
3.21
3.07
3.20
3.07
3.20
3.08
3.19
3.09
3.18
…999980 more times…
3.1415916535897

Here is real PI:
3.1415926535897

Isn’t it interesting that my version of PI, after a million iterations, is 1 digit off of real Pi, but the digit is in the middle? This has something to do with Euler numbers which you can read about at http://en.wikipedia.org/wiki/Euler_number .

For most practical purposes, 3.14159 is more than enough digits to use with Pi.

Ever wonder if you could use Pie to calculate Pi?
http://www.numberphile.com/videos/pie_with_pies.html

# Spider At Night

A spider was hanging out by my office door at night.  Using the macro setting on my camera along with my Surefire flashlight, I got a close up picture that was pretty neat.

# We saw four geese… and first snow!

We saw four geese on our property the other day!  Maybe we should tell them they are late in flying south  :)

Here are a few facts on geese.

• Geese are a type of waterfowl belonging to the group of Anserini.
• Geese mostly eat greens vegetation and grains.
• There are three kinds of true geese gray geese, white geese ,and black geese.

Some Geese do amazing things while they are migrating.  There is a species in Asia, Bar-headed Geese (Aner indicus), that migrate over the tallest mountain in the world (can you guess?) in the Himalayan Mountains.  The air temperature is as low as -60 Degrees F.

Now that is a “wow”.

References:

1. Wikipedia contributors, “Goose,” Wikipedia, The Free Encyclopedia, http://en.wikipedia.org/w/index.php?title=Goose&oldid=633827032 (accessed November 19, 2014).
2. “Migrating Geese”, Chipper Woods Bird Observatory, http://www.wbu.com/chipperwoods/photos/geese.htm (accessed November 19, 2014)

# We found a big spider

Here is a big spider that we found while raking leaves today.

Spiders are air-breathing arthropods.  They are found in every continent except Antarctica.

Spiders mostly prey on bugs, but few large species prey on large birds and lizards.  Argh, that is scary!