Computing: Website and Database Programming

Mathematics: Three-by-three linear systems.


1. Solving three-by-three linear systems.
 
Three-by-three linear systems are part of most mathematics courses. Such systems are made of 3 linear equations in 3 variables; gerneral form:
    a1x + b1y + c1z = d1
    a2x + b2y + c2z = d2
    a3x + b3y + c3z = d3
The variables x, y and z must satisfy all three equations. The system may have one unique solution (with x, y and z 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. Three-by-three linear systems online exercise generator.
 
My online web application is based on my Free Pascal desktop application Equations3. Click the following link to view the description of the "Equations3" PC application. The application generates a system of 3 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. Three-by-three linear systems Perl script.
 
Click the following link to download the Three-by-three 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 3 equations of the form ax + by + cz = d, eliminating systems with less than 3 variables, where in any equation 2 coefficients are "missing". About 10% of the systems generated will have no or an infinity of solutions, the rest having one unique solution. 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/equations3.pl?action=init">Three-by-three linear systems online application</a>

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