Sophie

Sophie

distrib > Mandriva > 9.0 > i586 > by-pkgid > 8d125f3514d54b70bf040165a2f5d2e4 > files > 312

maxima-5.6-1mdk.i586.rpm

<HTML>
<HEAD>
<!-- This HTML file has been created by texi2html 1.52
     from maxima.texi on 25 April 2001 -->

<TITLE>Maxima Manual - Contexts</TITLE>
<link href="maxima_11.html" rel=Next>
<link href="maxima_9.html" rel=Previous>
<link href="maxima_toc.html" rel=ToC>

</HEAD>
<BODY>
<p>Go to the <A HREF="maxima_1.html">first</A>, <A HREF="maxima_9.html">previous</A>, <A HREF="maxima_11.html">next</A>, <A HREF="maxima_41.html">last</A> section, <A HREF="maxima_toc.html">table of contents</A>.
<P><HR><P>


<H1><A NAME="SEC36" HREF="maxima_toc.html#TOC36">Contexts</A></H1>



<H2><A NAME="SEC37" HREF="maxima_toc.html#TOC37">Definitions for Contexts</A></H2>
<P>
<DL>
<DT><U>Function:</U> <B>ACTIVATE</B> <I>(cont1, cont2, ...)</I>
<DD><A NAME="IDX292"></A>
causes the specified contexts conti to be
activated.  The facts in these contexts are used in making deductions
and retrieving information.  The facts in these contexts are not
listed when FACTS(); is done.  The variable ACTIVECONTEXTS is the list
of contexts which are active by way of the ACTIVATE function.

</P>
</DL>
<P>
<DL>
<DT><U>Variable:</U> <B>ACTIVECONTEXTS</B>
<DD><A NAME="IDX293"></A>
 default: [] 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.

</P>
</DL>

<P>
<DL>
<DT><U>Function:</U> <B>ASSUME</B> <I>(pred1, pred2, ...)</I>
<DD><A NAME="IDX294"></A>
First checks the specified predicates for
redundancy and consistency with the current data base.  If the
predicates are consistent and non-redundant, they are added to the
data base; if inconsistent or redundant, no action is taken.  ASSUME
returns a list whose entries are the predicates added to the data base
and the atoms REDUNDANT or INCONSISTENT where applicable.

</P>
</DL>
<P>
<DL>
<DT><U>Variable:</U> <B>ASSUMESCALAR</B>
<DD><A NAME="IDX295"></A>
 default: [TRUE] - helps govern whether expressions <CODE>exp</CODE>
for which

</P>

<PRE>
NONSCALARP(exp) is FALSE
</PRE>

<P>
are assumed to behave like scalars
for certain transformations as follows: Let <CODE>exp</CODE> represent any
non-list/non-matrix, and <CODE>[1,2,3]</CODE> any list or matrix.

<PRE>
exp.[1,2,3]; ==&#62;
 [exp,2*exp,3*exp]
</PRE>

<P>
if ASSUMESCALAR is TRUE or SCALARP(exp) is
TRUE or CONSTANTP(exp) is TRUE.  If ASSUMESCALAR is TRUE, such
expressions will behave like scalars only for the commutative
operators, but not for ".".  If ASSUMESCALAR is FALSE, such
expressions will behave like non-scalars.  If ASSUMESCALAR is ALL,
such expressions will behave like scalars for all the operators listed
above.
</DL>

</P>
<P>
<DL>
<DT><U>Variable:</U> <B>ASSUME_POS</B>
<DD><A NAME="IDX296"></A>
 default:[FALSE] - When using INTEGRATE, etc. one often
introduces parameters which are real and positive or one's
calculations can often be constructed so that this is true.  There is
a switch ASSUME_POS (default FALSE) such that if set to TRUE, MACSYMA
will assume one's parameters are positive.  The intention here is to
cut down on the number of questions MACSYMA needs to ask.  Obviously,
ASSUME information or any contextual information present will take
precedence.  The user can control what is considered to be a parameter
for this purpose.  Parameters by default are those which satisfy
SYMBOLP(x) OR SUBVARP(x).  The user can change this by setting the
option ASSUME_POS_PRED [default FALSE] to the name of a predicate
function of one argument.  E.g. if you want only symbols to be
parameters, you can do ASSUME_POS:TRUE$ ASSUME_POS_PRED:'SYMBOLP$
SIGN(A); -&#62; POS, SIGN(A[1]); -&#62; PNZ.
</DL>

</P>
<P>
<DL>
<DT><U>Variable:</U> <B>ASSUME_POS_PRED</B>
<DD><A NAME="IDX297"></A>
 default:[FALSE] - may be set to one argument to control
what will be considered a parameter for the "assumptions" that INTEGRATE
will make... see ASSUME and ASSUME_POS .
</DL>

</P>
<P>
<DL>
<DT><U>Variable:</U> <B>CONTEXT</B>
<DD><A NAME="IDX298"></A>
 default: INITIAL. Whenever a user assumes a new fact, it is
placed in the context named as the current value of the variable
CONTEXT.  Similarly, FORGET references the current value of CONTEXT.
To change contexts, simply bind CONTEXT to the desired context.  If
the specified context does not exist it will be created by an
invisible call to NEWCONTEXT.  The context specified by the value of
CONTEXT is automatically activated.  (Do DESCRIBE(CONTEXTS); for a
general description of the CONTEXT mechanism.)

</P>
</DL>
<P>
<DL>
<DT><U>Variable:</U> <B>CONTEXTS</B>
<DD><A NAME="IDX299"></A>
 default: [INITIAL,GLOBAL] 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 selected portion of his data base, called a context.  Once
this is done, the user can have MACSYMA 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 the user destroys them
individually by using FORGET or destroys them as a whole by using KILL
to destroy the context to which they belong.
    Contexts exist in a formal hierarchy, with the root always being
the context GLOBAL, which contains information about MACSYMA 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 an inferior
of that context.  When a fresh MACSYMA is started up, the user is in a
context called INITIAL, which has GLOBAL as a subcontext.
The functions which deal with contexts are: FACTS, NEWCONTEXT,
SUPCONTEXT, KILLCONTEXT, ACTIVATE, DEACTIVATE, ASSUME, and FORGET.

</P>
</DL>
<P>
<DL>
<DT><U>Function:</U> <B>DEACTIVATE</B> <I>(cont1, cont2, ...)</I>
<DD><A NAME="IDX300"></A>
causes the specified contexts conti to
be deactivated.

</P>
</DL>
<P>
<DL>
<DT><U>Function:</U> <B>FACTS</B> <I>(item)</I>
<DD><A NAME="IDX301"></A>
If 'item' is the name of a context then FACTS returns a list
of the facts in the specified context.  If no argument is given, it
lists the current context.  If 'item' is not the name of a context
then it 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.

</P>
</DL>
<P>
<DL>
<DT><U>declaration:</U> <B>FEATURES</B>
<DD><A NAME="IDX302"></A>
 - MACSYMA has built-in properties which are handled by the
data base.  These are called FEATURES.  One can do DECLARE(N,INTEGER),
etc.  One can also DECLARE one's own FEATURES by e.g.
DECLARE( INCREASING, FEATURE); which will then allow one to say
DECLARE(F, INCREASING);.  One can then check if F is INCREASING by
using the predicate FEATUREP via FEATUREP(F, INCREASING).  There is
an infolist FEATURES which is a list of known FEATURES.  At present
known FEATURES are: INTEGER, NONINTEGER, EVEN, ODD, RATIONAL,
IRRATIONAL, REAL, IMAGINARY, COMPLEX, ANALYTIC, INCREASING,
DECREASING, ODDFUN, EVENFUN, POSFUN, COMMUTATIVE, LASSOCIATIVE,
RASSOCIATIVE, SYMMETRIC, and ANTISYMMETRIC.  [Note: system "features"
may be checked with STATUS(FEATURE, ...); See DESCRIBE(STATUS); or
DESCRIBE(FEATURE); for details.]

</P>
</DL>
<P>
<DL>
<DT><U>Function:</U> <B>FORGET</B> <I>(pred1, pred2, ...)</I>
<DD><A NAME="IDX303"></A>
removes relations established by ASSUME.
The predicates may be expressions equivalent to (but not necessarily
identical to) those previously ASSUMEd.  FORGET(list) is also a legal
form.

</P>
</DL>
<P>
<DL>
<DT><U>Function:</U> <B>KILLCONTEXT</B> <I>(context1,context2,...,contextn)</I>
<DD><A NAME="IDX304"></A>
kills the specified
contexts.  If one of them 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 INITIAL is created, which is empty of facts.
KILLCONTEXT doesn't allow the user 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.

</P>
</DL>
<P>
<DL>
<DT><U>Function:</U> <B>NEWCONTEXT</B> <I>(name)</I>
<DD><A NAME="IDX305"></A>
creates a new (empty) context, called name, which
has GLOBAL as its only subcontext.  The new context created will
become the currently active context.

</P>
</DL>
<P>
<DL>
<DT><U>Function:</U> <B>SUPCONTEXT</B> <I>(name,context)</I>
<DD><A NAME="IDX306"></A>
will create a new context (called name)
whose subcontext is context.  If context is not specified, the current
context will be assumed.  If it is specified, context must exist.

</P>
</DL>

<P><HR><P>
<p>Go to the <A HREF="maxima_1.html">first</A>, <A HREF="maxima_9.html">previous</A>, <A HREF="maxima_11.html">next</A>, <A HREF="maxima_41.html">last</A> section, <A HREF="maxima_toc.html">table of contents</A>.
</BODY>
</HTML>