It's finals week in Corvallis. Normally I would be bouncing off the walls by now but I am still kind of doing productive work. Office hours were super slow today so I brought some parallel computing code to go over. The computational physics TA just happened to stop by and I talked with him for like an hour and a half about coding and calculating pi. The only final I have left is computational physics tomorrow morning and then I'm done with another term of classes.
I've been assigned to do two labs and a recitation next term, which is new. I'm wondering how many students there will be. When I proctored the final my room was supposed to have 119 students but I only counted 93. That's 26 drops since the beginning of the term in my room alone. And then I had a bunch of students tell me they were switching into 202 next term instead of taking 212. The joke is on them since I heard the non calc sequence is harder than the calc sequence.
Showing posts with label coding. Show all posts
Showing posts with label coding. Show all posts
06 December 2006
30 November 2006
dead week
I only have one more class for this term, although I do have to go in and teach a lab at 3. This morning we had crash course in parallel computing and the physics department's Beowulf cluster - apparently this is going to be a major focus of my computational physics class next term, so I'm kind of looking forward to that. The department just got a whole bunch of dual-core computers and now I'm eager to get some money and build a new desktop. When I get a real job I might be able to afford things like $500 dual-core Athlons.
29 August 2006
sunspot cycles
I discovered that deep within the submenus of Photoshop CS is a tool called Photomerge for putting pictures together as a panorama. I put a couple rough panaoramas from my recent Oregon vacation together. The best part is that as long as you have Photoshop open you can smooth over the seams. I tried putting together a 360 degree panorama from La Jolla, and it looked like it was going to blend pretty well, but Photoshop complained about RAM and quit so I will mess with it tomorrow.
I also wrote a Java program that solves Sudoku puzzles. I needed the practice in Java and I wanted to see how hard it would be. The code is hideous but it can solve the last problem in my Sudoku book in 129,000 operations, which is a trifle for the computer. I guess the algorithm I made up isn't that bad after all.
The rest of today was spent playing Ratchet: Deadlocked and We Love Katamari, but I did register for ECE 417 so I can claim a little progress for the day. More jury duty tomorrow.
I also wrote a Java program that solves Sudoku puzzles. I needed the practice in Java and I wanted to see how hard it would be. The code is hideous but it can solve the last problem in my Sudoku book in 129,000 operations, which is a trifle for the computer. I guess the algorithm I made up isn't that bad after all.
The rest of today was spent playing Ratchet: Deadlocked and We Love Katamari, but I did register for ECE 417 so I can claim a little progress for the day. More jury duty tomorrow.
23 April 2006
pseudo coup
Last week I found a great new way of getting through my three hour business class while staying sane. I take all my class notes on gridded paper so I can do graphs easier. I figured out that I can copy Sudoku puzzles into some of the squares in my notebook and do those while looking like I'm taking notes. And the puzzles only take like a third of the page up so I can put real notes alongside if anyone says anything interesting. This way, I don't go mad listening to proposals about air quality-testing lichens and biodiesel byproduct diapers. I'm glad I'm not an MBA.
I'm doing really well so far in my scientific computing class. After my initial troubles with Java I'm getting the hang of things and I'm probably the furthest ahead in the class by a good margin. For example, last week's program was originally due Wednesday but was pushed to Friday. I was putting the finishing touches on my programs on Monday. This week's programs are different so I want to run some stuff by the instructor before I keep pushing. I think that is an interesting class, it's not just about coding but now we're getting into the physics that can be done with it.
I'm only about a quarter of the way through this new term but I'm getting close to being halfway done with my Master's degree. I'm going to have to start thinking about what I'm going to do for an internship next year. I'm almost out of the PSM core and can start getting into my own classes now. Next year should be good with computational physics, electronics labs and solid state physics.
I'm doing really well so far in my scientific computing class. After my initial troubles with Java I'm getting the hang of things and I'm probably the furthest ahead in the class by a good margin. For example, last week's program was originally due Wednesday but was pushed to Friday. I was putting the finishing touches on my programs on Monday. This week's programs are different so I want to run some stuff by the instructor before I keep pushing. I think that is an interesting class, it's not just about coding but now we're getting into the physics that can be done with it.
I'm only about a quarter of the way through this new term but I'm getting close to being halfway done with my Master's degree. I'm going to have to start thinking about what I'm going to do for an internship next year. I'm almost out of the PSM core and can start getting into my own classes now. Next year should be good with computational physics, electronics labs and solid state physics.
16 April 2006
i think i know my geography pretty damn well
I've finally gotten to grading this week's prelabs. My old red pen has just about had it, but they didn't have any more like it at the store so I bought a couple different kinds and I'm trying them out to see which is best. It's important to find out now because the 213 midterm is next week and that means exam grading. An inferior red pen just won't do.
I kind of feel like I didn't get too much accomplished this weekend, but I did finish the coding for this week's scientific computing homework and that's a major part of my workload for the week. I still think Java is insanely uppity but it'll take more than that to stop me. I did have to write in some bizarre stuff to get it to work fully though.
I kind of feel like I didn't get too much accomplished this weekend, but I did finish the coding for this week's scientific computing homework and that's a major part of my workload for the week. I still think Java is insanely uppity but it'll take more than that to stop me. I did have to write in some bizarre stuff to get it to work fully though.
05 April 2006
culture shock
Spring term has started and I've now had all my various new classes. Comps (quals) ran at the beginning of the week, and Vincent and I just sat on the sidelines and watched as all the other first-years joined in. Vincent and I don't have to take comps because we're PSM. It's just kind of odd because this term I finally start my major deviation from the normal course of physics.
I now have a proper MBA business class, which is composed of about half PSMs and half MBAs. It was kind of funny because there was definitely a bit of culture shock going on there. I thought it was going to be a lecture class, but it's another one of these case study classes which I'm not completely sold on. Still, we're finally getting some business training, which is a good thing.
I'm also in a scientific computing class as a prep for computational physics next year. The odd thing is that my department programs in Java. I don't know why. I don't know Java, but it's loosely related to C++ so I'm getting by pretty well so far. Vincent only knows Fortran so he's having a rougher time. I think I did work with some Java back in my SOAR days, but that wasn't writing code, just kicking it around until it compiled.
In my crash course on Java I'm finding out all these little idiosyncrasies Java has that make me shake my head. It is like C++, but 50 times as uppity. The structure is much more restrictive (like 4x won't be intepreted as 4 * x) and it seems like everything takes twice as many lines as C++ to express (like how declaring an array takes two lines of code instead of one). I tried formatting some numbers, and the process was to use a good sized command to format the number, but it got returned as a string, so it had to be parsed back into a number using another good sized command. It practically took up a full line just to say I wanted less decimal places. And there's some really weird stuff about how it handles objects.
I also discovered one of Java's dirty little secrets - it can't even add properly! For some reason Java can't express the number 0.1 properly. Java's proponents blame it on binary numbers, but C++ certainly didn't seem to have any problems. They claim it doesn't matter unless you're doing taxes or something, but any way you cut it I don't like it when I add 0.2 to 6.0 and get 6.199999999999 back. Not appreciated.
I'm not a big fan of Java.
As for my engineering bug, I made a major find at Borders last weekend. I found the other book by J. E. Gordon, who wrote the slightly eccentric but very interesting book on structures I like. This one (The New Science of Strong Materials, or Why You Don't Fall Through the Floor) is more about material science, but it's still good. I love the way this guy writes, these books are good reads.
I now have a proper MBA business class, which is composed of about half PSMs and half MBAs. It was kind of funny because there was definitely a bit of culture shock going on there. I thought it was going to be a lecture class, but it's another one of these case study classes which I'm not completely sold on. Still, we're finally getting some business training, which is a good thing.
I'm also in a scientific computing class as a prep for computational physics next year. The odd thing is that my department programs in Java. I don't know why. I don't know Java, but it's loosely related to C++ so I'm getting by pretty well so far. Vincent only knows Fortran so he's having a rougher time. I think I did work with some Java back in my SOAR days, but that wasn't writing code, just kicking it around until it compiled.
In my crash course on Java I'm finding out all these little idiosyncrasies Java has that make me shake my head. It is like C++, but 50 times as uppity. The structure is much more restrictive (like 4x won't be intepreted as 4 * x) and it seems like everything takes twice as many lines as C++ to express (like how declaring an array takes two lines of code instead of one). I tried formatting some numbers, and the process was to use a good sized command to format the number, but it got returned as a string, so it had to be parsed back into a number using another good sized command. It practically took up a full line just to say I wanted less decimal places. And there's some really weird stuff about how it handles objects.
I also discovered one of Java's dirty little secrets - it can't even add properly! For some reason Java can't express the number 0.1 properly. Java's proponents blame it on binary numbers, but C++ certainly didn't seem to have any problems. They claim it doesn't matter unless you're doing taxes or something, but any way you cut it I don't like it when I add 0.2 to 6.0 and get 6.199999999999 back. Not appreciated.
I'm not a big fan of Java.
As for my engineering bug, I made a major find at Borders last weekend. I found the other book by J. E. Gordon, who wrote the slightly eccentric but very interesting book on structures I like. This one (The New Science of Strong Materials, or Why You Don't Fall Through the Floor) is more about material science, but it's still good. I love the way this guy writes, these books are good reads.
05 September 2005
incorporated
I watched The Corporation. I thought it was fairly well done. As for the actual content, I agree with some of their ideas but not all of them.
I tinkered with my RSA demo program a little bit, but the stuff I would like to add involve stuff I've forgotten how to do and would generally be a pain.
Overall I had a slow weekend. I am very excited to go home next weekend, but I still have things to do here before I leave. I wanted to take care of some stuff today, but I forgot it was Labor Day so nothing productive could get done. I did get a small fire safe today though, which makes me feel a lot better about keeping important documents out here. Fortunately, banks and stuff are open again tomorrow so I can start attacking my list of things to do again. My virtual Post-It notes are slowly obstructing more and more of my desktop.
I have usually kept Freeman docked at the desk over the past few weeks, but I have recently been taking advantage of the fact that it's a laptop to do computer stuff on the futon. I like my futon.
I haven't gotten out and about too much recently. It would be nice to go out to the coast again, but I am trying to put off filling up the car if at all possible. I am going up to Portland in a few days anyway (though my exact plans are not yet determined - another important thing to take care of). I will be home in Michigan all next week, but again my plans are not yet determined. I do know that I want to get up to MSU and over to U-M at some point.
I played a bit of Counter-Strike: Source over the past couple of days, and I regained some skill, but frankly I am tired of video games right now. I am more interested in becoming a better Go player than in becoming a better CS:S player.
I want to get a bike so I can explore Corvallis without wasting gasoline, but I don't know where to find a decent bike (for a sane price). One more item on my list of things I haven't gotten around to getting yet.
I tinkered with my RSA demo program a little bit, but the stuff I would like to add involve stuff I've forgotten how to do and would generally be a pain.
Overall I had a slow weekend. I am very excited to go home next weekend, but I still have things to do here before I leave. I wanted to take care of some stuff today, but I forgot it was Labor Day so nothing productive could get done. I did get a small fire safe today though, which makes me feel a lot better about keeping important documents out here. Fortunately, banks and stuff are open again tomorrow so I can start attacking my list of things to do again. My virtual Post-It notes are slowly obstructing more and more of my desktop.
I have usually kept Freeman docked at the desk over the past few weeks, but I have recently been taking advantage of the fact that it's a laptop to do computer stuff on the futon. I like my futon.
I haven't gotten out and about too much recently. It would be nice to go out to the coast again, but I am trying to put off filling up the car if at all possible. I am going up to Portland in a few days anyway (though my exact plans are not yet determined - another important thing to take care of). I will be home in Michigan all next week, but again my plans are not yet determined. I do know that I want to get up to MSU and over to U-M at some point.
I played a bit of Counter-Strike: Source over the past couple of days, and I regained some skill, but frankly I am tired of video games right now. I am more interested in becoming a better Go player than in becoming a better CS:S player.
I want to get a bike so I can explore Corvallis without wasting gasoline, but I don't know where to find a decent bike (for a sane price). One more item on my list of things I haven't gotten around to getting yet.
20 August 2005
o lancer evolutions, where art thou?
I went into town today to get a rice cooker because I suck at making rice. The Bed Bath & Beyond here is right next door to the Mitsubishi dealer, so I decided to stop there afterward and take some pics of the Lancer Evolutions. However, when I got to the store I couldn't believe my eyes. The entire Mitsubishi dealership had up and left. No cars. Nobody in the building. Nothing. I swear I saw them open as recently as Tuesday.
Fortunately the car watching was not a complete bust. Just down the street there was a used Honda dealer with an orange Acura NSX.
NSX 1
NSX 2
NSX 3
NSX 4
(My usual image uploading program is broken.)
I ended up going into Staples as well. They actually had a really good deal on bookshelves, so I got two. My apartment is no longer ghetto. Not like I was ever as bad as this guy...
I did not work on the RSA code today. I'm having some kind of problem compiling the library for the new data type I want to use, and I worked on it too much yesterday. Tonight I am going to grade the homework for my recitations, and maybe watch a movie. Tomorrow I think I am going back out to the coast.
Edit: Just finished grading the first of two homeworks. I laugh when I see someone trying to BS me, but then the fun fades when I have to figure out how much of their work is BS and what kind of comments to write. It's so much easier to grade the people that actually know what they're doing. 10/10 - next!
Fortunately the car watching was not a complete bust. Just down the street there was a used Honda dealer with an orange Acura NSX.
NSX 1
NSX 2
NSX 3
NSX 4
(My usual image uploading program is broken.)
I ended up going into Staples as well. They actually had a really good deal on bookshelves, so I got two. My apartment is no longer ghetto. Not like I was ever as bad as this guy...
I did not work on the RSA code today. I'm having some kind of problem compiling the library for the new data type I want to use, and I worked on it too much yesterday. Tonight I am going to grade the homework for my recitations, and maybe watch a movie. Tomorrow I think I am going back out to the coast.
Edit: Just finished grading the first of two homeworks. I laugh when I see someone trying to BS me, but then the fun fades when I have to figure out how much of their work is BS and what kind of comments to write. It's so much easier to grade the people that actually know what they're doing. 10/10 - next!
18 August 2005
93 is not prime
I found the bug. It did not involve a 216-digit number. Part of my problem was some of my inputs. For example, I typed in 93 as a prime without thinking. There were also problems with actual primes though. I had Mathematica double check some of my program's numbers, and I found a disagreement in certain cases. I figured my program might be blowing out variables again and made everything an unsigned long long. I was right - everything works great now. My RSA keygen program can be very slow though, if anyone knows of a good algorithm for e * d = 1 mod phi, solve for d, let me know.
Edit: Never mind, I figured it out. The way I was doing it was horribly inefficient. My keygen is fast now and works most of the time, but I think I'm blowing out variables again. I am not going any further until I find a better data type.
I also remembered, I get paid tomorrow! About damn time.
Edit: Never mind, I figured it out. The way I was doing it was horribly inefficient. My keygen is fast now and works most of the time, but I think I'm blowing out variables again. I am not going any further until I find a better data type.
I also remembered, I get paid tomorrow! About damn time.
generator
Today's physics recitations went much better than yesterday's. I used more of my natural teaching style today. Fewer people showed up today, which is a little discouraging, but at least the few people that show up probably want to be there. Small groups are easier to work with anyway. I collected their first homework problem today but I haven't looked through the stack of papers yet.
The math thing I worked out yesterday is used in the actual process of RSA encryption and decryption. Now I'm working on my RSA key generator, which is a mess. After I first coded it, I found there was some kind of nasty bug that made the keys not work. I replaced a chunk of code and checked my prime number generator, but the problem is still there (maybe even worse). If I can work out this bug it would be a good coding day.
I ran across an article today about a company that uses Stirling engines with solar collectors. That's pretty smart. So this morning I was looking at solar power stuff and coding RSA stuff, instead of preparing for my recitations.
The math thing I worked out yesterday is used in the actual process of RSA encryption and decryption. Now I'm working on my RSA key generator, which is a mess. After I first coded it, I found there was some kind of nasty bug that made the keys not work. I replaced a chunk of code and checked my prime number generator, but the problem is still there (maybe even worse). If I can work out this bug it would be a good coding day.
I ran across an article today about a company that uses Stirling engines with solar collectors. That's pretty smart. So this morning I was looking at solar power stuff and coding RSA stuff, instead of preparing for my recitations.
17 August 2005
need for speed
I had my first recitations for the new session's physics class today. It went pretty rough. The class is non-calc E&M. I think I like the calc-based classes better. I was supposed to go through three problems, but I got through one in the first recitation and two in the second. On top of that, I got the late afternoon sessions, everybody's already spaced out by then. Fortunately I only have six more work days for this session. One is tomorrow. Hopefully in the fall I can snag a calc-based physics TA spot.
I killed the time between recitations by going over the new modular exponentiation algorithm I found a couple days ago. It's really not so much the math that's the clever bit as the implementation in the code. I put it into my program and ran it side by side with the old method. I was expecting maybe Corvette vs. Model T results. It's more like the speed of light vs. a Model T. Probably worse. The new method is so fast that its processing time doesn't even register, even when I max out the new unsigned long long variables. Here is why the new method is faster:
Problem: 4353^(10^18) mod 13562
Number of operations required for old method: 10^18.
Number of operations required for new method: 60.
So I'm using the new method from now on.
I'm somewhat tempted to get bigger numbers, but I estimate that even the mythical thousand digit data type would take 3325 operations at most. Working that out proved that the algorithm goes as the log of the exponent. Somebody somewhere was very clever indeed.
I might poke at the RSA stuff a little more tonight, but more likely playing the pirate game and going to bed early.
I killed the time between recitations by going over the new modular exponentiation algorithm I found a couple days ago. It's really not so much the math that's the clever bit as the implementation in the code. I put it into my program and ran it side by side with the old method. I was expecting maybe Corvette vs. Model T results. It's more like the speed of light vs. a Model T. Probably worse. The new method is so fast that its processing time doesn't even register, even when I max out the new unsigned long long variables. Here is why the new method is faster:
Problem: 4353^(10^18) mod 13562
Number of operations required for old method: 10^18.
Number of operations required for new method: 60.
So I'm using the new method from now on.
I'm somewhat tempted to get bigger numbers, but I estimate that even the mythical thousand digit data type would take 3325 operations at most. Working that out proved that the algorithm goes as the log of the exponent. Somebody somewhere was very clever indeed.
I might poke at the RSA stuff a little more tonight, but more likely playing the pirate game and going to bed early.
15 August 2005
cypherpunk
And so another week begins. I spent most of my weekend in pirate-related activities, either playing my new game or reading my pirate book. Today I have a meeting with the prof I'm TAing for. Since this summer session is only three weeks long, I'll probably be pretty busy for the next couple of weeks.
I found my cryptological mathematics book and I've been flipping through it. Last time I got into this crypto stuff I wrote a couple short C++ programs to do the hard math stuff for the RSA algorithm so I could see how it worked. I looked at them briefly yesterday and I think they can be improved. I used a method from abstract algebra that will actually let the computer calculate things like 4353^53216 mod 13562, but there are always better ways. If you just tried calculating it directly, the number would blow up and wouldn't fit in any variable type. Using the abstract algebra method, it actually works and the processing time goes as 53216 for the above example. Wikipedia's article on modular exponentiation actually has a better way, so I printed the article off and I'm going to see if I can work through it. Wikipedia claims the processing time of this new method goes as log (53216), so I want to try it out.
(The answer to that example is 4059, by the way.)
Edit: After an embarassingly long time trying to calculate processing time (I'm no hardcore coder), I quickly showed that the processing time is indeed directly related to the size of the exponent. I kept adding zeros at the end, and the time went from 4.5ms to 4.5 seconds or 45 seconds. I might try for 450 seconds when I look over new method again, and 4500 seconds when I go to my TA meeting.
Edit 2: I tried for the 450 second run, but it turns out the required exponent was larger than my data type could hold. After blowing out several other data types I'm currently using something called an unsigned long long, which I'd never heard of but is capable of storing values up to about 18.4 quintillion. The unsigned helps with that, and for some reason it also runs faster than a standard variable. So basically I've been doing some data type optimization so I can run some serious benchmarks. Now that that's settled, I'm going to try for 300 and 3000 second runs.
I found my cryptological mathematics book and I've been flipping through it. Last time I got into this crypto stuff I wrote a couple short C++ programs to do the hard math stuff for the RSA algorithm so I could see how it worked. I looked at them briefly yesterday and I think they can be improved. I used a method from abstract algebra that will actually let the computer calculate things like 4353^53216 mod 13562, but there are always better ways. If you just tried calculating it directly, the number would blow up and wouldn't fit in any variable type. Using the abstract algebra method, it actually works and the processing time goes as 53216 for the above example. Wikipedia's article on modular exponentiation actually has a better way, so I printed the article off and I'm going to see if I can work through it. Wikipedia claims the processing time of this new method goes as log (53216), so I want to try it out.
(The answer to that example is 4059, by the way.)
Edit: After an embarassingly long time trying to calculate processing time (I'm no hardcore coder), I quickly showed that the processing time is indeed directly related to the size of the exponent. I kept adding zeros at the end, and the time went from 4.5ms to 4.5 seconds or 45 seconds. I might try for 450 seconds when I look over new method again, and 4500 seconds when I go to my TA meeting.
Edit 2: I tried for the 450 second run, but it turns out the required exponent was larger than my data type could hold. After blowing out several other data types I'm currently using something called an unsigned long long, which I'd never heard of but is capable of storing values up to about 18.4 quintillion. The unsigned helps with that, and for some reason it also runs faster than a standard variable. So basically I've been doing some data type optimization so I can run some serious benchmarks. Now that that's settled, I'm going to try for 300 and 3000 second runs.
Subscribe to:
Posts (Atom)