tags:

views:

271

answers:

4

I would like to use Python to generate my own algebra to pre-calculus worksheets to print and use. The purpose is to teach kids how to practice algebra. What is the best way generate the expressions?

Update:

I am planning to use Latex to generate nicely formatted equations.

The question I have is how to come up with a large number of the equations. One way of doing this is to define the list for each topics but this is tedious. I want to automate using some kind generator (e.g. Context Free Grammar)

+2  A: 

If you want to generate nice looking typeset equations, you should probably output LaTeX code, which can then be compiled into pdf, dvi, postscript, or what have you. There are a few python libraries for this, but it's just text so generating it shouldn't be much of a problem once you know how it works. Alternatively, you can embed python code into a LaTeX document using something like this. In any case I haven't tried any of the python libraries for this so I can't really recommend any of them.

kwatford
+1  A: 

My approach to this problem would be to write a Python script to generate a LaTeX document which could then be compiled into a PDF document to be printed.

las3rjock
A: 

Perhaps this or this or this might be helpful!

Andrew Siemer
+1  A: 

I assume that you want Python so that the sheets are different.

One way to do this would be to generalize the structure of an equation. The simplest ones are properly those that are of the form:

a*x+b*x+c=d*x+e*x+f

(any of the values can be 0, and they need not be distinct). Then I would suggest you simply constructed a method to return the latex code to typeset such an equation, which puts in random values for a, b, c, d, e and f.

You can then call that method as many times a you want different equations.

tomjen