[racket] 27.5.4 Gaussian Elimination

From: Ken Hegeland (hegek87 at yahoo.com)
Date: Mon Nov 22 16:17:57 EST 2010

The problem is 27.5.4 can be found at
http://htdp.org/2003-09-26/Book/curriculum-Z-H-34.html#node_sec_27.5

I am still on the beginning of this extended exercise and I am entirely lost. I know how it works but can't get anything even remotely close. I was able to create subtract from 27.5.2, but triangulate eludes me after a few days of thinking. My first thought is to make something that takes either a (listof(listof numbers)), or 3 (listof numbers), and have it output the first part of triangulation.

So for the lolon of '((2 2 3 10)(2 5 12 31)(4 1 -2 1)) I want to produce an answer of
'((2 2 3 10)(3 9 21)(-3 -8 -19))

I feel like applying subtract to first and second in lolon produces (3 9 21), but I am not sure how to make it continue on the rest of the list. I tried (subtract2(subtract(first lolon)(second lolon))), which really doesn't work and it seems obvious to me just from glancing at it.

I am thinking back to how I did merge sort, create a function that merges 2 lists, apply it to the first and second items in a lolon, then recursively apply it to the rest of the list.

In subtract2 my final goal is to apply subtract to the first and second item, then recursively apply it to first and rest of the list, but I can't figure out how to get this. 

I know the real question has to do with applying this over and over to any lists of equal length, until you drop the first position to 0, and maybe I am heading in the wrong direction, but it seems easier to break it into smaller problems. I really want to complete this problem before moving on with the book but I can't find anything that works, everything I think of causes infinite loops and freezes my computer for 10 minutes.



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20101122/7037c171/attachment.html>

Posted on the users mailing list.