Showing posts with label Computer Science. Show all posts
Showing posts with label Computer Science. Show all posts

Friday, March 07, 2008

Live 3D Graphics With Excel

Every time I get a chance to watch one of our finance folks over at MobiTV wield a spreadsheet, I learn some new tricks. Those financial analysis folks steeped in the arcane features of Excel seem to be able to make the software package produce ever more astounding and useful models of increasingly complex systems.

But this one takes the cake. Check out this really cool implementation of a 3D graphics rendering engine. IN EXCEL! Peter Rakos over at Gamasutra outdid himself.


This image and video pair shows the rendering system using a simple display that colors the native Excel spreadsheet cells as the calculations are being performed.





This image and video pair shows the same program using the Microsoft Office Graphics Abstraction Layer to do the rendering instead of using writes to the spreadsheet cell.




Even better, some of the spatial layout and cell computation models of spreadsheets turn out to be very useful in designing and presenting very compact and elegant representations of the rendering pipeline. This design and layout in the 2-D spreadsheet grid is massively easier to see and understand than all the simple linear text files that I coded up in my college graphics course. It also makes the interrelationships and cell/function dependencies immediately obvious, and debugging is trivial with live previews of the calculations while the program is running. High cool.



"The yellow color marks the user-defined parameters and green color indicates the engine-calculated values. Numbered areas contain the following data:

  1. Parameters of the perspective projection
  2. 3D coordinates of the objects' points (relative to their center)
  3. Shift and rotation matrix (further details can be found e.g. at http://en.wikipedia.org/wiki/3D_projection)
  4. Parameters of the rotation
  5. 3D absolute coordinates of the points after the shift and rotation
  6. 2D coordinates of the points after the perspective projection
  7. Screen coordinates of the points
  8. End points of the objects' edges
  9. Formula of an element in the shift and rotation matrix. Simplicity and compactness are clearly visible."



    Now I don't think anyone currently expects this to evolve into a real 3D simulation system, but it does point to some very interesting 2D layout programming paradigms that might very well turn out to be VERY useful in developing more complex software. It wouldn't surprise me if the professional code development environments evolve towards this sort of thing within the next few years. And of course, 3D environments are just a step away.

    And I have a whole new animation tool for my next presentation!

    Check out the whole post here.

    Friday, June 22, 2007

    A Mechanical Marble Computer

    Matthias Wandel has developed a fantastic mechanical binary adding machine using a simple series of cascaded chutes to store numbers and perform carries through mechanical toggles. Don't miss the video embedded below to see it in operations.


    Marble Adder






    Ingenious!


    More details can be found on his web site: www.Woodgears.ca along with all manner of interesting contraptions.

    Wednesday, May 23, 2007

    Teach Kids to Program

    Last weekend, my wife and I took the kids to the Maker Faire, where I ran into some folks from MIT's Lifelong Kindergarten group. I would have to say that of the whole Maker contingent, they were showing the most refined educational tools of the bunch, kits and software to teach young children how to program.

    The Scratch programming environment (download Scratch for free here) was designed to eliminate the requirement that a programmer understand code syntax and grammar before being able to do anything useful. The main tool here was to devise a simplified language encapsulated in graphical blocks with shapes that only fit together properly when slotted in the right order and positions.



    The software package includes mechanisms for a host of graphically interesting drawing, sprite control, and audio effects, as well as a built-in mechanism for code sharing and community building. Don't miss the project pages to check out all the cool code a host of kids have already written.

    moving animation carddance twist scratch card

    One thing that I particularly about the Scratch system is that they have included a physical interface component called the Scratch Board, that allows children's programs to interact with the real world with sensor blocks, buttons, sliders and so on, each paired with a programming element in the software. Now they can learn to write code, and connect it to the real world!

    You can check out a nice intro Scratch video here:


    Another project on display from the Playful Invention Company [PICO] which grew out of the same group at MIT was called the Pico Cricket. The cricket kit is basically an extension and refinement of Scratch that includes smart blocks designed to interlock with Legos.



    A lot of thought and work has gone into making the programming element even more clear, and the external components more bulletproof, dare I even say kid-proof. For example, each block that houses a sensor or processor or motor has a chip in it which identifies itself and automatically configures the use of interconnecting wires, so you don't have to worry about how any system is wired together, you just connect them with wires that are all identical in the same way.

    pico cricketmotor and motor board

    displaysound box

    touch sensorlight sensor

    resistance sensor

    Order your Pico Cricket kits here.




    For more developed students in higher grades, don't miss Hackety-Hack, a cleaned-up (free) version of Ruby/smalltalk with a very nice community and instructional environment packaged around it. This is for the kids who outgrow the limitations of Scratch and are up for the rigors of typing the syntax themselves.




    The amazing thing about this system is the thought that went into incorporating a fantastic Internet, web, and graphics library that is very powerful. As an example, you can implement an entire blog with in six lines of code:
    blog = Table("MyBlog").recent(10)
    Web.page {
    blog.each do |entry|
    title entry[:title]
    puts entry[:editbox]
    end
    }
    This testimonial from the web site says it all:

    Our 8th grader reporting in: did Lesson Four in about 10 minutes but kept hacking for another 20 minutes. Today, video games lost the battle with Ruby. Unprecedented!
    — Brian D


    In researching the effectiveness of these tools, I came across a fantastic blog documenting both the opportunities and potential pitfalls surrounding the use of all these new technology tools to teach 5th grade integrated technology classes. Check out how ENGAGED and excited SOME of these kids are to be creating their own widgets and discovering things on their own! Others seem stuck without the proper guidance. (mostly stuck on the programming parts.)





    I was also led, inevitably to the Playfull Inventing & Exploring effort [PIE]. From their site:

    PIE (Playful Invention and Exploration) is an approach to using new technologies that integrates art, science, music, and engineering. The main goal of PIE is to enable and inspire more people to create, invent, and explore -- using a combination of traditional craft materials and new digital technologies.

    PIE projects and workshops make use of Crickets, small programmable devices you can use to create your own musical sculptures, interactive jewelry, communicating creatures, and other playful inventions.
    The PIE approach was developed through a collaboration of six museums with MIT Media Lab, with support from the National Science Foundation. (For background on the project, see the PIE Network grant proposal.)

    I couldn't have said it better myself.

    Thursday, April 12, 2007

    The Steady March of Progress

    From TechEBlog, check out this 5 MegaByte hard disk from 1956.


    Friday, October 27, 2006

    A Snowflake Closeup

    I first found this image on Chet Ramo's Science Musings blog, and just stopped to look at it for a while. (click on the image to view a high resolution version.)



    At first glance, it doesn't really look like a snowflake. In actuality, it is an image of several snowflakes of differing conformation (I counted about eight different varieties) that have been sputter coated with platinum at a very low temperature (in order to make them conductive) and then imaged with a Scanning Electron Microscope equipped with a low temperature stage. The resulting gray-scale image formed by the electron beam was then digitally colored just as the old black and white movies have been "colorized" to result in the above "false color" image. Here's a picture of the specific unit that was used to take this image.

    Hitachi S-4100 field emission Scanning Electron Microscope
    Check out more details on the equipment here, and the original source of the snowflake crystals images here, and here.

    Saturday, September 23, 2006

    Electro-magnetic Propulsion

    For those of you that dream of one day owning your very own X-34 Land Speeder, the Force is indeed with you, for there is new hope that such a levitating craft might actually be possible.



    There is an interesting article in the September issue of New Scientist that describes a new type of not-quite-rocket engine that uses a novel closed microwave resonant cavity with a geometry that exploits relativistic frames of reference to generate thrust without actually expelling anything.

    At first blush, the idea would seem to violate what we know about Newton's laws and the "equal and opposite reactions" that have historically driven traditional rocket engines. But according to this theoretical paper by Roger Sawyer, Einstein's rules of relativity can be exploited to generate thrust without a traditional propellant. The general idea is that the momentum transfers calculations between the trapped resonating microwaves must be done in the photons' frame of reference. When you work out the math around the truncated cone cavity shape, you end up with thrust in the cavity's frame of reference despite the fact that nothing is emerging from the cavity.

    European scientists are generally skeptical, but the initial laboratory tests have demonstrated greater thrusts than the recently launched ESA Smart satellite's ion drive. Better yet, the so-called EM drive reached this performance level without requiring any fuel other than electricity to power a magnetron (a source of microwaves, common to any microwave oven), and all that from an engine that weighs about one tenth of even the very latest ion-engine alternative plus propellant payload.

    Indeed, it sounds too good to be true, but NASA is taking a serious look. Here is a diagram from the article:

    The image “http://www.newscientisttech.com/data/images/archive/2568/25681401.jpg” cannot be displayed, because it contains errors.


    While a great deal of work would certainly remain in order to improve the new engine efficiency and output to levels useful on Earth, the prospect of having electronically controllable thrust without any emitted blast or heat is an awesome prospect that could change the face of transportation overnight.

    If feasible, I would expect the principle challenges to be in managing high energy densities inside a resonant cavity without expansion, warping, slagging, or other mechanical failures that would ruin the Q (or peak resonance and energy storage capability) of the cavity.

    Definitely worth a look.

    Saturday, September 02, 2006

    Biomimetic Digital Photography

    Or, How to Make Your Camera Work More Like Your Eyes

    Anyone who has ever tried to snap a few photos with a modern camera has probably felt the frustration that the camera often fails to get the exposure quite right, with things that you can see clearly either washed out and over-exposed, or invisible in the shadows. The intrepid among you may have even gone so far as to turn the switch to manual, only to discover that it is really hard to do too much better than the automatic system. You end up with these types of exposure-bracketed images:


    The sky detail is only visible in the lower exposure (faster shutter speed) and the building detail is only visible in the higher exposure. And yet when you look directly at the scene, everything is clearly visible to the naked eye. The reason for this is that through an amazing combination of the iris' aperture dilation, and the logarithmic response of the photo-receptive neurons in retina, the human eye automatically adapts to an incredibly broad range of illumination intensity as it scans across broad scenes. A camera, on the other hand, must use the same exposure aperture and sensitivity settings across the entire image, and the photo-detectors have a linear response curve.

    As a result, a camera's dynamic range (the number of discrete brightness gradations it can detect) is much more limited, and the same range is applied across the entire field-of-view. This means that in scenes with wide illumination variations, typical photographs fail to capture details on either the bright side, or the dark side.

    But there is a growing field of photography called "High Dynamic-Range Imaging" that combines multiple photos of varying exposure to artificially expand the dynamic range of a final composite image. The technique has demonstrated amazing results. Here is the final photo created using the three exposures above. (examples from this site)




    Here are some other before and after sets that demonstrate the power of this technique.




    This photo shows a great solution to the canonical problem of imaging a bright outdoors from inside a much darker room. Here is an example applied to portraiture:



    There is definitely an art to assembling the images, because if the technique is applied to aggressively, the resulting images look a little surreal. Here are some more examples from a great web site that are on the edge, but still very interesting.

















    And of course, these same techniques are critical to processing photos of astronomical objects. All you need are a few photos and some photo editing software like Photoshop or Paint Shop Pro. And with the great proliferation of interest in these techniques, there is already a large community of web sites hawking the latest techniques and even automated Photoshop plug-in software. Here are a few of my favorites:

    Cybergrain.com
    Modern HDR Photography
    NatureScapes
    Photomatix


    Go forth and process.













    Monday, August 21, 2006

    High School Computer Science: Then and Now

    Throughout kindergarten and elementary school, I pretty much took my educational environment for granted. In fact, one of the first times I ever thought my school was really cool occurred about halfway through the fall semester of seventh grade algebra when our teacher, Mr. Lunsford, showed up one day in 1977 with a short paperback manual for a WANG 3300 Mini-Computer. (here is a link to the actual manual!, and some press clippings from the type of the device's first commercial availability),

    After a short 45 minute introduction to programming in BASIC, he escorted us hormone-hyped junior-high kids upstairs through the packs of upperclassmen to the third-floor computer lab. It was a rather small room with a window a the far end, filled with nervous students hovering over what looked like strange chattering typewriters on steroids. It didn't seem all that groundbreaking at first, but when realized you could program ANYTHING into the machines, it became difficult to tear me away from the place. When I found out that we were to be allowed open and generally unsupervised access to the lab during study hall so that we could nominally work on our algebra programming assignments, I caught my first glimpse of proto-nerd heaven. Up until that point, what I would have to classify as my pre-hacking era was comprised of fiddling with the programmable calculators and plastic computer models my father had brought home from work.
    But holy cow, the 3300 was a SERIOUS COMPUTER! It had an 8-bit CPU running at a clock speed of 0.625 MHz, with about 4 KB of memory storage, a BASIC language interpreter, and supported both teletype terminals with punched paper tapes and magnetic tape cassette storage that could transfer 300 whole Bytes per second! Here is a photo of one of the 3300 and a teletype (on the right) complete with punch tape system in the wild. The school must have dropped about $30,000 (in 1970 dollars) on the whole setup. Note that this was a ground-breaking time-sharing system that could support up to 16 terminals and was touted as going for less than 1/4 the cost of subscription or other in-house computing solutions.


    I came to know and love all of the idiosyncrasies of the finicky teletypes, and all the tricks to repairing and splicing the delicate tapes on which you would store programs via ASCII codes punched as holes in the tapes. This early version of the BASIC language only had a couple dozen instructions and operations (check the manual link above for the details), there was no really coherent curriculum, and the only way you could really interact with a program was to have it type different things on the cheap recycled paper rolls. But it didn't matter. For the first time, there was absolutely no limit to what I could build at school. We wrote simple quiz programs, played with banners and ASCII art, and made all sorts of text adventures. There is probably a whole generation of computer hobbyists who still laugh when they see "XYZZY", or "PLOUGH," and shudder just a little bit when they see the words "You are in a maze of twisty little passages, all alike," or "Tell me how you feel about Race Cars?" (Bonus points to anyone that can name the ORIGINAL programs in a posted comment!)

    ASR-33 Teletype.And yes, we did some computer homework, but after effectively living in the computer lab for some time, the assignments bordered on trivial 20 minute exercises. The real value came from the unbounded vistas of creativity that demanded you invent your own problems and challenges, and the unfettered access to a powerful tool that could help you solve them directly.

    One thing that I really took for granted at the time was that it was possible to repair the mechanical components of the computer rather easily. Fixing broken tape feed mechanisms was no simple task, as the picture below of an undressed teletype shows, but the beauty of these suckers was that you could take the things completely apart and really see how every mechanical part worked. This level of hands-on access is something that just isn't possible with today's density of integration that now sports microchip features smaller than the wavelength of visible light.

    M33-ASR-Gil-Front-Cover-Off-400w.jpg

    Some time around 1980, the school upgraded to a Digital Equipment Corporation PDP-11 computer, that came with the first ever commercial Video Display terminal, theVT-100 pictured below. You could actually send special sequences of character codes to the terminal in order to position the cursor anywhere on the 80x42 character grid and type any letter you wanted! It may not sound like much now, but it was a BIG step from typing on rolls of paper. At this point, my nascent consulting business helping students program their math assignments bloomed into a full-blown video game design and distribution business.

    The highlight of the whole era for me, was when my mother ratted me out to the school's Dean, one authoritarian named Mr. Patton. Up until that point, Mr. Patton's primary targets had been the class-skipping scofflaws and people who (shocking!) wouldn't wear any socks, a peculiar preoccupation that I never really understood. My mother had become concerned because she noticed I seemed to be flush with cash all the time with no obvious source, at a time when I was also seen to be inseparable from a small cigar box with dubious contents. Being ever the responsible parent, she immediately notified the school of her concerns.

    So there ensued a priceless moment, when Mr. Patton confronted me in the school hallway and asked if I had any drugs in my cigar box. When I opened the lid to reveal sets of neatly rolled paper tapes containing programs for games and programming assignments, let's just say there was a moment of confusion. But Patton's authoritarian instincts were not to be trifled with, and a few more minutes of inquiry eventually led to an extended series of meetings with the Honor Council and computer lab proctors. Had I cheated and thereby violated the school's hallowed honor code by doing other people's computer homework for them?

    Fortunately, I managed to get off with a warning because I had never actually sold solutions to the homework problems themselves, only example programs that were similar to the assignments combined with debugging assistance. So they could hardly bust me for doing what the computer lab instructor should have been doing instead of sipping coffee in the teacher's lounge. And while the whole debacle was very educational technically, business-wise, and socially, it did change my relationship with the "management" leading me in a more independent direction.

    While those were certainly important lessons for me, something even more important happened to the computer program. When the PDP-11 machine was finally coming on line, complete with personal password-protected accounts (a first for the school), and a whole 512 KB of hard disk storage space reserved for each student's account, and a very clear and simple VT100 video interface that replaced all the paper tape and typewriter paper roll frustration, computer programming started to get much more popular. Advances in technology had made computer science more accessible to the easily frustrated.

    VT100 terminal.

    At first blush, this sounds like a great thing. And it was, for a while. But as interest grew, the fact that there was only one VT100 terminal and one DEC dot-matrix teletype (nominally the administrative console) shared across about 600 high and junior high school students became a real problem. Out came the sign-up sheet. Soon new rules arose to limit the use of the machine for homework assignments only. Experimental and gaming use died almost overnight, and as the opportunities for creative use ended, so did my personal interest in computing. It wasn't until several years later at Cornell University that Steve Jobs had donated enough Macintosh computers to essentially provide one for every technical student to learn the new structured language called Pascal, that my interest in computing was revived. While well-intentioned, the school administration's decision to limit the use to classroom assignments was ultimately short-sighted and failed to appreciate that the most important lessons learned in the lab had nothing to do with any assignment. They ended up killing what they hoped to foster.


    ================================

    Today, almost thirty years later, the computing technology scene is, quite literally, a different world. My latest wristwatch has more computing power than the old Wang 3300 did. But troublingly, the way computer science is generally taught in high school really hasn't changed all that much. There is generally a lab with a few computers shared by many students, and usage is closely regulated. Sure, the processors are more capable and faster, and user interfaces are sexier, but the operating systems are more bloated and the dynamic of one computer for every 20 kids or so is still just as limited.

    I would propose some important changes to those types of curricula that could significantly update computer science instruction and offer interesting support for other scientific and technical studies at the school.



    This little board was designed by some friends form my MIT days. The board and kits can be purchased here, where full assembly and operations instruction manuals are also available. The processor runs at 8MHz, over 16 times faster than the Wang 3300. A complete electronics novice can build this computer from it's most basic component parts in under 2 hours using these directions, and the total parts cost is around $12.75 if someone with initiative orders them directly from Digi-Key, or $17 in a pre-collected kit of parts. The device can be programmed in both Assembler or in C, and there is plenty of room in the break-out area to add more electronics for experimental purposes.

    What if my old high school was willing to make another investment today of comparable value to that invested in the 1977 computer lab? Adjusting for inflation based on relative GDP per person, $30,000 1977 dollars is worth about $100,000 in 2006 dollars. The school could then afford to purchase more than 5 of these computers PER STUDENT and still have a lot left over for spare parts and expansion components and even a part-time instructor to boot. (pun intended)

    Imagine how cool it would be if every student at the school could build 5 computers, understand what all the component parts do, debug them, program them, connect them to LEDs, photo-cells, temperature sensors, drive motors and use them for experiments in the science class, and go through five generations of engineering evolution. The applications are endless. Come on, admit it. It sounds MUCH more interesting than sitting in front of a PC doing boring homework assignments doesn't it?

    Imagine the innovation!

    Seems like a tiny investment in both time and money for an enormous payoff. How can we make this happen?



    p.s. keep in mind that this is just a starting point, and if you really make a serious attempt to introduce this sort of experimental opportunity, be prepared to support the inevitable explosion of interest, and the demand for ever more powerful and capable components to build an unlimited array of widgets. Fortunately there is a very large number of computing and electronic components available to build whatever you damn well please. Just start thinking about budgets and test equipment early.