function like Mathematica's Tuples



Am Donnerstag, den 20.05.2010, 09:06 -0600 schrieb Robert Dodier:
> sublis makes substitutions in parallel but it seems to want
> symbols, not integers, on the left-hand side of "=".
> Someone was working on a parallel version of subst;
> whatever happened to that?

Hello Robert,

a function psubst for parallel substitution is already implemented:

(%i1) ? psubst

 -- Function: psubst (<list>, <expr>)
 -- Function: psubst (<a>, <b>, <expr>)
     `psubst(<a>, <b>, <expr>)' is simliar to `subst'. See `subst'.

     In distinction from `subst' the function `psubst' makes parallel
     substitutions, if the first argument <list> is a list of equations.

     See also `sublis' for making parallel substitutions.

     Example:

     The first example shows parallel substitution with `psubst'. The
     second example shows the result for the function `subst', which
     does a serial substitution.

          (%i4) psubst ([a^2=b, b=a], sin(a^2) + sin(b));
          (%o4)                           sin(b) + sin(a)
          (%i5) subst ([a^2=b, b=a], sin(a^2) + sin(b));
          (%o5)                              2 sin(a)


  There are also some inexact matches for `psubst'.
  Try `?? psubst' to see them.


Dieter Kaiser