Saturday, September 27, 2008

Postmodern Math

Last Saturday I wanted to do something just for fun since we take Saturday’s as our Sabbath. Thinking about fun things to do (that are free since money is tight right now because car registrations came due this week) I decided I wanted to go to the library and get some books on math. This is something I do every once in a while, and we have been watching a lot of the show Numbers lately (Netflix is great) so my brain has been in a math mode.

We took Kati to the library for the first time, which we enjoyed much more than she did, and Kristen got some books on house design and scrapbooking. I brought home and armload of fun looking books about math and mathematicians.

The first book I ended up reading was Philosophy of Mathematics: an introduction to the world of proofs and pictures by James Robert Brown. C 1999 published by Routledge an imprint of the Taylor & Francis Group. ISBN 0-415-12275-9

This ended up being a fascinating general overview of the different strains of philosophy behind mathematics. I never realized there was so much debate among mathematicians about how to think about how math works.

There were several strains of thinking represented in the book but one debate that stood out was the question of whether mathematical concepts actually exist in some sort of platonic abstract realm of existence and mathematicians just discover these truths, or if mathematics is really just a social construct. The author believes in the platonic version of math and after reading the book I mostly agreed with him, but think he puts too much of a hard separation between the realm of math and the world we actually live in.

I found it particularly interesting to note that some of the extreme questioning of reality that has been connected with postmodernism has also made its way into mathematical philosophy. In particular chapter nine on how human’s follow “rules” especially when working from an existing sequence of numbers and seeking to extend them.

Suppose a teacher gives the following list of numbers to her student and asks them to extend the sequence (see page 133-134) 1, 4, 9, 16, …. “What is the next number? The student will likely answer 25. Why? Probably he will reason that the sequence obeys the rule of taking each number in turn and squaring it, i.e. 1 squared, 2 squared, 3 squared, 4 squared, and so on; the next number in the sequence would then be 5 squared which is 25.

But what if he answered 27? Would this be wrong? His reasoning might be as follows: The sequence is growing by adding successive odd prime numbers to the elements of the sequence. The odd primes are: 3, 5, 7, 11, 13, 17, …. Thus the sequence is:

4 = 1 + 3
9 = 4 + 5
16 = 9 + 7

And so the next number in the sequence is 16 + 11 which equals 27.”

Both of these are reasonable continuations of a mathematical sequence and the only sense in which one answer could be considered wrong has to do with the teachers “intentions” but are her intentions enough to justify considering one answer wrong?

The book goes on to give more extreme examples of a student following a rule to the best of his ability and getting an answer that is “obviously wrong” or is it? The answer given is absolutely not the one the teacher expected or intended, and would be considered wrong by most people, but is it really?

A mathematician named Kripke extended an argument by one named Wittgenstein on this topic to give the following set of arguments.

Causation is just regularity – nothing more; our inferences about the future are based on custom and habit – nothing more. Thus in this view:

  • · There is no fact of the matter about whether the teacher/questioner meant one sequence rather than another.
  • · The only way to solve the problem is to abandon the view that meaningful sentences purport to correspond to facts. Language does not word by being representational.
  • · However, this is not to abandon language. There are many useful things that various ‘language games’ can do.
  • · The conditions for the use of any language game involve reference to a community, all of whom play the same game.
  • · Ultimately, we act without hesitation, without justification; but this is not to act wrongly. In following a rule we simply do what we think is right. There is nothing deeper. But it is not enough to do merely what we think is right. ‘To think one is obeying a rule is not to obey a rule. Hence it is not possible to obey a rule “privately”; otherwise thinking one was obeying a rule would be the same thing as obeying it.
  • · We are trained by others, and we are judged to be following a rule correctly when we give the same answers as other members of the community. There is a strong tendency for all members of the community to give the same answers – a shared ‘form of life’. This is just a brute fact, like Hume’s regularities in nature. There is no explanation for this, no hidden cause: ‘What has to be accepted, the given, is – so one could say – forms of life.
  • · Our answers are (in some loose sense) in accord with the rule; but they are not caused by it. We do not grasp a rule which then determines our behavior; we do not agree in expanding a sequence because we share a common conception of some mathematical function. Rather, we say that we share a common conception because we agree in our answers, we agree in how we go on expanding the sequence.

The author of the book finds this conclusion “wholly absurd and thinks it ridiculous to say that it is only an amazing coincidence that we all agree in developing a sequence in the same way.” He concludes that “something is wrong with the premises of any argument that leads to this absurd outcome, and concludes that there are, after all, independently existing mathematical entities and we can grasp them, just as the Platonists have been claiming all along.” (Page 144-145)

I tend to agree with the author though I find Kripke’s argument to be challenging and I hate to link myself in any way with a Platonic view of the world. What do you think? Answer in the comments below.

Several times in the book, the author expressed what I would term a “negative view” toward religion, which I found to be interesting in a book on math. However I found his conclusion, especially coming from someone with this negative view of religion to be challenging.

“The real action today – the living philosophical issues for working mathematicians – cluster around visualization and experimentation. The clarification of this cluster of problems presents us with our greatest challenge. If our philosophical duty lies anywhere it is here, after the elimination of poverty which, of course, must be the first duty of all.”

How is it that a secular anti religious mathematician can view “the elimination of poverty” as “the first duty of all” and so many Christians can seem to view this issue as being unimportant compared to questions like “what style of worship is best?” Shouldn’t all Christians treat this issue as being at least one of our first duties?

Thursday, September 18, 2008

Image Upload Web Service in VB.NET

Image Upload Web Service in VB.NET

We are going to be doing and in house pictorial directory here at Chapel Hill this fall. I want this directory to be integrated with our website and allow us to view the directory pictures online.

The process as I envision it would include a family taking some time out of their Sunday or Wednesday night to have a picture taken. The photographer would take a family picture as well as individual pictures and transfer these to a computer. It would be ideal if the pictures transfered as they were being taken. We would then have a piece of software that would allow us to look up the info we have for this family, update it if needed, and upload pictures for the family and for each family member.

This software will need to re-size the images down from the hi-quality images taken by the camera to something that is a web appropriate size, upload the image, and update the family / individual profile to indicate which image belongs to them.

In order to do this, I needed a way to upload an image to a website using a VB program. I decided I would use a web service to do this and through some Google research I was able to put together a web service to do this.

Here is the code I used for the web service with a web form to test it out.
When I have finished the vb program I will post that code.

First the web service
Public Function UploadImage(ByVal imgdata() As Byte, ByVal FileName As String) As Integer
'Find the path on the server of our apps images folder
Dim FilePath As String = Server.MapPath("images")

'strip the path and .jpg etc out of our filename
Dim i As Integer = InStrRev(FileName, "\")
FileName = Mid(FileName, i)
Dim j As Integer = InStr(FileName, ".") - 1
Dim k As Integer = Len(FileName)
FileName = Mid(FileName, 1, j)

'Create a memory stream to hold the image data
Dim MS As New System.IO.MemoryStream(imgdata)

'Convert the memory stream to a bitmap image
Dim BM As New System.Drawing.Bitmap(Image.FromStream(MS))

'Convert the bitmap to a png and save it in our images folder
BM.Save(FilePath & FileName & ".png", Imaging.ImageFormat.Png)

'eventually we will create a database entry for this image and return the image ID
Return 1
End Function


Now the VB code for the web form
Imports System.IO
Partial Class _Default
Inherits System.Web.UI.Page

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ws As New localhost.ImageUpload
Dim fs As Stream = FileUpload1.PostedFile.InputStream
Dim img(fs.Length) As Byte
fs.Read(img, 0, Convert.ToInt32(fs.Length))

ws.UploadImage(img, FileUpload1.PostedFile.FileName)
End Sub
End Class


I hope someone finds this useful.