Monday, December 7, 2009

Śūnyatā

The Buddhist concept of emptiness is interesting, complex, deep, and confusing all at once.  One particular consequence of the ideology is the concept of an inherent "you", or "I".  Let's explore that for a moment.  Do the cells in your body constitute "you"?  Well what about the ions and the cells?  But then there are living bacteria in your intestines that you could consider part of you or not part of you, depending on your definition.  Or perhaps at a given moment in time you are the sum of everything that can you can control. 

As a simple example, most people assume that their leg is part of them, and the person next to them is not a part of them.  But in a truly physical sense, is this even true?  One can argue that we can directly control the muscles in our leg, to walk if we want.  So given a desire, or a set of neuronal inputs, we can make the nerves that go to our legs fire, and make our legs walk.  However, there are 2 main problems with this. 

  1. Some people are paralyzed, and cannot control their legs.  So for these people, is their leg not a part of them?  This thought experiment refutes the idea that things that we directly control constitute parts of us.
  2. You can, if you desire, force the nerves to your hands to give the person next to you the middle finger, which will most likely make them walk (away), or perform some other action (kicking you comes to mind haha).  This simple example just means to demonstrate that there are other things we can control through our nerves, which we normally don't say are a part of who we are.

So we can control our legs (but not always) through the nerves stemming from our brain, and we can control the legs of someone else (but not always, or not predictably) via the nerves stemming from our brain.  So how can we honestly say that our leg is more a part of us than the people around us, such as our friends, enemies, etc.?  Even if we say that the densities of atoms between our legs and our brains is much higher than the density of atoms between someone else's legs and our brains, this is does not mean anything.  Slight pulls of EM force and gravity from our brain directly affect someone else leg's.  Furthermore, any physicist can tell you that what we think of as "attached objects" are not entirely as they seem, as all objects are physically affecting all other objects, but to different degrees and in different ways.  So while we can say that our legs are "more" a part of who we are than someone else's legs, there is no definite segmentation.

The next logical step Buddhists take is to say that since everything is interconnected, being compassionate, nice, giving good karma, etc. to others actually helps ourselves.  There are many other factors to consider here before this is taken at face value, but it just goes to show things are rarely as they seem.  Some Buddhist also claim that all negative emotions (jealousy, lust, anxiety, depression, etc.) stem from not understanding the true nature of reality, but again, this requires further thinking.

It's truly fascinating to understand how other cultures, religions, and people think, and I suppose the most obvious conclusion from all this is to really think critically about our actions and assumptions.

Monday, October 5, 2009

Speeding with the Garmin

So I was on a long drive, and while the speed limit was 65 mph, I was going 75.  My arrival time said 10:15pm, and I wanted to know how long I would have to drive for that 10:15pm to decrease by 1 minute.  This is how I figured it out, with the result being

"Driving Time" = "Speed Limit" / ("Speed Limit" - "My Speed") * "Change in ETA"

So given my circumstances, 65 / (65 - 75) * (-1) = 65 / 10 = 6.5 minutes.  So after 13 minutes of driving, my ETA would be at 10:13pm, for example.  (By the way, this is actually only valid for a single road's speed limit.  Once I left the highway, I would have to recalculate.)  If I were going 85 mph, then it would have decreased every 65 / 20 = 3.25 minutes.  

The easiest way to calculate it in your head is as follows:
  1. Take the speed limit (e.g., 40mph)
  2. Divide by how much faster you are going (If you are going 50mph, do 40 / 10.  For 60mph, do 40 / 20.  etc.)
  3. That's how long (in minutes) it will take for your GPS's arrival time to decrease by 1 minute.

To see how much of an effect traffic has, you can do the same thing:
  1. Take the speed limit (e.g. 40mph)
  2. Divide by how much slower you are going (If you are going 30mph, do 40 / 10.  For 20mph, do 40 / 20.  etc.)
  3. That's how long (in minutes) it will take for your GPS's arrival time to increase by 1 minute.

So for people who get annoyed at drivers going 35mph in a 40mph speed limit zone (me included), you would have to be behind that person for 8 minutes before your arrival time is affected by a single minute.

Just some food for thought.

Monday, September 21, 2009

Karma

As with any analysis, the basic assumptions must be stated upfront.  So we're going to start with the basic premises that

  1. If you smile at someone, they will be inclined to smile at someone else (not necessarily you).
  2. Your "soul" will be reborn into another body after you die.  

The variables here are:

  1. The distribution of people's ages.
  2. The distribution of interactions between people.
  3. The distribution of frequencies of smiles.

As an aside, there can always be more variables added, such as if you smile at someone, they may only be 80% inclined to smile at someone else instead of 100%.  But with these variables, any mathematician, statistician, economist, etc. worth his/her salt can come up with simple equations proving karma exists.  In fact, the output of the equations will be how long, on average, it takes for karma to come back to you. I.E. if you smile at someone today, how many years, or how many lifetimes, on average it will take for you to receive a smile, because of that initial smile you gave someone.  I will not derive the equations (as an initial guess I'm pretty sure they are simply partial differentiable equations), because this is just a thought experiment.  The question isn't if you will receive karma - it is when.  It's just math.  However, if you take into account that frowns make someone less inclined to smile, then the question actually does become if, instead of when.

Furthermore, a more complicated (and realistic) analysis of karma could be performed by assuming that smiling at someone else makes a positive impression in their brain.  Perhaps that positive impression will make them more inclined to smile at someone else, or perhaps 15 positive impressions will make them more inclined to perform a "bigger" good deed, such as helping an old lady cross the street.  Then, you wouldn't see a direct effect of your smile in the future (i.e. you wouldn't necessarily receive an equal smile at some point in the future), but perhaps a large good deed will be performed for you.  Again, the equations become more complicated, but any semi-decent mathematician can come up with them.  The idea is that you don't know what kind of results will come from your good deeds, but there will be some.  

Actually, an interesting output of these equations is what is the probability that you will "receive your karma" in this lifetime.  So for example, if you don't believe in assumption #2, then you could see what is the benefit of doing good deeds in this lifetime.  My instinctual guess is that what good karma you receive in this lifetime will only be realized if a large number of people increase the frequencies of good deeds.  This may be a depressing thought, but with the number of people in the world, if only you increase the number of good deeds you do, then there might not be a significant increase in the karma you personally will receive.  A more optimistic idea, however, is that if you take into account the fact that the people you have the most interactions with are probably going to be the ones who are the subject of your good deeds, then the increasing the number of good deeds you do to them will, in fact, probably have a significant impact on your life in the near future.

As with any probabilistic analysis, there will be variance.  That means that if you smile at someone today, you may receive a smile tomorrow, or it may take 1000 years for you to have received that smile.  It is not a guarantee that it will happen at a specific date, or within a certain number of years - there is only a confidence value that it will happen within a certain time range.  For example, if you want to know if a smile will be returned to you within the next 10 years, all you can say is "yes" or "no" with a 95% confidence interval (well, not exactly mathematically, but you get the idea).

Monday, September 14, 2009

Cool video I found

Kind of spiritual and philosophical, but hey we all wanna be happy, right?

Tuesday, July 21, 2009

New Blackjack iPhone App

First of all, I don't have an iPhone, as they do not support Verizon (yet?). Hopefully eventually they will, but until then I suppose I will be shopping around for an acceptable Blackberry when my contract is up for an equipment upgrade in March.

One of my favorite things to do this summer has been going to AC. I've gone to the clubs, stayed in many casinos, learned craps, and played blackjack.

The reason for these 2 seemingly uncorrelated thoughts is that I recently came across this blog about a new iPhone app, regarding perfect blackjack strategy.

http://perfectplayblackjack.blogspot.com/

with the actual app found at http://www.iphoneappindex.com/2009/07/18/perfect-play-blackjack-card-counter/

Every single card counting system with indices aims to model this by lumping together certain cards as +1 (such as 10's, A's), some at -2 (such as 2's, 3's), etc. Then, if the total count is above +3 (such as 3 "10"'s, 2 "A"'s, and 1 "3"), or some number (referred to as an index), then you change whether or not you hit on a 15 vs. a King, for example.

I have thought about this for a while, and realized that depending on how many of each cards left there are, there is an actual correct strategy (or deviation from Basic Strategy, if you like). This iPhone app basically deals with a Rainman-like situation, in which you could actually have 14 separate side-counts (actually it would be 10 side counts, as face cards are the same as a 10). This means that instead of knowing that the count is +3, you would know that there are 8 Kings left, 2 Queens, 4 Jacks, etc. left in the shoe. This feat is near-impossible for most people without some sort of computing tool to help (note I said near-impossible, not impossible). The idea is that knowing these exact side counts would allow one to know the exact mathematically correct thing to do in any situation.

This iPhone app also indicates the counts of several popular card counting systems (such as Hi-Lo, featured in the movie 21), which is presumably used to see how well the indices given by these systems (the approximately correct thing to do) actually lives up to the theoretically correct thing to do.

This app does not, however, indicate the correct betting strategy. The way card counting betting strategy works is based on the Kelly criteria (http://en.wikipedia.org/wiki/Kelly_criterion or http://www.bjmath.com/bjmath/proport/riskpaper1.pdf) which means that if you have a 1% advantage, bet 1% of your money (this is a crude example). This assumes that you know the advantage. Currently card counting aims to approximate this advantage, again by lumping together cards. There are many card counting systems currently in use (many seen at http://www.qfit.com/card-counting.htm), but if we knew the exact distribution of cards remaining (i.e. 10 side counts), there would also be an exact calculation of the advantage. The math involved in this is beyond me, and based on advanced combinitorial analysis.

In my opinion, however, I'm not sure how useful that would be. The current blackjack card counting systems do a damn good job of estimating the advantage, and are easy to use. In fact, the more advanced counting systems have been shown to barely increase the advantage. And regarding this iPhone app, the current method of using indices seems to be pretty good (see http://www.blackjackinfo.com/bb/showpost.php?p=91289&postcount=7).

But hey, from a mathematical perspective, I fully support this quite impressive app, and believe that a rigorous evaluation of index play is nothing to scoff at, if only to check how well one's index system is performing compared to the theoretically correct thing to do. In conclusion, it probably won't be used in any sort of casino environment (as it's actually illegal to use a device in a casino, not just frowned upon), but I think it will be a good evaluation and fun learning tool for people interested in the theory behind card counting index play.

FYI check out www.blackjackinfo.com for descriptions of a lot of things I've talked about, such as card counting or index play. Gotta love gambling!

-Rob Toth

[edit] P.S. I almost forgot, on a COMPLETELY unrelated note, my dear friend Katt wanted me to include this in my blog: "Good girls are the bad girls that don't get caught.". Happy, Katt? :)

Sunday, June 28, 2009

TEncryption (Computer Programming)

Update 2012-02-08: See part 2.

I just got an email saying that my TEncryption program is going to be hosted on softpedia (http://mac.softpedia.com/get/Utilities/TEncryption.shtml).

It was 3 years ago that I created this program, and completely forgot about it until today. I made it open source, and wrote it in java (so it's platform-independent). It's my own algorithm up to 2^31 bit encryption (only because of memory issues); feel free to look at the source code to learn how it works.

I basically just want to say a little bit about an idea I developed for extending fixed-length hash algorithms to be variable-length hash algorithms. TEncryption used MD5, which I will probably have to change to SHA2 due to the fact that MD5 has been shown to be weak. However, the idea I had (outlined below) is generalizable to any hash algorithm, so that shouldn't be a problem.

The basic flow of symmetric private key encryption is as follows:




A problem arises, however, when you want an 8-bit private key, but only have a 4-bit hash function available. The steps outlined below are how I overcame this problem.


The final variable-length hash algorithm is only as strong as the underlying fixed-length hash algorithm used. In my case, I used this idea to extend the 128-bit MD5 hash algorithm to create variable-length keys. Some implementation choices exist when the hash algorithm's bitlength is not a power of 2 (or a fraction of the desired key's bitlength), and when the fixed-length hash algorithm has a greater bitlength than the variable-length key (not recommended). Check out the hash.java source file in the TEncryption program above to see my implementation of this.

Perhaps in another post I'll explain my underlying encryption algorithm I created but I'm not in the mood right now. Like I said, the source code is all there.

Rob, out.

Saturday, June 27, 2009

First Post

This is my first blog post. I recently got a twitter account, and figured this was the next logical progression. Not sure what I'll write here, or even how often I'll update it, but I figure this blog will be good to have, at least to have it registered if I ever want to use it more extensively in the future.

My other sites are:
http://research.robtoth.net