WeBWorK Problems

Existing subroutines for Cartesian product of sets and subsets?

Existing subroutines for Cartesian product of sets and subsets?

by Wai Yan Pong -
Number of replies: 4

There are simple existing subroutines in WebWork for Boolean operations on Sets, like:

$A->intersect($B);

Union("$A U $B");

Compute("$A - $B");

Is there one for Cartesian product? More generally, where can one find the list of existing operation on Sets?

Thanks


In reply to Wai Yan Pong

Re: Existing subroutines for Cartesian product of sets and subsets?

by Davide Cervone -

Is there one for Cartesian product?

No. The Set object implements a finite set of reals; it is not a general set. It is there in order to allow operations on Intervals, which can result in singleton sets, as in [1,2] - (1,2] or sets of isolated reals, as in [1,2] - (1,2), and so on. It was never meant to be an arbitrary set. The various set operations are implemented in a way that depends on them being sets of reals, so it would not be easy to extend this to sets of points, for example, as needed for a Cartesian product. One would also need to have a more general object to deal with products of continuous objects, like an interval cross an interval, for which there is no current MathObejct class. All of that could be done, of course, but it is a non-trivial project.

where can one find the list of existing operation on Sets?

The MathObject Wiki page is the main documentation for MathObjects (of which Set is one), and the Set page lists the operations and methods that can be called on a Set. There are similar pages for Interval and Union, and the other MathObject classes.
In reply to Davide Cervone

Re: Existing subroutines for Cartesian product of sets and subsets?

by Wai Yan Pong -
Davide, thank you for the clarification and information.
 
I have seen how WW problems implementing Cartesian product for finite sets using array in Perl. But the problems are a bit dated, I was just hoping that there are some more recent developments on this.

It will be great for writing discrete math problems, if things like Cartesian product, power sets and subsets for finite sets, are implemented.

Are there Perl modules for those operations? For example, this one seems to be for set of scalars.
It is possible to make use of them somehow for WebWork?
In reply to Wai Yan Pong

Re: Existing subroutines for Cartesian product of sets and subsets?

by Davide Cervone -

It is possible to add additional Perl packages to PG, but it is a system-wide change, not something that you can do on a problem-by-problem basis. If you have access to the WeBWorK configuration files on there server, you can add a package in the ${pg}{modules} variable on your localOverrides.config file.

I don't expect to have to be able to create new MathObjects any time soon, I'm afraid. But others have managed to do it, so you may want to give it a try. Y(ou might be able to get away with leveraging the generic List object, using braces as the delimiters.

In reply to Davide Cervone

Re: Existing subroutines for Cartesian product of sets and subsets?

by Wai Yan Pong -

I see. That's good to know, thanks. 

I do have WebWork installed on a local machine that I can mess with.