WeBWorK Main Forum

MathObject methods

by Richard Bayne -
Number of replies: 5
To make some use of the summer, I am in the process of updating some problems to using MathObjects as well as writing some new problems. Is there a single place where one can find the methods for the the various mathObjects?
Bayne
In reply to Richard Bayne

Re: MathObject methods

by Michael Gage -
A lot of material on MathObjects has been added to the wiki in the last month.

Go to http://webwork.maa.org then click on "Authors" and then on "MathObjects" to see what information has been posted so far:

The wiki can be edited by anyone so feel free to add clarifying information for those passages which are not clear.

The document http://webwork.maa.org/wiki/Introduction_to_MathObjects

has a list of the most common methods for MathObjects -- and should be enough for most purposes. It is somewhat difficult to compile a complete list of methods for an object since the methods available can be augmented at any level of the object hierarchy.

Particularly useful for trying out MathObjects constructs is the first of the PGLabs listed at http://webwork.maa.org/wiki/PGLabs
In reply to Michael Gage

Re: MathObject methods

by Richard Bayne -
Mike,
Thanks. I thought that I had looked through most of these places. Maybe I should ask a more direct question. Is there a method that returns the magnitude of vector?
Bayne
In reply to Richard Bayne

Re: MathObject methods

by Michael Gage -
Context("Vector");
$v = Compute("<3,5,6>");$norm = norm($v); TEXT($norm);
Result: 8.3666

You can try it out at
http://hosted2.webwork.rochester.edu/webwork2/cervone_course/setAIM-Talk/82/

the following works as well:

Context("Vector");
$v = Compute("<3,5,6>");$norm = $v->norm; TEXT($norm);

In reply to Michael Gage

Re: MathObject methods

by Richard Bayne -
Thanks. This is what I was looking for.
In reply to Richard Bayne

Re: MathObject methods

by Michael Gage -
There is an additional table in Davide's second presentation:

http://hosted2.webwork.rochester.edu/webwork2/cervone_course/setAIM-Talk/64/?login_practice_user=true

I've transfered some of that information to the wiki pages at

http://webwork.maa.org/wiki/MathObjects_reference_table

You're right that
there was no list of additional operations for vector on the wiki.

When starting out using MathObjects it's worth flipping through Davide's two presentations for ideas.