• Home
  • Readings
  • Github
  • MIES
  • TmVal
  • About
Gene Dan's Blog

Monthly Archives: January 2011

You are browsing the site archives by month.

No. 33 Memorial Park Criterium: Race Report

20 January, 2011 4:01 AM / 2 Comments / Gene Dan

Hey everyone,

I’ve got a long overdue report of a race that happened last August, called Memorial Park Criterium. This was just one particular iteration of the Memorial Park Criterium Series, which happens every summer. Unfortunately, I did not know about the series until my friend Ken Day wrote in his blog about his participation…and crash. Anyway, over the summer I’ve been riding with a club called the Space City Cycling Club, which leaves at Bike Barn every weekend at around 7:00 – 7:30 AM for about 60 miles around Alvin and San Jacinto. They have 4 groups based on speed, 14mph, 17mph, 21mph and 24mph. I started with the 14mph group and quickly moved up to the 21mph group where I did the majority of my pack riding for the latter half of 2010. After a while, I decided to ride with the 24 group but I’ve been getting dropped a lot since they tend to go past 34mph at times, speeds at which I cannot hold tempo for long periods of time…yet. In addition to riding with the club, I’ve been doing my own speed work called interval training, which involves doing alternating efforts of hard/easy riding. Intervals help improve the power which you can produce at lactate threshold and help you get accustomed to the high-intensity of racing. Many people who are unfamiliar with cycling don’t realize that racing involves a series of sharp accelerations and cool downs – unlike the steady tempo that may seem intuitive to a novice. Thus, doing easy/hard alternating efforts helps one train like they race. With respect to racing, I had taken a break from racing for over two months, and I was ready to get back into competition, hoping that all my work paid off. Side note – You will notice in the photos that I am riding a new bicycle. I bought one of the team bikes before I graduated and this is the first race at which I rode it.

Registration

 

Before the race, I had just spent about a week in Chicago so I only had about a week after I got home to train for the race. Thus, I wasn’t exactly sure of myself if I would be able to perform well, but since I had performed somewhat poorly in the last handful of races my expectations were low for the race, “stay in contact for 15 minutes, that’s all I’m asking. If you can do more then do it.” Remember, crit racing is very short, only 25-60 minutes but the speeds are very high, and often average higher than 25 mph, even for very technical courses, so you’re more or less at lactate threshold the whole time. On the day of the race, I had just passed my second actuarial examination so I was in good spirits. My dad and I drove to Memorial Park that afternoon and I did the usual routine – unpack, prepare my bike, register, and warm up.

Warming up before the race

I did a few warm up laps and a couple of high-intensity efforts to gauge the corners of the course. In my opinion, they weren’t bad at all. There were no U-turns, unlike the Driveway, and the roads were not too cracked, though they were not smooth like that of the Driveway. I felt like I wouldn’t have nearly as much fear cornering as I would have had at the Driveway. After the warm up, the Cat 5 racers lined up. I saw one rider wearing a regular t-shirt and jeans shorts and I was wondering if he was half-joking. I didn’t see him again after we started so I was assuming he was new to the race. Anyway, after we were all sizing each other up for the few awkward minutes of waiting, the race officials blew the whistle and we were off.

Rounding the last corner before the next lap – the big guy gave me a good draft

Immediately, the speeds kicked up to about 24mph, but I was getting a good draft off the people in front of me so I wasn’t bothered at all. I continued to use my tactic at the Driveway of mimicking exactly how the rider in front of me cornered, so I wouldn’t lose my mind when we went through the corners fast. After a few minutes we started seeing a few attacks off the front but none of them went anywhere. About a couple of laps later, perhaps the 8th minute or so, the person in front of me bolted off of the pack and I followed him – soon we formed a 4 man breakaway but that lasted only a few minutes. The race continued in a similar fashion, with people jumping off the front and getting reeled in. At one point my fear of cornering got the better of me and I accidentally cut someone off – the people behind me yelled at me, so I was a little started but I knew they yelled for good reason – for the safety of all the riders involved. I heeded their criticism and made an effort to stay steady the rest of the race.

Rounding the corner, again

When I finally reached the 15-minute mark, still in contact with the pack, I knew I had reached my goal, so I tried to stay with the group for the remainder of the race. I was doing remarkably well, staying near 8th position for most of the race. At the final lap one of the riders decided to put in an attack and I followed him. Soon, I passed him in the front and I was leading the race at the final lap! It felt incredible, I never thought I would be in such a good position at this point in my training. However, near the last 300m of the race, I ran out of steam and the tempo picked up for a sprint finish – I wasn’t able to compete in the sprint but I stayed with the pack until the end, my first pack finish in a race since Tunis-Roubaix, my first race.

Following the attack!

First, the bad news. Of course, I didn’t win. I went too early and had I not attacked at the end I would have had enough energy to contest the sprint. Then again, it was probably better for me to at least try to attack so I could gain the experience of doing so, since, after all, it was just a minor criterium race. Second, I was too apprehensive in the corners, still. I had improved, but it’s still not at the level where I feel that others can trust me with my handling skills, so I will continue to work on that. Otherwise, everything else went better than expected, I had made my goal and exceeded it, and I knew that my hard work and interval training was paying off, and that I was moving in the right direction.

Leading the race at the final lap

Posted in: Cycling, Logs

No. 32: Decimal to Binary Conversions

14 January, 2011 2:53 AM / Leave a Comment / Gene Dan

Hey everyone,

Today I thought of a small coding exercise for me to do to work on algorithm building – I decided to write a program that converts positive decimal numbers to binary numbers. I knew that I could probably find plenty of examples on the web of this algorithm, but I decided to find out for myself how the conversion worked before looking for any help. Anyhow, one method of algorithm discovery involves the application of that algorithm to a specific example known to be true, and then using that example to pick apart the steps. What I mean is that many of us use algorithms every day in order to solve problems without realizing it or understanding it. For instance, most of you have probably used the division algorithm daily ever since you learned it in kindergarten – for instance, to divide 7 by 2 we subtract the product of 3 and 2 from 7 to obtain the remainder 1. Thus, 7 divided by 2 equals 3 remainder 1. However, how do we know that this algorithm works every single time for every pair of integers? Fortunately prior math enthusiasts have given us a logically rigorous explanation. Looks more complicated when printed, right?

Now, let’s examine how to find the binary value of the integer 27. First, let me give a brief description on how binary values work. In the binary system, every digit of a number is represented by either 1 or 0, in contrast to our common base-10 system, or decimal system, in which each digit may be represented by 0,1,2,3,4,5,6,7,8, or 9. For instance 1 in base-10 is 1 in base-2, 2 in base-10 is 2 in base-2, 3 in base-10 is 11 in base-2, 4 in base-10 is 100 in base-2, and so on, and so forth. In base-2, 10 is twice as much as 1, 100 is twice as much as 10, 1000 is twice as much as 100, and in this manner each digit represents a unit that is twice as large as the digit to the right of it. Check out the link on the binary system to learn more.

Let’s go back to 27. You could try counting in binary (1, 10, 11, 100, 101, …) but that would take too long and would be cumbersome to program. An alternative method we could try is to break up the number 27 into different binary unit values (1000’s, 100’s, 10’s, 1’s), add them up and obtain the final binary representation. However, how many digits would the resulting binary number be? We can’t deduce the answer simply by staring at 27, so let’s try to divide by 2 and see what happens. After dividing 27 by 2, we get 13 remainder 1. What happens if we divide 13 by 2? We get 6 remainder 1. Dividing 6 by 2 gives us 3, and dividing 3 by 2 gives us 1 remainder 1. Note that we applied the division algorithm 4 times. It just so happens that 2^4 = 16, and that 10^4 = 10000. We know that 10000 in binary is equal to 16 in decimal because 10 in binary is equal to 2 in decimal and 10x10x10x10 in binary is equal to 2x2x2x2 in decimal. Thus, we know that 16 out of our original 27 consists of 10000 in binary. What about the other 27 – 16 = 11? We then take 11 and divide that by 2 to obtain 5 remainder 1, divide 5 by 2 to obtain 2 remainder 1, and divide by 2 to obtain 1. In this next round of divisions we have applied division by 2, 3 times. Thus 10x10x10 = 1000 in binary, which is equal to 8 in decimal. Now we have 11-8 = 3 remaining to consider. We divide 3 by 2 to obtain 1 remainder 1. We have applied division by 2 once, so 10 in binary is equal to 2 in decimal. Now we only have 3-2 = 1 remaining and 1 in decimal is equal to 1 in binary. So, we know that 16 + 8 + 2 + 1 in decimal is equal to 10000 + 1000 + 10 + 1 = 11011 in binary…success!

I must stress that this does not prove that the algorithm works – it has only worked in this one particular instance. However, this instance has shed some light, at least for now until I actually gain the knowledge to do a mathematically rigorous proof – which won’t be coming in a long time!

Using this example as a guide I wrote down some code:

[sourcecode language=”css”]
//Decimal to Binary Conversion

#include <iostream>
#include <cmath>
using namespace std;

const int base = 2;
long long baseconv(long);

int main()
{
long long inputval;

cout << "Enter an integer: _b";
cin >> inputval;
cout << inputval << " is " << baseconv(inputval) << " in binary!" << endl;
return 0;
}

long long baseconv(long input)
{
long long baseconv;
long long updater;
long long dival;
long digitcount;
baseconv = 0;

while (input > base – 1)
{
digitcount = 0;
dival = input;
while (dival > base – 1)
{
dival = dival / 2;
digitcount = digitcount + 1;
}
updater = pow(base, digitcount);
baseconv = baseconv + (pow(10,digitcount));
input = input – updater;
}
baseconv = baseconv + input;
return baseconv;
}

[/sourcecode]

Here’s an example of the output:

I’m running out of time so I don’t want to go into every single detail over this program, but in a nutshell, the program splits the input integer into separate binary parts, then adds the binary parts together in order to obtain the result. Unfortunately, the memory limitations of c++ do not allow me to convert very large integers, such as 1234123412341234. See what happens when I try to convert this value:

Also, the program does not work with negative values, so those will be two things that I will work on in the near future. I also spent the time to port the program into VBA, and I changed it to do conversions from base-10 to any base the user chooses:

[sourcecode language=”css”]
Function BASECONV(inputval As Long, base As Integer) As Variant

Dim dival As Long
Dim digitcount As Integer
Dim updater As Long

BASECONV = 0

Do While (inputval > base – 1)
digitcount = 0
dival = inputval
Do While (dival > base – 1)
dival = dival base
digitcount = digitcount + 1
Loop
updater = base ^ digitcount
BASECONV = BASECONV + (10 ^ digitcount)
inputval = inputval – updater
Loop

BASECONV = BASECONV + inputval

End Function
[/sourcecode]

Notice how much more efficient the code is! That’s because VBA is at a much higher level than C++, so there are a lot more built-in functions that do the work for you. Here’s an example of the output:

Posted in: Logs

Archives

  • September 2023
  • February 2023
  • January 2023
  • October 2022
  • March 2022
  • February 2022
  • December 2021
  • July 2020
  • June 2020
  • May 2020
  • May 2019
  • April 2019
  • November 2018
  • September 2018
  • August 2018
  • December 2017
  • July 2017
  • March 2017
  • November 2016
  • December 2014
  • November 2014
  • October 2014
  • August 2014
  • July 2014
  • June 2014
  • February 2014
  • December 2013
  • October 2013
  • August 2013
  • July 2013
  • June 2013
  • March 2013
  • January 2013
  • November 2012
  • October 2012
  • September 2012
  • August 2012
  • July 2012
  • June 2012
  • May 2012
  • April 2012
  • March 2012
  • February 2012
  • January 2012
  • December 2011
  • September 2011
  • August 2011
  • July 2011
  • June 2011
  • January 2011
  • December 2010
  • October 2010
  • September 2010
  • August 2010
  • June 2010
  • May 2010
  • April 2010
  • March 2010
  • September 2009
  • August 2009
  • May 2009
  • December 2008

Categories

  • Actuarial
  • Cycling
  • Logs
  • Mathematics
  • MIES
  • Music
  • Uncategorized

Links

Cyclingnews
Jason Lee
Knitted Together
Megan Turley
Shama Cycles
Shama Cycles Blog
South Central Collegiate Cycling Conference
Texas Bicycle Racing Association
Texbiker.net
Tiffany Chan
USA Cycling
VeloNews

Texas Cycling

Cameron Lindsay
Jacob Dodson
Ken Day
Texas Cycling
Texas Cycling Blog
Whitney Schultz
© Copyright 2025 - Gene Dan's Blog
Infinity Theme by DesignCoral / WordPress