I have been relearning how to code problems using Mathobjects, and things are going fine. However, I am at the point where I need to enter questions about Trapezoid, Midpoint and Simpson's. My goal is to have questions on the webwork side that are as similar as possible to the paper homework that is currently assigned in Calculus II. That way, the transition to online homework will be easier (I hope).

I am now at the section that has the numerical quadrature formulas. I have looked at the questions in the Library pertaining to numerical quadrature, and they seem to have the formulas hard coded: n is fixed and they calculate trap, mid, or simp by hand, basically. It seems to me that it should not be hard to code routines that will do these calculations automatically, thus making it easier to write questions in this area.

My first question is: has anyone written these with Mathobjects in mind? I know there is some old Romberg code, but as far as I can tell, it has not been updated to work with Mathobjects.

If the answer to the above is yes, where do I access them?

If the answer to the above is no, then my second question is: what would be the easiest way to get them written? Note I did not say the best way, as I am under time pressure here. It would be nice if the easiest way was the best way.

I think the best way would be to incorporate them as Formula methods, like differentiation is now. I don't know if that's possible to do without rewriting parser.

So, I guess I'm asking how to pass Formulas to a function. I have looked at the code snippet "adding functions to a context" and I think I understand it, but I don't really do Perl. (I've done Fortran, C and C++, which, in my opinion are a lot easier to read than perl.)

I really don't understand what

sub log2 {Parser::Function->call('log2',@_)} does either. Thanks for any help you have, and if there is a good example of this elsewhere and I missed it, I apologize in advance. S.M.