Defining functions
Note the symbols used by the function are: =
unary function
F (x): =expr;
Example:
(%I1) F (x): = 1+x;
(%O1) F (x): = 1 + x
(%I2) F (2);
(%O2) 3
Multivariate functions
F (x,y): =expr;
Example:
(%I3) F (x,y): =y^2+x^2;
&http://www.aliyun.com/zixun/aggregation/37954.html ">nbsp;2 2
(%O3) f (x, y): = y + x
(%I4) f (2,3);
(%O4) 13
Elementary function
Power function: x^2, x^ ( -1/2),...; exponential function: 2^x, (prev) ^X, exp (x),%e^x ...
In Maxima, the constant e=2.718281828459045 is recorded as:%e. So the exponential function e^x is represented in Maxima:%e^x
Because of the importance of this function, it has a special notation: exp (x).
(%I2) F (x): =%e^x;
X
(%O2) F (x): =%e
(%I3) g (x): = exp (x);
(%O3) g (x): = exp (x)
(%I4) expand (f (X)-G (x));
(%O4) 0
Logarithmic function: Log (x)
In Maxima, log (x) is the natural logarithm, which is the logarithm of the base of E, which is often recorded as ln (x) mathematically. Maxima There is no other form of logarithm, to use a 10-or 2-based logarithm, you can only use a replacement formula. If you put the following code in ~/.MAXIMA/MAXIMA-INIT.MAC, Maxima will load the custom function log10, log2, and define ln as log at run time. This allows you to use LOG10, log2, and Ln.
LOG10 (x): =log (x)/log (10);
LOG2 (x): =log (x)/log (2);
Ln:log;
Trigonometric functions: sin, cos, tan, cot, sec, CSC
In Maxima, pi=3.141592653589793 is recorded as%pi.
Inverse: Asin, ACOS, Atan, Acot, ASEC, ACSC
piecewise function
f (x) = X-1, x<0
0, X=0
throttled, x>0
(%I2) F (x): = if x < 0 then x-1 else (if x = 0 Then 0 else 1 + x);
(%O2) F (x): = if x < 0 then x-1 else (if x = 0 Then 0 else 1 + x)
(%I3) F (-1);
(%O3)-2
(%I4) F (0)
(%O4) 0
(%I5) F (1)
(%O5) 2