Solver input section

From Algebra.Com's Help
Jump to: navigation, search

This article is part of the help section on Defining solvers.

A solver must have an input section. There are several reasons for having an input section:

  • To define the text of the problem to be solved that would be displayed to a student
  • To define the variables that are inputs to this solver. Remember that other people may use (invoke) your solver as part of their own solutions, so as to not reinvent the wheel. For example, a linear system solver can be invoked by a typical age word problem. These variables are what they have to pass on to your solver to invoke it properly.
  • To help the automatic solver verifier use the check section to check if certain inputs produce desired outputs.
  • To use this section in worksheets that could be autogenerated from your solver.

An input section is defined similarly to other section. In the text of your solver, on a new line, from the beginning of the line, type

==section input

Then proceed and type your input. Example:

==section input
Bob is *[input diff=24] years older than Jane. In *[input after=20] 
years he will be *[input times=2] times older than Jane. What are 
Bob's and Jane's ages now?

As you can see, special tags are used in this section. The tag is defined as follows

*[input name=value]

This defines an input variable named "name", with the default value of "value". Note that a student using this solver could customize it to use a different value (which is the whole point).