| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 11.1 Functions and Variables for Contexts |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Activates the contexts context_1, ..., context_n.
The facts in these contexts are then available to
make deductions and retrieve information.
The facts in these contexts are not listed by facts ().
The variable activecontexts is the list
of contexts which are active by way of the activate function.
Categories: Declarations and inferences
Default value: []
activecontexts is a list of the contexts which are active
by way of the activate function, as opposed to being active because
they are subcontexts of the current context.
Categories: Declarations and inferences
Adds predicates pred_1, ..., pred_n to the current context.
If a predicate is inconsistent or redundant
with the predicates in the current context,
it is not added to the context.
The context accumulates predicates from each call to assume.
assume returns a list whose elements are the predicates added to the context
or the atoms redundant or inconsistent where applicable.
The predicates pred_1, ..., pred_n can only be expressions
with the relational operators < <= equal notequal >= and >.
Predicates cannot be literal equality = or literal inequality # expressions,
nor can they be predicate functions such as integerp.
Compound predicates of the form pred_1 and ... and pred_n
are recognized,
but not pred_1 or ... or pred_n.
not pred_k is recognized if pred_k is a relational predicate.
Expressions of the form not (pred_1 and pred_2)
and not (pred_1 or pred_2)
are not recognized.
Maxima's deduction mechanism is not very strong;
there are many obvious consequences which cannot be determined by is.
This is a known weakness.
assume does not handle predicates with complex numbers. If a predicate
contains a complex number assume returns inconsistent or
redunant.
assume evaluates its arguments.
See also is, facts, forget, context, and declare.
Examples:
(%i1) assume (xx > 0, yy < -1, zz >= 0); (%o1) [xx > 0, yy < - 1, zz >= 0] (%i2) assume (aa < bb and bb < cc); (%o2) [bb > aa, cc > bb] (%i3) facts (); (%o3) [xx > 0, - 1 > yy, zz >= 0, bb > aa, cc > bb] (%i4) is (xx > yy); (%o4) true (%i5) is (yy < -yy); (%o5) true (%i6) is (sinh (bb - aa) > 0); (%o6) true (%i7) forget (bb > aa); (%o7) [bb > aa] (%i8) prederror : false; (%o8) false (%i9) is (sinh (bb - aa) > 0); (%o9) unknown (%i10) is (bb^2 < cc^2); (%o10) unknown
Categories: Declarations and inferences
Default value: true
assumescalar helps govern whether expressions expr
for which nonscalarp (expr) is false
are assumed to behave like scalars
for certain transformations.
Let expr represent any expression other than a list or a matrix,
and let [1, 2, 3] represent any list or matrix.
Then expr . [1, 2, 3] yields [expr, 2 expr, 3 expr]
if assumescalar is true, or scalarp (expr) is
true, or constantp (expr) is true.
If assumescalar is true, such
expressions will behave like scalars only for commutative
operators, but not for noncommutative multiplication ..
When assumescalar is false, such
expressions will behave like non-scalars.
When assumescalar is all,
such expressions will behave like scalars for all the operators listed
above.
Categories: Declarations and inferences
Default value: false
When assume_pos is true
and the sign of a parameter x cannot be determined from the current context
or other considerations,
sign and asksign (x) return true.
This may forestall some automatically-generated asksign queries,
such as may arise from integrate or other computations.
By default, a parameter is x such that symbolp (x)
or subvarp (x).
The class of expressions considered parameters can be modified to some extent
via the variable assume_pos_pred.
sign and asksign attempt to deduce the sign of expressions
from the sign of operands within the expression.
For example, if a and b are both positive,
then a + b is also positive.
However, there is no way to bypass all asksign queries.
In particular, when the asksign argument is a
difference x - y or a logarithm log(x),
asksign always requests an input from the user,
even when assume_pos is true and assume_pos_pred is
a function which returns true for all arguments.
Categories: Declarations and inferences
Default value: false
When assume_pos_pred is assigned the name of a function
or a lambda expression of one argument x,
that function is called to determine
whether x is considered a parameter for the purpose of assume_pos.
assume_pos_pred is ignored when assume_pos is false.
The assume_pos_pred function is called by sign and asksign
with an argument x
which is either an atom, a subscripted variable, or a function call expression.
If the assume_pos_pred function returns true,
x is considered a parameter for the purpose of assume_pos.
By default, a parameter is x such that symbolp (x)
or subvarp (x).
See also assume and assume_pos.
Examples:
(%i1) assume_pos: true$
(%i2) assume_pos_pred: symbolp$
(%i3) sign (a);
(%o3) pos
(%i4) sign (a[1]);
(%o4) pnz
(%i5) assume_pos_pred: lambda ([x], display (x), true)$
(%i6) asksign (a);
x = a
(%o6) pos
(%i7) asksign (a[1]);
x = a
1
(%o7) pos
(%i8) asksign (foo (a));
x = foo(a)
(%o8) pos
(%i9) asksign (foo (a) + bar (b));
x = foo(a)
x = bar(b)
(%o9) pos
(%i10) asksign (log (a));
x = a
Is a - 1 positive, negative, or zero?
p;
(%o10) pos
(%i11) asksign (a - b);
x = a
x = b
x = a
x = b
Is b - a positive, negative, or zero?
p;
(%o11) neg
Categories: Declarations and inferences
Default value: initial
context names the collection of facts maintained by assume and forget.
assume adds facts to the collection named by context,
while forget removes facts.
Binding context to a name foo changes the current context to foo.
If the specified context foo does not yet exist,
it is created automatically by a call to newcontext.
The specified context is activated automatically.
See contexts for a general description of the context mechanism.
Categories: Declarations and inferences
Default value: [initial, global]
contexts is a list of the contexts which
currently exist, including the currently active context.
The context mechanism makes it possible for a user to bind together and name a collection of facts, called a context. Once this is done, the user can have Maxima assume or forget large numbers of facts merely by activating or deactivating their context.
Any symbolic atom can be a context, and the facts contained in that
context will be retained in storage until destroyed one by one
by calling forget or destroyed as a whole by calling kill
to destroy the context to which they belong.
Contexts exist in a hierarchy, with the root always being
the context global, which contains information about Maxima that some
functions need. When in a given context, all the facts in that
context are "active" (meaning that they are used in deductions and
retrievals) as are all the facts in any context which is a subcontext
of the active context.
When a fresh Maxima is started up, the user is in a
context called initial, which has global as a subcontext.
See also facts, newcontext,
supcontext, killcontext, activate, deactivate, assume, and forget.
Categories: Declarations and inferences
Deactivates the specified contexts context_1, ..., context_n.
Categories: Declarations and inferences
If item is the name of a context,
facts (item) returns a list
of the facts in the specified context.
If item is not the name of a context,
facts (item) returns a list of the facts known about item in the current
context. Facts that are active, but in a different context, are not listed.
facts () (i.e., without an argument) lists the current context.
Categories: Declarations and inferences
Maxima recognizes certain mathematical properties of functions and variables. These are called "features".
declare (x, foo) gives the property foo
to the function or variable x.
declare (foo, feature) declares a new feature foo.
For example,
declare ([red, green, blue], feature)
declares three new features, red, green, and blue.
The predicate featurep (x, foo)
returns true if x has the foo property,
and false otherwise.
The infolist features is a list of known features.
These are
integer, noninteger, even, odd, rational,
irrational, real, imaginary, complex,
analytic, increasing, decreasing, oddfun,
evenfun, posfun, commutative, lassociative,
rassociative, symmetric, and antisymmetric,
plus any user-defined features.
features is a list of mathematical features.
There is also a list of non-mathematical, system-dependent features. See status.
Categories: Declarations and inferences
Removes predicates established by assume.
The predicates may be expressions equivalent to (but not necessarily identical to)
those previously assumed.
forget (L), where L is a list of predicates,
forgets each item on the list.
Categories: Declarations and inferences
Kills the contexts context_1, ..., context_n.
If one of the contexts is the current context, the new current
context will become the first available subcontext of the current
context which has not been killed. If the first available unkilled
context is global then initial is used instead. If the initial
context is killed, a new, empty initial context is created.
killcontext refuses to kill a context which is
currently active, either because it is a subcontext of the current
context, or by use of the function activate.
killcontext evaluates its arguments.
killcontext returns done.
Categories: Declarations and inferences
Creates a new, empty context, called name, which
has global as its only subcontext. The newly-created context
becomes the currently active context.
newcontext evaluates its argument.
newcontext returns name.
Categories: Declarations and inferences
Creates a new context, called name, which has context as a subcontext. context must exist.
If context is not specified, the current context is assumed.
Categories: Declarations and inferences
| [ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated by Robert Dodier on January, 16 2011 using texi2html 1.76.