Computing: Website and Database Programming

Mathematics: Two-by-two linear systems.


1. Solving two-by-two linear systems.
 
Two-by-two linear systems are part of most mathematics courses. Such systems are made of 2 linear equations in 2 variables; gerneral form:
    a1x + b1y = c1
    a2x + b2y = c2
The variables x and y must satisfy both equations. The system may have one unique solution (with x and y being unique real numbers), no solution or an infinity of solutions.
If you are not sure how to proceed to solve this kind of equations, you may want to have a look at my math tutorial: 2-by-2 and 3-by-3 linear equation systems.
2. Two-by-two linear systems online exercise generator.
 
My online web application is based on my Free Pascal desktop application Equations2. Click the following link to view the description of the "Equations2" PC application. The application generates a system of 2 equations in their simplest form (just as described above) and the user has to enter the system's solution.
Use the following link to start the online application. For details about the Perl source code, see below...
3. Two-by-two linear systems Perl script.
 
Click the following link to download the Two-by-two linear systems Perl script and all other files needed to run this application on your web server. Have a look at the ReadMe.txt file, included in the download archive, for details about the different files, and where to place them on the server.
The Perl script is rather long and I do not display the source code here. Just some remarks, concerning how the application works:
  • The parameter $action tells the script what to do:
    • init, new: initialize for a new test (default settings for init, previous test settings for new).
    • start, next: generate a new equation (first question for start, all other questions for next).
    • check: check user's answer.
  • The test web page is generated by reading a template file and replacing all custom tags (template lines containing a tag start with '#' and all tags are placed between '#' symbols) by the corresponding actual values. What will be displayed on the page depends on the $action parameter, of course. When all equations are done, an evaluation grid with number of correct and false answers and success percentage is displayed.
  • All code concerning the generation of the equation system is located in the generateSystem subroutine. The function generates 2 random equations ax + by = e and cx + dy = f, eliminating equations where x or y are "missing" in both equations and equations like 0x + 0y = k or 1x + 1y = k. Before being displayed, the generated equation strings are modified by the subroutine formatEquation, that ensures a proper display (correcting expressions like "0x", "-1x" or " + 0", for example).
If you want to place a link to the application on some other page, include the following into this page's HTML:
<a href="/cgi-bin/equations2.pl?action=init">Two-by-two linear systems online application</a>

If you find this page helpful or if you like the Two-by-two linear systems web application, please, support me and this website by signing my guestbook.