Computing: Website and Database Programming

Mathematics: Logarithm equations.


1. Solving logarithm equations.
 
Logarithm equations are equations, where at least one of the equation terms is a logarithm expression. Such equations are part of most intermediate mathematics courses and the equations studied usually have one of the following forms:
    logb(a1x + b1) = logb(a2x + b2)
    logb(a1x + b1) = c
    logb(a1x + b1) = logb(a2x + b2) ± logb(a3x + b3)
    logb(a1x + b1) ± logb(a2x + b2) = c
These equations may have one unique solution, or no solution; some of them may possibly have 2 solutions.
Following a brief way how to proceed to solve these equations. For more details, you may want to have a look at my math tutorial: Logarithms and logarithm equations.
  1. If the equation contains sums or differences of logarithms, use the logarithm formulae to transform the equation terms into products and quotients.
  2. Use the logarithm's inverse function (bx) to get rid of the logarithms. You now have a simple equation, mostly linear, sometimes quadratic, in 1 variable.
  3. Solve the simple equation as you usually do. If it is linear, you get 1 unique solution or no solution. If it is quadratic, you get 1 double or 2 different solutions; if the roots are complex numbers, consider the equation having no solution.
  4. Final very important step: Consider all logarithm terms of the original equation and calculate the function's arguments by replacing x with the value(s) found as solution(s). As logarithms are defined only for strictly positive numbers, a negative or zero argument tells you, that the solution, that you found by solving the simple equation, is NOT a VALID solution of the logarithm equation.
2. Logarithm equations online exercise generator.
 
My online web application is based on my Free Pascal desktop application Equations4. Click the following link to view the description of the "Equations4" PC application. As the desktop program, the online application has three difficulty levels and the option to choose between decimal numbers (evaluated with 3 significant decimal digits) or fractions for the solution(s) to be entered. Note, that these options can't be changed during the test.
Use the following link to start the online application. For details about the Perl source code, see below...
3. Logarithm equations Perl script.
 
Click the following link to download the Logarithm equations 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 the number of correct and false answers and the success percentage is displayed.
  • The code concerning the generation of the equation is located in the generateEquation subroutine, that calls GenerateLogTerm and GenerateConstTerm to create the logarithm and constant part of the equation respectively. Depending on the level, otherwise randomly, the function creates an equation of one of the 4 (6) forms described above.
  • The generated equation is solved by solving the corresponding simple equation of the first or second degree (subroutines SolveEquation1 and SolveEquation2 respectively) and then eliminating the solutions that would result in a zero or negative logarithm argument.
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/equations4.pl?action=init">Logarithm equations online application</a>

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