Factored Functions 2ΒΆ

The FactoredFunctions2 package implements one operation, map, for applying an operation to every base in a factored object and to the unit.

double(x) == x + x
                       Type: Void

f := factor(720)
   4 2
  2 3 5
                       Type: Factored Integer

Actually, the map operation used in this example comes from Factored itself, since double takes an integer argument and returns an integer result.

map(double,f)
     4 2
  2 4 6 10
                       Type: Factored Integer

If we want to use an operation that returns an object that has a type different from the operation’s argument, the map in Factored cannot be used and we use the one in FactoredFunctions2.

makePoly(b) == x + b
                4       2
  (x + 1)(x + 2) (x + 3) (x + 5)
                       Type: Factored Polynomial Integer

In fact, the “2” in the name of the package means that we might be using factored objects of two different types.

g := map(makePoly,f)

It is important to note that both versions of map destroy any information known about the bases (the fact that they are prime, for instance).

The flags for each base are set to “nil” in the object returned by map.

nthFlag(g,1)
  "nil"
                      Type: Union("nil",...)

See Also:

  • )help Factored
  • )show FactoredFunctions2

Table Of Contents

This Page