The Assume Facility - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Operations : Assignment : assume

The Assume Facility

Calling Sequence

assume(x1, prop1, x2, prop2, ...)

assume(x1::prop1, x2::prop2, ...)

assume(xproprel1, xproprel2, ...)

additionally(x1, prop1, x2, prop2, ...)

additionally(x1::prop1, x2::prop2, ...)

additionally(xproprel1, xproprel2, ...)

is(x1, prop1)

is(x1::prop1)

is(xproprel1)

coulditbe(x1, prop1)

coulditbe(x1::prop1)

coulditbe(xproprel1)

about(x1)

hasassumptions(x1)

getassumptions(x1)

addproperty(prop1, parents, children)

Parameters

xi

-

expression on which to place assumptions

propi

-

property

xpropreli

-

relation describing property propi on expression xi

parents, children

-

sets of properties

Description

• 

The assume routine sets variable properties and relationships between variables. Similar functionality is provided by the assuming command.

• 

A common use of the assume function is assume(a>0). This states that the symbol a is assumed to be a positive real constant.  Having made such an assumption, Maple routines are able to use this information to simplify expressions, for example, sqrt(a^2*b) to a*sqrt(b), and evaluate inequalities, for example, is(a+1>0) returns true.

• 

When you make assumptions about a variable, thereafter it prints with an appended tilde (~) to indicate that the variable carries assumptions.  This behavior can be changed, if desired, by updating the showassumed interface setting (see interface).

• 

The assume function takes arguments in the form of multiple pairs or multiple relations. When given multiple arguments, all the assumptions are taken to be true simultaneously.  For example, to define the ordering a<b<c, one can enter assume(a<b, b<c).  This specifies a<b, b<c, and a<c.

• 

When the assume function is used to make an assumption about an expression x, all previous assumptions on x are removed. For example, if you enter assume(x>0) then assume(x<0), there is no contradiction.  Therefore, assume(0<x) followed by assume(x<1) is not equivalent to assume(0<x, x<1).

• 

The additionally function adds additional assumptions without removing previous assumptions. It has the same syntax as assume.  Its functionality differs from assume only in that additionally adds the given properties to the set of preexisting properties of the object(s) included. If you want to assume various properties in several steps, the first call should be to assume and further calls to additionally.  For example, to assume 0<x<1, the user can use assume(x>0) then additionally(x<1).

• 

Assumptions made on names can be removed by unassigning names. For example, having made assumption(s) on x, x := 'x' clears them.

• 

The is routine determines whether x1 satisfies the property prop1. It returns true, false, or FAIL. The is routine returns true if all possible values of x1 satisfy the property prop1. The is routine returns false if any possible value of x1 does not satisfy the property prop1. The is function returns FAIL if it cannot determine whether the property is always satisfied. This is a result of insufficient information or an inability to compute the logical derivation.

  

Important: If the is command is used with a Maple type typename, it returns true if the corresponding type(..., typename) command returns true. This may lead to unexpected results.

• 

There are convenient tests that can be used when programming with variables that carry assumptions. To test if the expression is real, use is(Im(x)=0). To test whether x is real and positive, use is(signum(x)=1). To test whether x is an integer, use is(Im(x)=0) and is(frac(x)=0).

• 

The coulditbe routine determines whether there is a value of x1 such that prop1 is satisfied. It returns true, false, or FAIL. The coulditbe routine returns true if there is a possible value of x1 that satisfies prop1. The coulditbe routine returns false if all possible values of x1 do not satisfy the property prop1. The coulditbe routine returns FAIL if it cannot determine whether the property is true or false.  This is a result of insufficient information or an ability to compute the logical derivation.

• 

The environment variable _EnvTry can be used to specify the intensity of the testing by the is and coulditbe routines. Currently _EnvTry can be set to normal (the default) or hard. If _EnvTry is set to hard, is and coulditbe calls can take exponential time.

• 

The about(x1) function returns assumption and property information for x1.

• 

The hasassumptions(x1) function returns true if something has been assumed about x1 and false otherwise.

• 

The getassumptions(x1) function returns the list of all relevant assumptions in the form expression::property.

• 

The addproperty(prop1, parents, children) function installs a new property in the property tables.  The function must be called with the new property name and a set of the parent properties and children properties that must already be defined in the property lattice.  The empty set can be given to specify no parent or children properties. For example, suppose you have defined properties complex and integer and wish to define the new property real. Use addproperty(real, {complex}, {integer}) to specify that all reals are complex and all integers are real.

• 

A property can be a:

property name

for example, continuous, unary

most type names

for example, integer, float

numerical range

for example, RealRange( a, b ), RealRange( -infinity, b ), RealRange( a, infinity ) where a and b can be either numeric values or Open(a) where a is a numeric value.  Ranges are not placed in the lattice unless explicitly requested because assume knows how to compute their inclusions directly.  The addproperty routine inserts a RealRange in the lattice;  this is only needed when another property in the lattice relates (as parent or child) to a RealRange.

AndProp(a,b,...)

an and expression of properties, a and b and .. where a, b, etc. are properties as defined above.  This property describes objects that satisfy the properties a,  b, ...  An AndProp is not placed in the lattice.

OrProp(a,b,...)

an or expression of properties where the object can satisfy any of the properties. An OrProp is not placed in the lattice.

property range

prop1 .. prop2 where prop1 and prop2 are properties such that prop1 is included in prop2.  This property means that the object satisfies at least prop2 but not more than prop1.  For example, integer .. rational is satisfied by integers/2. A property range is not placed in the lattice.

• 

For more information on parametric properties for the assume facility, see assume/parametric.

Examples

Using the same assumptions on multiple computations

  

When performing various computations using the same assumptions use assume

assume0<a

signuma

1

(1)

&real;a&plus;1

a~&plus;1

(2)

&Im;a&plus;1

0

(3)

a2

a~

(4)

ln&ExponentialE;a

a~

(5)

abouta

Originally a, renamed a~:
  is assumed to be: RealRange(Open(0),infinity)

Similar functionality is provided by the assuming command, but the assumptions are valid only during the computation of one input statement, and no assumptions are placed on the variables.

Placing assumptions on expressions

  

Assumptions can be placed on expressions

assumea&plus;b&comma;&apos;real&apos;&comma;0<c

hasassumptionsa

true

(6)

getassumptionsa

a~&plus;b~::real

(7)

getassumptionsa&plus;c

c~::RealRangeOpen0&comma;&infin;&comma;a~&plus;b~::real

(8)

a:=&apos;a&apos;&semi;b:=&apos;b&apos;&semi;c:=&apos;c&apos;

a:=a

b:=b

c:=c

(9)

signuma

signuma

(10)

Making multiple assumptions on an expression

  

When the assume function is used to make an assumption about an expression x, all previous assumptions on x are removed unless the assume function is used with multiple arguments.

assume5<x

assumex<0

aboutx

Originally x, renamed x~:
  is assumed to be: RealRange(-infinity,Open(0))

assume5<x&comma;x<0

aboutx

Originally x, renamed x~:
  is assumed to be: RealRange(Open(-5),Open(0))

Adding new assumptions without removing previous assumptions

  

The command additionally, which adds additional assumptions without removing previous assumptions.

assume1<x&colon;

isx::positive

false

(11)

coulditbex::positive

true

(12)

additionallyx<1

is1x2&comma;&apos;positive&apos;

true

(13)

coulditbe1x2&equals;1.0

true

(14)
  

Many assumptions can be input simultaneously:

assume5<x&comma;y<10

isxy<50

true

(15)

coulditbexy<200

true

(16)

Finding values for an expression that do not satisfy a property

  

The is command returns false if there are possible values of an expression that do not satisfy a property. The following example returns false because there are possible values, such as -1, for which 2*x is not positive.

assumex::integer

is0<2x

false

(17)
  

Even without assumptions, is has knowledge about the properties of some mathematical functions:

aboutz

z:
  nothing known about this object

is&real;z&comma;&apos;real&apos;

true

(18)

Specifying a Maple type with the is command

  

The is command may return unexpected results if specified with a Maple type. Although there are assumptions on x that specify it is not a name, the is command returns true because the corresponding type command returns true.

aboutx

Originally x, renamed x~:
  is assumed to be: integer

isx&comma;&apos;name&apos;

true

(19)

typex&comma;&apos;name&apos;

true

(20)

Imposing integer assumptions on an expression

  

Impose integer assumptions.

assumen::integer

fracn

0

(21)

sinn&pi;

0

(22)

cosn&pi;

1n~

(23)

assumei2&comma;&apos;integer&apos;

isi2&plus;1&comma;&apos;integer&apos;

true

(24)

coulditbei3&comma;&apos;integer&apos;

true

(25)

Imposing real assumptions on an expression

  

Impose real assumptions.

ln&ExponentialE;z

ln&ExponentialE;z

(26)

assumez&comma;&apos;real&apos;

is0z2

true

(27)

coulditbez20

true

(28)

ln&ExponentialE;z

z~

(29)

Other applications of assume.

u2c

u2c

(30)

&int;0&infin;&ExponentialE;uxx13&DifferentialD;x

&int;0&infin;&ExponentialE;ux~x~1&sol;3&DifferentialD;x~

(31)

assume0<u

u2c

u~c

(32)

&int;0&infin;&ExponentialE;uxx13&DifferentialD;x

29&pi;3&Gamma;23u~4&sol;3

(33)

assumeu<0

u2c

u~c

(34)

&int;0&infin;&ExponentialE;uxx13&DifferentialD;x

&infin;

(35)

The assume function accepts ranges.

is5&comma;RealRange5&comma;&infin;

true

(36)

is5&comma;RealRangeOpen5&comma;&infin;

false

(37)

The assume function accepts matrices.

assumea&comma;&apos;SquareMatrix&apos;

assumen&comma;&apos;integer&apos;

isan&comma;&apos;SquareMatrix&apos;

true

(38)

coulditbean&comma;&apos;tridiagonal&apos;

true

(39)

about&apos;SquareMatrix&apos;

SquareMatrix:
  a known property having {matrix} as immediate parents
  and {scalar, antisymmetric, idempotent, nilpotent, singular, symmetric, triangular, tridiagonal, ElementaryMatrix, PositiveSemidefinite, Non(singular), Non(symmetric)} as immediate children.
  mutually exclusive with {RectangularMatrix}

Define a new property `orthonormal' for vectors.

addproperty&apos;orthonormal&apos;&comma;&apos;vector&apos;&comma;

This specifies a new property `orthonormal' .  It also specifies that objects with this property also have the property vector.

assumeu&comma;&apos;orthonormal&apos;

isu&comma;&apos;orthonormal&apos;

true

(40)

isu&comma;&apos;vector&apos;

true

(41)

This specifies a new property `orthogonal'.  It also specifies that objects with this property also have the property vector, and that objects with the property orthonormal also have this property.

addproperty&apos;orthogonal&apos;&comma;&apos;vector&apos;&comma;&apos;orthonormal&apos;

assumev&comma;&apos;orthogonal&apos;

isv&comma;&apos;orthonormal&apos;

false

(42)

coulditbev&comma;&apos;orthonormal&apos;

true

(43)

assumea&comma;&apos;integer&apos;

isa&in;&apos;SetOf&apos;&apos;real&apos;

true

(44)

isa&in;&apos;SetOf&apos;&apos;integer&apos;

true

(45)

coulditbea&in;&apos;SetOf&apos;&apos;integer&apos;

true

(46)

assumea&in;&apos;SetOf&apos;&apos;prime&apos;&setmn;2

isa&in;&apos;SetOf&apos;&apos;integer&apos;

true

(47)

See Also

assume/parametric, assuming, ComplexRange, exp, frac, Im, in, int, ln, Physics[Assume], property, Re, RealRange, showassumed, signum, sqrt, trig, type, Vector

References

  

The assume facility for Maple is based on the algorithms described in the following references:

  

Weibel, Trudy, and Gonnet, Gaston. "An Algebra of Properties." Proceedings of the ISSAC-91 Conference, pp. 352-359. Bonn, July 1991.

  

Weibel, Trudy and Gonnet, Gaston. "An assume facility for CAS with a sample implementation for Maple." Conference Presentation at DISCO '92, Bath, England, April 14, 1992.

  

A general discussion of how to use the assume facility, its design and limitations is given in:

  

Corless, Robert, and Monagan, Michael. "Simplification and the Assume Facility." Maple Technical Newsletter, Vol. 1 No. 1. Birkhauser, 1994.


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam