Sponsored links: Algebra eBooks
 

Help Index

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

The Maxima on-line user's manual

Algebra Calculator

Search:

Declare Calculator

Declare

Function: declare (<a_1>, <p_1>, <a_2>, <p_2>, ...) Assigns the atom or list of atoms <a_i> the property or list of properties <p_i>. When <a_i> and/or <p_i> are lists, each of the atoms gets all of the properties.

declare(r,real);
declare(t,real);
a:K1*r*exp(%i*t)+K2*r**2*exp(%i*2*t)+K3*r**3*exp(%i*3*t);
Bt:diff(a,r);
Br:diff(a,t)/r;
factor(Bt*conjugate(Bt)+Br*conjugate(Br));

declare quotes its arguments. declare always returns done.

As noted in the description for each declaration flag, for some flags featurep(<object>, <feature>) returns true if <object> has been declared to have <feature>. However, featurep does not recognize some flags; this is a bug.

See also features.

declare recognizes the following properties:

evfun Makes <a_i> known to ev so that the function named by <a_i> is applied when <a_i> appears as a flag argument of ev. See evfun.

evflag Makes <a_i> known to the ev function so that <a_i> is bound to true during the execution of ev when <a_i> appears as a flag argument of ev. See evflag.

bindtest Tells Maxima to trigger an error when <a_i> is evaluated unbound.

noun Tells Maxima to parse <a_i> as a noun. The effect of this is to replace instances of <a_i> with <a_i> or nounify(<a_i>), depending on the context.

constant Tells Maxima to consider <a_i> a symbolic constant.

scalar Tells Maxima to consider <a_i> a scalar variable.

nonscalar Tells Maxima to consider <a_i> a nonscalar variable. The usual application is to declare a variable as a symbolic vector or matrix.

mainvar Tells Maxima to consider <a_i> a "main variable". A main variable succeeds all other constants and variables in the canonical ordering of Maxima expressions, as determined by ordergreatp.

alphabetic Tells Maxima to recognize all characters in <a_i> (which must be a string) as alphabetic characters.

feature Tells Maxima to recognize <a_i> as the name of a feature. Other atoms may then be declared to have the <a_i> property.

rassociative, lassociative Tells Maxima to recognize <a_i> as a right-associative or left-associative function.

nary Tells Maxima to recognize <a_i> as an n-ary function.

The nary declaration is not the same as calling the nary function. The sole effect of declare(foo, nary) is to instruct the Maxima simplifier to flatten nested expressions, for example, to simplify foo(x, foo(y, z)) to foo(x, y, z).

symmetric, antisymmetric, commutative Tells Maxima to recognize <a_i> as a symmetric or antisymmetric function. commutative is the same as symmetric.

oddfun, evenfun Tells Maxima to recognize <a_i> as an odd or even function.

outative Tells Maxima to simplify <a_i> expressions by pulling constant factors out of the first argument.

When <a_i> has one argument, a factor is considered constant if it is a literal or declared constant.

When <a_i> has two or more arguments, a factor is considered constant if the second argument is a symbol and the factor is free of the second argument.

multiplicative Tells Maxima to simplify <a_i> expressions by the substitution <a_i>(x * y * z * ...) --> <a_i>(x) * <a_i>(y) * <a_i>(z) * .... The substitution is carried out on the first argument only.

additive Tells Maxima to simplify <a_i> expressions by the substitution <a_i>(x + y + z + ...) --> <a_i>(x) + <a_i>(y) + <a_i>(z) + .... The substitution is carried out on the first argument only.

linear Equivalent to declaring <a_i> both outative and additive.

integer, noninteger Tells Maxima to recognize <a_i> as an integer or noninteger variable.

even, odd Tells Maxima to recognize <a_i> as an even or odd integer variable.

rational, irrational Tells Maxima to recognize <a_i> as a rational or irrational real variable.

real, imaginary, complex Tells Maxima to recognize <a_i> as a real, pure imaginary, or complex variable.

increasing, decreasing Tells Maxima to recognize <a_i> as an increasing or decreasing function.

posfun Tells Maxima to recognize <a_i> as a positive function.

integervalued Tells Maxima to recognize <a_i> as an integer-valued function.

Examples:

     evfun and evflag declarations.
          (%i1) declare (expand, evfun);
          (%o1)                         done
          (%i2) (a + b)^3;
                                             3
          (%o2)                       (b + a)
          (%i3) (a + b)^3, expand;
                               3        2      2      3
          (%o3)               b  + 3 a b  + 3 a  b + a
          (%i4) declare (demoivre, evflag);
          (%o4)                         done
          (%i5) exp (a + b*%i);
                                       %i b + a
          (%o5)                      %e
          (%i6) exp (a + b*%i), demoivre;
                                a
          (%o6)               %e  (%i sin(b) + cos(b))

     bindtest declaration.
          (%i1) aa + bb;
          (%o1)                        bb + aa
          (%i2) declare (aa, bindtest);
          (%o2)                         done
          (%i3) aa + bb;
          aa unbound variable
           -- an error.  Quitting.  To debug this try debugmode(true);
          (%i4) aa : 1234;
          (%o4)                         1234
          (%i5) aa + bb;
          (%o5)                       bb + 1234

     noun declaration.
          (%i1) factor (12345678);
                                       2
          (%o1)                     2 3  47 14593
          (%i2) declare (factor, noun);
          (%o2)                         done
          (%i3) factor (12345678);
          (%o3)                   factor(12345678)
          (%i4) %, nouns;
                                       2
          (%o4)                     2 3  47 14593

constant, scalar, nonscalar, and mainvar declarations.

     alphabetic declaration.
          (%i1) xx\~yy\\@ : 1729;
          (%o1)                         1729
          (%i2) declare ("~@", alphabetic);
          (%o2)                         done
          (%i3) xx~yy@ + @yyxx + xx@@yy~;
          (%o3)               xx@@yy~ + @yyxx + 1729
          (%i4) listofvars (%);
          (%o4)                  [@yyxx, xx@@yy~]

     feature declaration.
          (%i1) declare (FOO, feature);
          (%o1)                         done
          (%i2) declare (x, FOO);
          (%o2)                         done
          (%i3) featurep (x, FOO);
          (%o3)                         true

rassociative and lassociative declarations.

     nary declaration.
          (%i1) H (H (a, b), H (c, H (d, e)));
          (%o1)               H(H(a, b), H(c, H(d, e)))
          (%i2) declare (H, nary);
          (%o2)                         done
          (%i3) H (H (a, b), H (c, H (d, e)));
          (%o3)                   H(a, b, c, d, e)

     symmetric and antisymmetric declarations.
          (%i1) S (b, a);
          (%o1)                        S(b, a)
          (%i2) declare (S, symmetric);
          (%o2)                         done
          (%i3) S (b, a);
          (%o3)                        S(a, b)
          (%i4) S (a, c, e, d, b);
          (%o4)                   S(a, b, c, d, e)
          (%i5) T (b, a);
          (%o5)                        T(b, a)
          (%i6) declare (T, antisymmetric);
          (%o6)                         done
          (%i7) T (b, a);
          (%o7)                       - T(a, b)
          (%i8) T (a, c, e, d, b);
          (%o8)                   T(a, b, c, d, e)

     oddfun and evenfun declarations.
          (%i1) o (- u) + o (u);
          (%o1)                     o(u) + o(- u)
          (%i2) declare (o, oddfun);
          (%o2)                         done
          (%i3) o (- u) + o (u);
          (%o3)                           0
          (%i4) e (- u) - e (u);
          (%o4)                     e(- u) - e(u)
          (%i5) declare (e, evenfun);
          (%o5)                         done
          (%i6) e (- u) - e (u);
          (%o6)                           0

     outative declaration.
          (%i1) F1 (100 * x);
          (%o1)                       F1(100 x)
          (%i2) declare (F1, outative);
          (%o2)                         done
          (%i3) F1 (100 * x);
          (%o3)                       100 F1(x)
          (%i4) declare (zz, constant);
          (%o4)                         done
          (%i5) F1 (zz * y);
          (%o5)                       zz F1(y)

     multiplicative declaration.
          (%i1) F2 (a * b * c);
          (%o1)                       F2(a b c)
          (%i2) declare (F2, multiplicative);
          (%o2)                         done
          (%i3) F2 (a * b * c);
          (%o3)                   F2(a) F2(b) F2(c)

     additive declaration.
          (%i1) F3 (a + b + c);
          (%o1)                     F3(c + b + a)
          (%i2) declare (F3, additive);
          (%o2)                         done
          (%i3) F3 (a + b + c);
          (%o3)                 F3(c) + F3(b) + F3(a)

     linear declaration.
          (%i1) sum (F(k) + G(k), k, 1, inf);
                                 inf
                                 ====
                                 \
          (%o1)                   >    (G(k) + F(k))
                                 /
                                 ====
                                 k = 1
          (%i2) declare (nounify (sum), linear);
          (%o2)                         done
          (%i3) sum (F(k) + G(k), k, 1, inf);
                               inf          inf
                               ====         ====
                               \            \
          (%o3)                 >    G(k) +  >    F(k)
                               /            /
                               ====         ====
                               k = 1        k = 1

There are also some inexact matches for declare. Try ?? declare to see them.

(%o1)                                true
(%i2) 

Declare Example

Related Examples

declare-solve

eq1:x^2+y^2=1;

eq2:x+2*y=1.5;

declare(x, real);

Calculate

declare-diff-exp-feature-transpose

declare(sym_matrix, f...

declare(W, sym_matrix);

declare(a, sym_matrix);

Calculate

declare-inf-limit

declare (n, integer);

a:(7^n)^(1/n);

limit(a,n,inf);

Calculate

declare-inf-limit

declare (n, integer);

a:(3^n+5^n+7^n)^(1/n);

limit(a,n,inf);

Calculate

declare-float-solve-sqrt

a:solve(T1^2*a^2-a-10...

declare([T1,a], real);

w=float(sqrt(a));

Calculate

declare-expand-load

load(atensor);

init_atensor(clifford...

q(a,b,c,d):=a+b.v[1]+...

Calculate

declare-limit-scalarp

declare(a,scalar);

declare(T12, nonscala...

scalarp(a);

Calculate

declare-is

declare(k, integer);

declare(x, real);

is(e^(-k*x^2) < e^...

Calculate

declare

declare(x,integer);

declare(y,integer);

Calculate

declare-exp

declare(lambda, scalar);

mu:exp(-lambda*x*x);

Calculate