Distribution of functions over bags



I have committed a general extension to the simplifier to allow the
mapping of functions with an arbitrary number of arguments over any
operator.

As examples I have added this feature for the trig functions, the
exponential integrals, and for the integer functions like mod, ceiling,
floor, etc.

The mapping can be switched off with the user option variable
$distribute_over. I have to write documentation about this topic.

Furthermore, a user function to set this property can be added.

Some examples:

Mapping of sin over a matrix with symbols:

(%i2) sin(matrix([a,b],[c,d]));
(%o2) matrix([sin(a),sin(b)],[sin(c),sin(d)])

Mapping of sin over a matrix with float values:

(%i3) sin(matrix([0.5,1.0],[1.5,2.0]));
(%o3) matrix([0.479425538604203,.8414709848078965],
             [.9974949866040544,.9092974268256817])

The function mod has two arguments. An example with a list as the first
argument:

(%i2) mod([x,y,z],10);
(%o2) [mod(x,10),mod(y,10),mod(z,10)]

Next a list as the second argument:

(%i3) mod(x,[5,10,15]);
(%o3) [mod(x,5),mod(x,10),mod(x,15)]

mod distributes over a matrix without problems:

(%i6) mod(matrix([a,b],[c,d]),10);
(%o6) matrix([mod(a,10),mod(b,10)],[mod(c,10),mod(d,10)])

The exponential integral E mapos of a list as the second argument:

(%i4) expintegral_e(1,[0.5,0.75,1.0]);
(%o4) [.5597735947761607,0.34034081291123,.2193839343955203]

Both arguments are a list:

(%i5) expintegral_e([1,2,3],[0.5,0.75,1.0]);
(%o5) [[.5597735947761607,0.34034081291123,.2193839343955203],
       [0.326643862324553,.2171109430575923,0.148495506775922],
       [.2216043642751785,.1547666727239103,.1096919671977601]]

Furthermore, we have the bug report ID: 767556 "Distributing operations
over ="

It is easy to extend the operators "." and "^^" with the functionality
to distribute over equations:

(%i4) :lisp (defprop mnctimes (mequal) distribute_over)
(MEQUAL)
(%i4) :lisp (defprop mncexpt (mequal) distribute_over)
(MEQUAL)

(%i4) x . (a=b);
(%o4) x . a = x . b

(%i5) (a=b)^^2;
(%o5) a^^2 = b^^2

This will work too without problems.

Dieter Kaiser