Computing: Website and Database Programming

Mathematics: Linear equations in 1 variable.


1. Solving linear equations in 1 variable.
 
Linear equations in 1 variable are part of any basic mathematics course. Such equations have the general form:
    ax + b = 0
and may have one unique solution, 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 the first part of my math tutorial: Linear, quadratic and cubic equations in one variable.
2. Linear equations in 1 variable online exercise generator.
 
My online web application is based on my Free Pascal desktop application Equations1. Click the following link to view the description of the "Equations1" PC application. The equations generated have one of the following forms:
    a1x + b1 = a2x + b2
    m(a1x + b1) = a2x + b2
Grouping the x-coefficients and the constants, will always lead to the general form of a 1-variable linear equation: ax + b = 0.
Use the following link to start the online application. For details about the Perl source code, see below...
3. Linear equations in 1 variable Perl script.
 
Click the following link to download the Linear equations in 1 variable 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 is located in the generateEquation subroutine. There will be about 1/10 of equations without solution, 1/10 with an infinity of solutions, the rest with one unique solution. One half of the equations will be of the type a1x + b1 = a2x + b2, the other half of the type m(a1x + b1) = a2x + b2. Before being displayed, the generated equation string is 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/equations1.pl?action=init">Linear equations in 1 variable online application</a>

If you find this page helpful or if you like the Linear equations in 1 variable web application, please, support me and this website by signing my guestbook.