The incenter radius of a triangle is given by the formula:
2*A with A = area
r = -------
(a+b+c)
the circumcenter radius is given by
abc
R = -----
(4A)
We want the ratio of the incenter to circumcenter so that’s
r 8A2
_ = ---------------
R ((a+b+c)*(abc))
So then if you have a triangle mesh with a variable edge_norms which is an n by 3 matrix of the lengths of edges in your mesh, a way to get the incenter radii is, first applying Heron’s formula to find the areas of each triangle:
If a,b,c are the lengths of the side of a triangle then the maximum angle of the triangle is the angle opposite the largest side, call that one c. A formula for this angle is then
/ a2 + b2 - c2 \
cos-1| ------------ |
\ 2*a*b /
So then if you have a variable edge_norms which is an n by 3 matrix of the lengths of edges in your mesh, a way to find the maximum angle of each face is to issue:
Nickels are rare in change. This is verifiable even in just a experimental and anecdotal way. I look in my change bin at home and there are many quarters, many dimes and pennies and very few nickels. It also makes sense when thinking just cursorily at the likelihoods of each coin denomination popping up in your change at the super market. I was thinking about these likelihoods—more formally the expected amount of each coin after a transaction—a little (too) much and thought I might as well post my findings. So if E[X] is the expected number of times for event X to happen, then I’ll write E[pennies] to mean the expected number of pennies in my change after a transaction. I’ll assume that the total change is a fair, random number between 0 and 99 cents. I’ll also assume that the cashier will give you the minimal amount of coins to make the change.
So here’s the expected change for a random purchase at the store:
Note: You can even double check the math by noting that the expected total amount in change should be $0.50. And the total amount from the above coins is:
I did a search for “Latex in browser” without any immediate finds for what I thought would come up. Namely, an in-bowser app that has a text area, where I can type in a full latex document program, and a rendering window/frame where I can on the fly see my typeset pdf. I’ve quickly coded up a simply demo of the idea. Here’s a screen shot of the app running on Safari:
The code is rather simple it just calls pdflatex on a server using AJAX. Then it dumps the pdf into an <OBJECT> tag. I spent more (too much) tinkering with the layout than actually making the latex and in-browser part come together. Here’s the simple php code that the LaTeX program gets POSTed to asynchronously:
This Bézier curve editor is the first applet I’ve written for my Geometric Modeling class. It implements De Casteljau’s algorithm to render the curve recursively and the Graham scan method for determining the convex hull of the control points. I also implement elevating the degree (by adding another control point) of the Bézier curve without changing the curve.
I’ve been searching in vain for a long time for a way to control my displays’ brightness via the command line (terminal). I finally found a small c program written by Nicholas Riley. I won’t repost the code, but here’s the intel binary (just in case I lose it, I guess).
I had the habit of creating little bash scripts for each java applet I worked on. These were such boilerplate, not to mention the boilerplate html for each applet. So here’s a script the takes the main applet file as a parameter and compiles the code, creates some html on the fly and runs the applet:
#!/bin/bash
#
# Usage:
# ./appletmakeandview.sh Applet.java
#
base=`echo $1 | sed "s/\.java$//g"`;
if javac -source 1.5 -target 1.5 $base.java; then
if [ ! -e $base.html ]
then
echo "<applet code=$base width=600 height=600></applet>" | cat > $base.html
fi
appletviewer $base.html
fi
I’ve had a mind to do an Euler tour of the bridges of New York, specifically those in and out of Manhattan. Yesterday a few friends and I made our attempt.
Our tour was an Euler tour in the historical sense, not quite the mathematical sense (I guess a valid Euler tour would start and finish in the same place). The graph illustrating the bridges (at least those traversable on bicycle) looks something like this:
The basic idea of an Euler tour is to traverse each edge (bridge) exactly once. Notice this can only happen in the above graph if you start in New Jersey and end in Manhattan.
In order to cross all the bridges of Manhattan, we originally thought we’d take the Path to the New Jersey side of the George Washington Bridge, but we were dismayed that Hoboken (the highest stop on the path) wasn’t so close to the bridge. Also my girlfriend and I had decided to rent a tandem bike:
The rental shop was on W 104 st in Manhattan so we conceded to cross the GW twice, essentially invalidating or at least delaying our Euler tour.
Here’s the map we used to find our way from bridge to bridge:
The ordering of the bridges was to be as follows:
George Washington
Broadway Ave
207 St
181 St
Macombs Dam
145 St
138 St
3 Ave
Willis Ave
Triborough
Ward’s Island Pedestrian
Queensborough
Williamsburg
Manhattan
Brooklyn
…which is almost how it was executed.
Unfortunately the pedestrian walkway from Ward’s Island to Manhattan is not open in the winter and we didn’t find this out until we saw it statically gaping from Randall’s Island. Thus we had to also cross the Triborough bridge twice.
My girlfriend and I, on the tandem bike, crossed 11 of the 15 bridges above. We covered about 42.5 kilometers (≈26.4 miles ≈ 1 marathon) in total before we were getting too nervous about returning our rental in time. Here’s a rough sketch of our route on the map:
The rest of our group made it over 14 of the 15 (all but that pedestrian walkway).
My friend recently attended an interview with the New York City Teaching Fellows program (NYCTF). It was a group interview and each candidate had to prepare a 5 minute lesson plan to present to the others. My friend told me that one of the candidates presented a lesson plan for an second grade science class. The subject was gravity and the lesson was about why a book falls faster than a feather. Why heavier objects fall faster than lighter objects. Here’s a scan of the handout the candidate wrote up:
If you don’t understand why this it’s not just funny but scary, you could review about gravity on wikipedia.
I’m thinking of drafting a letter to NYCTF. But I’m at a loss of words what it should say. Obviously they shouldn’t have to account for an applicant’s ignorance, but how can I feel comfortable that this candidate won’t be in front of a second grade science classroom next year?
I challenge the internet to start a new genre of robot poetry. It can be humans reading robot generated poetry, robots reading human poetry, robots reading robots poetry or even just human poetry about robots and the reading there involved.
Here’s a little something to get the ball rolling as they say:
By the way, I generated the above on my Mac (10.5) using this command:
say -v Alex -o row-your-boat.aiff "Row, row, row your boat. Gently, down the stream. Merrily, Merrily? Merrily. Life, is but a dream"