 Example Worksheet - Maple Help

Home : Support : Online Help : Programming : Domains : Example Worksheet

The Domains Package

This example worksheet demonstrates commands from the Domains package. The Domains package can be used to create domains of computation and then develop code for complicated algorithms.

 > $\mathrm{restart}$
 > $\mathrm{with}\left(\mathrm{Domains}\right):$
 ---------------------- Domains version 1.0 --------------------- Initially defined domains are Z and Q the integers and rationals Abbreviations, e.g. DUP for DenseUnivariatePolynomial, also made Basic Examples Using Domains Z and Q

The domains Z (the integers) and Q (the rationals) have been defined. Let's do some operations.

 > $Z\left[\mathrm{Gcd}\right]\left(8,12\right)$
 ${4}$ (1.1)
 > $Q\left[\mathrm{+}\right]\left(\frac{1}{2},\frac{1}{3},\frac{1}{4}\right)$
 $\frac{{13}}{{12}}$ (1.2)

What are the objects Z and Q? Z and Q are Maple tables

 > $\mathrm{type}\left(Z,\mathrm{table}\right)$
 ${\mathrm{true}}$ (1.3)

The table contains operations (Maple procedures) for computing in Z and Q. What operations are available?

 > $\mathrm{show}\left(Z,\mathrm{operations}\right)$
      Signatures for constructor Z      note: operations prefixed by  --  are not available       * : (Z,Z*) -> Z       * : (Integers,Z) -> Z       + : (Z,Z*) -> Z       - : Z -> Z       - : (Z,Z) -> Z       0 : Z       1 : Z       < : (Z,Z) -> Boolean       <= : (Z,Z) -> Boolean       <> : (Z,Z) -> Boolean       = : (Z,Z) -> Boolean       > : (Z,Z) -> Boolean       >= : (Z,Z) -> Boolean       Abs : Z -> Z       Characteristic : Integers       Coerce : Integers -> Z       Div : (Z,Z) -> Union(Z,FAIL)       EuclideanNorm : Z -> Integers       Factor : Z -> [Z,[[Z,Integers]*]]       Gcd : Z* -> Z       Gcdex : (Z,Z,Name) -> Z       Gcdex : (Z,Z,Name,Name) -> Z       Input : Expression -> Union(Z,FAIL)       Inv : Z -> Union(Z,FAIL)       Lcm : Z* -> Z       Max : (Z,Z*) -> Z       Min : (Z,Z*) -> Z       Modp : (Z,Z) -> Z       Mods : (Z,Z) -> Z       ModularHomomorphism : () -> (Z -> Z,Z)       Normal : Z -> Z       Output : Z -> Expression       Powmod : (Z,Integers,Z) -> Z       Prime : Z -> Boolean       Quo : (Z,Z) -> Z       Quo : (Z,Z,Name) -> Z       Random : () -> Z       RelativelyPrime : (Z,Z) -> Boolean       Rem : (Z,Z) -> Z       Rem : (Z,Z,Name) -> Z       Sign : Z -> UNION(1,-1,0)       SmallerEuclideanNorm : (Z,Z) -> Boolean       Sqrfree : Z -> [Z,[[Z,Integers]*]]       Type : Expression -> Boolean       Unit : Z -> Z       UnitNormal : Z -> [Z,Z,Z]       Zero : Z -> Boolean       ^ : (Z,Integers) -> Z