Algorithms and Data Structures for Engineering, FALL 2012
Implement a solver for a linear system of two equations with two unknowns x and y:
a1x + b1y = c1
a2x + b2y = c2
Your program has to read the six coefficients of the system, and
implement any valid strategy for finding x and y. Assume all numbers
(coefficients, unknowns) are real numbers. You cannot use an existing
specialized subroutine (in any language or OS library) that solves the
system, but you can read a technical solution (say here) instead of coming up with one. You may be required to demonstrate a authorship-like understanding of the code.
Make sure to handle properly "corner-cases". While most of the time there is an unique solution.. :
- It is possible to have many solutions (an infinite number), in
which case you have to specify the nature or dependency of the solution
: for example something like "for any x value, y=100-3x makes
(x,y) a solution".
- It is possible to have no solution at all, in which case your program should report so.
For this assignment, you are required to also write the pseudocode (or
"plan") of your implementation - do that before you start coding, it
will simplify things a lot. As said in class, the syntax of the
pseudocode is not very important, as long as:
The pseudocode can be written on paper, or in an text editor, or in a
technical editor. You can submit it by email (scan if written on paper)
together with your code file, or you hand it to the TA.
- The TA can understand your algorithm
- It has to be consistent with your code.
EXTRA CREDIT: The same problem, but assume the coefficients and the unknowns are complex numbers.