A simple way to parse/check equations?



On 10/9/07, Juhana Antero Yrj?l? <jayrjola at cc.hut.fi> wrote:

> Thank you for your speedy responses. This is not a school work is a real
> job related stuff. This function is needed in an online learning
> enviroment, where it checks that student has valid answer(no wrong
> function calls and stuff like that). So it takes about pretty much any
> equation, with right syntax(this can be assumed) and
> then displays the problem parts to a student.

Maybe what you need is the built-in function is(foo = bar) or
is(equal(foo, bar)).
is(foo = bar) tests to see if foo is identical to bar, so e.g.
is((x + y)/2 = x/2 + y/2) => false. is(equal(foo, bar)) tests for
equivalence, so is(equal((x + y)/2, x/2 + y/2)) => true.

You could use the built-in functions op and args to take apart
expressions which fail is(foo = bar) to see where they differ.

Other people have written on-line learning software with Maxima
so you could take a look at what they've done. See:
http://maxima.sourceforge.net/relatedprojects.shtml

Hope this helps,
Robert Dodier