[racket] 27.5.4 Gaussian Elimination
On 22/11/2010 21:17, Ken Hegeland wrote:
Hi Ken, you're very close to a solution :-)
> 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.
I'd recommend you go with the (ListOf (ListOf integers)).
> 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))
This example looks correct to me, the result of subtracting '(2 2 3 10)
from each of the lists in '((2 5 12 31) (4 1 -2 1)), until their
respective first elements become zero.
> 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.
Think back to section 21 of HtDP, can you see anything that might help
you with this problem?
Be sure to test this function carefully once you're done!
Best of luck,
Horace.