U:{1,2,3,4,5,6,7,8,9,10};
A:{1,2,4,6};B:{1,3,4};
cardinality(U);
cardinality(A);
cardinality(B);
AuB:union(A,B);
AnB:intersect(A,B);
powerset(A);
cardinality(%);
Ap:setdifference(U,A); Bp:setdifference(U,B);
AminusB:setdifference(A,B);
BminusA:setdifference(B,A);
ApnBp:intersect(Ap,Bp);
ApuBp:union(Ap,Bp);
true
if sets a and b have the same number of elements
and is(x = y)
is true
for x
in the elements of a
and y
in the elements of b,
considered in the order determined by listify
.
Otherwise, setequalp
returns false
.
setequalp(setdifference(U,AuB),ApnBp);
setequalp(setdifference(U,AnB),ApuBp);
disjoin(A,B);
disjoin(B,A);
http://maxima.sourceforge.net/docs/manual/maxima_35.html#SEC188
排列(permutation), 組合(combination)
- Function: permutation (n, r)
- Returns the number of permutations of r objects
selected from a set of n objects.
To use this function write firstload(functs)
.
- Function: combination (n, r)
- Returns the number of combinations of n objects
taken r at a time.
To use this function write firstload(functs)
.
Categories: Package functs · Mathematical functions
load(functs);
permutation(5,3);
combination(5,3);
級數和
- Function: arithmetic (a, d, n)
- Returns the n-th term of the arithmetic series
a, a + d, a + 2*d, ..., a + (n - 1)*d
.
To use this function write firstload(functs)
.
Categories: Package functs · Sums and products
- Function: geometric (a, r, n)
- Returns the n-th term of the geometric series
a, a*r, a*r^2, ..., a*r^(n - 1)
.
To use this function write firstload(functs)
.
Categories: Package functs · Sums and products
- Function: harmonic (a, b, c, n)
- Returns the n-th term of the harmonic series
a/b, a/(b + c), a/(b + 2*c), ..., a/(b + (n - 1)*c)
.
To use this function write firstload(functs)
.
Categories: Package functs · Sums and products
- Function: arithsum (a, d, n)
- Returns the sum of the arithmetic series from 1 to n.
To use this function write firstload(functs)
.
Categories: Package functs · Sums and products
- Function: geosum (a, r, n)
- Returns the sum of the geometric series from 1 to n. If n is
infinity (
inf
) then a sum is finite only if the absolute value of r is less than 1.
To use this function write firstload(functs)
.
load(functs);
a:1;d:2;n:10;
arithmetic(a,d,n);
/*an=a+(n-1)d*/
a+(n-1)*d;
r:2;n:10;
geometric (a, r, n) ;
/*an=ar^(n-1)*/
a*r^(n-1);
b:2;c:3;
harmonic (a, b, c, n);
d:2;n:10;
arithsum (a, d, n);
/*a+(a+d)+(a+2d)+...+(a+(n-1)d) */
/*Sn=n/2(2a+(n-1)d) */
n/2*(2*a+(n-1)*d);
r:2;n:10;
geosum (a, r, n);
/*a+ar+ar^2+...+ar^(n-1) */
/* Sn=a(1-r^n)/(1-r) */
a*(1-r^n)/(1-r);