Category: Education

I love math and I don’t care who knows it. I originally started out with an interest in programming, but the more I learned about it, the more I realized all the really cool things you could do with computers relied on deep mathematical principles, and the more I learned about those, the more fascinated I became.

Since then, I’ve gone from just taking courses that I thought would apply directly to my programming efforts to taking every math class I could. A class on graph theory, one of my first real interests, produced an interesting bit of software, as did both numerical and real analysis. My currrent efforts are in real analysis and fractal geometry, and the programming aspects are very interesting, so look for cool stuff ahead.

Math

LaGrange spline

lagrange splineWell, here’s the first of hopefully many iterations of this project. As it stands, all it does is interpolate ln(x) with 3 pre-defined points: (2,ln2),(3,ln3) & (4,ln4). Please feel free to add interpolating points (is that even the right word?) by clicking on the screen. It takes the x-co-ordinate of the mouse click & adds a tau. Hopefully in the future, it’ll be a tad more flexible, but I barely understand what I’m doing right now, so … BTW, I’m not entirely sure this is done right. I have tested it on about ten points, and it seems to work right, but y’never know. Also, it dies if you give it the same point twice.

Newton Approximation

MAN! Was this a pain or what? Finally got it. Turns out I had it about six hours ago, but there was a virtually invisible typo ( i’s and 1’s look pretty similar, wouldn’t you say? No?) Anyway, here it is. As before, you can click & put in a new interpolating point. Beware though: it only supports the first derivative, so I make no claims as to what it is that you get if you click in the same place more than twice. Also, due to some minor display optimizations(?), if you add a new point too far from the last, you can’t see it (the graph moves off the screen and it stops painting), so keep that in mind while playing around.

Shift-click to get function value at the mouse location.

L2 Piecewise Linear Splines

Ok, here it is. Nothing fancy, no interactive mouse stuff, no adding points. Nothin’. Just an L2 piecewise linear spline approximating the cosine, with taus at 0, Pi/2 & Pi. Hopefully, I will soon have this interactive, but, as you know, I need to write a matrix solving routine for an arbitrarily large matrix. This ain’t easy. It ain’t real hard, but it ain’t easy. I’ve got a matrix calculator goin’, but I need to re-write it to be able to (gracefully) solve for a vector. Oughta be up Real Soon Now.

Hermite Splines

Here’s this one, and, hoo boy, is it cool. You get to change the range of interpolation by filling in the fields, and change the scaling factor (zoom in/out) by filling in that field (big number=closer view), although changing the interpolation range resets the polynomial to interpolate only at the endpoints. Neat, huh?

Bessel Splines

Well, this is just about the same as the Hermite. As before, you get to change the range of interpolation by filling in the fields, and change the scaling factor (zoom in/out) by filling in that field (big number=closer view), although changing the interpolation range resets the polynomial to interpolate only at the endpoints.

 

 

 

Comment

Graph Theory

graph theoryWell, this is a pretty basic tool for playing around with graphs. Just click the “New Graph” button for a window, then shift-click to set vertices anywhere you want. To set an edge between two vertices, ctrl-click on a vertex, which should get an odd blue halo. Now ctrl-click on the vertex you want an edge to. An edge should appear. To delete a vertex, double-right-click on it, and to delete an edge, single-right-click on the box at the edges midpoint. I believe for Mac users holding down the Apple key while clicking will give you the same result, although I’m not sure, since I’m not lucky enough to have a Mac on the desk here, so please Email me with the key that works. To select several vertices or edges (for doing a shortest-path test, getting info on a bunch of ’em at once, etc.) use shift-ctrl-click. You will note more advanced tools,such as graph coloring, cloning, completing, and many other choices, some of which do not begin with the letter ‘c’, available in the oh-so-professional-looking menu bar.

GraphTool version 1.0b is the updated version of my now very old ‘Graphs’ program, which is located here, and although it is actually less functional now than its ancestor is, that will soon change. I hope to, before long, offer GraphTool as an API for those studying graphs, so that anyone who speaks java and who takes the time to understand the (very small) GraphTool API could write a ‘plugin’ to do whatever they were interested in. Network flow analysis, for example. Or some graph matrix operations. Whatever.

GraphTool is written in java. This does not automatically mean that it is an applet, which it is, in fact, not. While the old version of it was an applet, I made the decision that saving files was important enough to warrant moving away from applets and towards actual applications. The fact that there are no java2-compliant browsers, besides maybe Mozilla, made that decision easier – my target audience would have to download a java2 virtual machine anyway. I may sometime in the future make an applet version.

Do you have a PowerMac? Does this not work? Well, lemme tell you, I tried to make it work, Lord knows I tried. But seeing as how this is really not a problem with the program, but rather with Netscape 3.0 (no, really, it is!), I decline to spend any more time on it, especially when all you hafta do to run it is get the MRJ from Apple. See here for more info on it. It works well, if somewhat clumsily, and, frankly, I really don’t think anyone is actually using/desiring to use this stuff. If I’m wrong, please let me know. I suppose if enough people want/need it, I can resume my efforts. So there. Nyaah.

Other Late-Breaking News

The Line Graph generator actually works now.

As it turned out, the coloring algorithm I presented earlier was incorrect. The new algorithm is:

Select a vertex. Check to see if it is the same color as a connecting vertex. If so, increment the chosen vertexes color, then check all the vertices it’s connected to again, continuing to increment when a conflicting color is found.

Select another vertex, and do the same procedure until all vertices have been completely checked.

At this point I should mention that the program doesn’t work reliably if you color the graph, then remove vertices and/or edges then color it again, since the algorithm doesn’t know how to decrement colors, so it’ll add unnecesary colors sometimes.

You may notice a new menu option “Color Graph by Build Method” – what, you ask, is that? Well, it’s another coloring algorithm. Basically, you take the graph and erase all but one vertex. Then you add one in, along with the edge to the other, if one exists. Then, if the color of the one you just added is the same as the first one, you select a color for the new one that doesn’t cause a conflict. Then add a third vertex with the arttendant edges, and repeat the color adjustment. This seems to work pretty well most of the time (certainly better than the other algo), and when it screws up, the colors are much easier to spot. For me, anyway. I’m color-blind, so the other algorithms colors are tough on me. For a long time I was convinced the first algo was infallible because I couldn’t see the difference between a dark brownish and a dark red. Ack.

DISCLAIMER: Due to an alarming number of parents, schoolchildren and primary-school teachers apparently wasting vast amounts of time trying to make this produce a bar or pie graph, I would like to take this opportunity to say: “Hi! This ain’t about that kind of graph! This is a tool for visualizing Graph Theory problems, which are studies of relations between sets. If you need to make a bar graph of something, sorry, but you’ve ended up in the wrong place”.

View 1 Comment