I've made a few tests on using sympy as a CAS back-end in moodle.

So far its just a filter (restricted to use in questions - as the filter sends

python code to the server). The test I've done now works like this:

____________________

pycas:

b = 4*x**5

a =integrate(b,x)

integral = "%s" % a

integral = integral.replace("**","^")

print "a:%s" % integral

print "b:$%s$" % latex(b)

The integral of {$b} is {$a}

____________________________

The python code is run and the resulting array of strings is used to

substitute variables like {$xxx} in the question-text.

In the example we susbstitue {$a} for the integral and {$b} for the latex expression. The integral is printed as straight string (no latex) so that

the student can match it with her answer.

This displays as

_________________________________

The integral of is |____|

_________________________________

The answer is checked against (2/3)*x^6

I'll most likely make a question type that uses sympy to check the answer

so that 2/3*x^6, 4/6*x*x^5 etc will be accepted.

## Mathematics tools

### sympy (Symbolic Python)

This discussion has been locked because a year has elapsed since the last post. Please start a new discussion topic.