This is maxima.info, produced by makeinfo version 4.7 from maxima.texi. This is a Texinfo Maxima Manual Copyright 1994,2001 William F. Schelter START-INFO-DIR-ENTRY * Maxima: (maxima). A computer algebra system. END-INFO-DIR-ENTRY  File: maxima.info, Node: Keyword Commands, Next: Functions and Variables for Debugging, Prev: Source Level Debugging, Up: Debugging 41.2 Keyword Commands ===================== Keyword commands are special keywords which are not interpreted as Maxima expressions. A keyword command can be entered at the Maxima prompt or the debugger prompt, although not at the break prompt. Keyword commands start with a colon, '`:''. For example, to evaluate a Lisp form you may type `:lisp' followed by the form to be evaluated. (%i1) :lisp (+ 2 3) 5 The number of arguments taken depends on the particular command. Also, you need not type the whole command, just enough to be unique among the break keywords. Thus `:br' would suffice for `:break'. The keyword commands are listed below. `:break F n' Set a breakpoint in function `F' at line offset `n' from the beginning of the function. If `F' is given as a string, then it is assumed to be a file, and `n' is the offset from the beginning of the file. The offset is optional. If not given, it is assumed to be zero (first line of the function or file). `:bt' Print a backtrace of the stack frames `:continue' Continue the computation `:delete' Delete the specified breakpoints, or all if none are specified `:disable' Disable the specified breakpoints, or all if none are specified `:enable' Enable the specified breakpoints, or all if none are specified `:frame n' Print stack frame `n', or the current frame if none is specified `:help' Print help on a debugger command, or all commands if none is specified `:info' Print information about item `:lisp some-form' Evaluate `some-form' as a Lisp form `:lisp-quiet some-form' Evaluate Lisp form `some-form' without any output `:next' Like `:step', except `:next' steps over function calls `:quit' Quit the current debugger level without completing the computation `:resume' Continue the computation `:step' Continue the computation until it reaches a new source line `:top' Return to the Maxima prompt (from any debugger level) without completing the computation  File: maxima.info, Node: Functions and Variables for Debugging, Prev: Keyword Commands, Up: Debugging 41.3 Functions and Variables for Debugging ========================================== -- Option variable: refcheck Default value: `false' When `refcheck' is `true', Maxima prints a message each time a bound variable is used for the first time in a computation. -- Option variable: setcheck Default value: `false' If `setcheck' is set to a list of variables (which can be subscripted), Maxima prints a message whenever the variables, or subscripted occurrences of them, are bound with the ordinary assignment operator `:', the `::' assignment operator, or function argument binding, but not the function assignment `:=' nor the macro assignment `::=' operators. The message comprises the name of the variable and the value it is bound to. `setcheck' may be set to `all' or `true' thereby including all variables. Each new assignment of `setcheck' establishes a new list of variables to check, and any variables previously assigned to `setcheck' are forgotten. The names assigned to `setcheck' must be quoted if they would otherwise evaluate to something other than themselves. For example, if `x', `y', and `z' are already bound, then enter setcheck: ['x, 'y, 'z]$ to put them on the list of variables to check. No printout is generated when a variable on the `setcheck' list is assigned to itself, e.g., `X: 'X'. -- Option variable: setcheckbreak Default value: `false' When `setcheckbreak' is `true', Maxima will present a break prompt whenever a variable on the `setcheck' list is assigned a new value. The break occurs before the assignment is carried out. At this point, `setval' holds the value to which the variable is about to be assigned. Hence, one may assign a different value by assigning to `setval'. See also `setcheck' and `setval'. -- System variable: setval Holds the value to which a variable is about to be set when a `setcheckbreak' occurs. Hence, one may assign a different value by assigning to `setval'. See also `setcheck' and `setcheckbreak'. -- Function: timer (, ..., ) -- Function: timer (all) -- Function: timer () Given functions , ..., , `timer' puts each one on the list of functions for which timing statistics are collected. `timer(f)$ timer(g)$' puts `f' and then `g' onto the list; the list accumulates from one call to the next. `timer(all)' puts all user-defined functions (as named by the global variable `functions') on the list of timed functions. With no arguments, `timer' returns the list of timed functions. Maxima records how much time is spent executing each function on the list of timed functions. `timer_info' returns the timing statistics, including the average time elapsed per function call, the number of calls, and the total time elapsed. `untimer' removes functions from the list of timed functions. `timer' quotes its arguments. `f(x) := x^2$ g:f$ timer(g)$' does not put `f' on the timer list. If `trace(f)' is in effect, then `timer(f)' has no effect; `trace' and `timer' cannot both be in effect at the same time. See also `timer_devalue'. -- Function: untimer (, ..., ) -- Function: untimer () Given functions , ..., , `untimer' removes each function from the timer list. With no arguments, `untimer' removes all functions currently on the timer list. After `untimer (f)' is executed, `timer_info (f)' still returns previously collected timing statistics, although `timer_info()' (with no arguments) does not return information about any function not currently on the timer list. `timer (f)' resets all timing statistics to zero and puts `f' on the timer list again. -- Option variable: timer_devalue Default value: `false' When `timer_devalue' is `true', Maxima subtracts from each timed function the time spent in other timed functions. Otherwise, the time reported for each function includes the time spent in other functions. Note that time spent in untimed functions is not subtracted from the total time. See also `timer' and `timer_info'. -- Function: timer_info (, ..., ) -- Function: timer_info () Given functions , ..., , `timer_info' returns a matrix containing timing information for each function. With no arguments, `timer_info' returns timing information for all functions currently on the timer list. The matrix returned by `timer_info' contains the function name, time per function call, number of function calls, total time, and `gctime', which meant "garbage collection time" in the original Macsyma but is now always zero. The data from which `timer_info' constructs its return value can also be obtained by the `get' function: get(f, 'calls); get(f, 'runtime); get(f, 'gctime); See also `timer'. -- Function: trace (, ..., ) -- Function: trace (all) -- Function: trace () Given functions , ..., , `trace' instructs Maxima to print out debugging information whenever those functions are called. `trace(f)$ trace(g)$' puts `f' and then `g' onto the list of functions to be traced; the list accumulates from one call to the next. `trace(all)' puts all user-defined functions (as named by the global variable `functions') on the list of functions to be traced. With no arguments, `trace' returns a list of all the functions currently being traced. The `untrace' function disables tracing. See also `trace_options'. `trace' quotes its arguments. Thus, `f(x) := x^2$ g:f$ trace(g)$' does not put `f' on the trace list. When a function is redefined, it is removed from the timer list. Thus after `timer(f)$ f(x) := x^2$', function `f' is no longer on the timer list. If `timer (f)' is in effect, then `trace (f)' has no effect; `trace' and `timer' can't both be in effect for the same function. -- Function: trace_options (, , ..., ) -- Function: trace_options () Sets the trace options for function . Any previous options are superseded. `trace_options (, ...)' has no effect unless `trace ()' is also called (either before or after `trace_options'). `trace_options ()' resets all options to their default values. The option keywords are: * `noprint' Do not print a message at function entry and exit. * `break' Put a breakpoint before the function is entered, and after the function is exited. See `break'. * `lisp_print' Display arguments and return values as Lisp objects. * `info' Print `-> true' at function entry and exit. * `errorcatch' Catch errors, giving the option to signal an error, retry the function call, or specify a return value. Trace options are specified in two forms. The presence of the option keyword alone puts the option into effect unconditionally. (Note that option is not put into effect by specifying `: true' or a similar form; note also that keywords need not be quoted.) Specifying the option keyword with a predicate function makes the option conditional on the predicate. The argument list to the predicate function is always `[level, direction, function, item]' where `level' is the recursion level for the function, `direction' is either `enter' or `exit', `function' is the name of the function, and `item' is the argument list (on entering) or the return value (on exiting). Here is an example of unconditional trace options: (%i1) ff(n) := if equal(n, 0) then 1 else n * ff(n - 1)$ (%i2) trace (ff)$ (%i3) trace_options (ff, lisp_print, break)$ (%i4) ff(3); Here is the same function, with the `break' option conditional on a predicate: (%i5) trace_options (ff, break(pp))$ (%i6) pp (level, direction, function, item) := block (print (item), return (function = 'ff and level = 3 and direction = exit))$ (%i7) ff(6); -- Function: untrace (, ..., ) -- Function: untrace () Given functions , ..., , `untrace' disables tracing enabled by the `trace' function. With no arguments, `untrace' disables tracing for all functions. `untrace' returns a list of the functions for which it disabled tracing.  File: maxima.info, Node: augmented_lagrangian, Next: bode, Prev: Debugging, Up: Top 42 augmented_lagrangian *********************** * Menu: * Functions and Variables for augmented_lagrangian::  File: maxima.info, Node: Functions and Variables for augmented_lagrangian, Prev: augmented_lagrangian, Up: augmented_lagrangian 42.1 Functions and Variables for augmented_lagrangian ===================================================== -- Function: augmented_lagrangian_method (, , , ) -- Function: augmented_lagrangian_method (, , , , optional_args) Returns an approximate minimum of the expression with respect to the variables , holding the constraints equal to zero. is a list of initial guesses for . The method employed is the augmented Lagrangian method (see Refs [1] and [2]). `optional_args' represents additional arguments, specified as ` = '. The optional arguments recognized are: `niter' Number of iterations of the augmented Lagrangian algorithm `lbfgs_tolerance' Tolerance supplied to LBFGS `iprint' IPRINT parameter (a list of two integers which controls verbosity) supplied to LBFGS `%lambda' Initial value of `%lambda' to be used for calculating the augmented Lagrangian This implementation minimizes the augmented Lagrangian by applying the limited-memory BFGS (LBFGS) algorithm, which is a quasi-Newton algorithm. `load(augmented_lagrangian)' loads this function. See also `lbfgs'. References: [1] `http://www-fp.mcs.anl.gov/otc/Guide/OptWeb/continuous/constrained/nonlinearcon/auglag.html' [2] `http://www.cs.ubc.ca/spider/ascher/542/chap10.pdf' Example: (%i1) load (lbfgs); (%o1) /maxima/share/lbfgs/lbfgs.mac (%i2) load (augmented_lagrangian); (%o2) /maxima/share/contrib/augmented_lagrangian.mac (%i3) FOM: x^2 + 2*y^2; 2 2 (%o3) 2 y + x (%i4) xx: [x, y]; (%o4) [x, y] (%i5) C: [x + y - 1]; (%o5) [y + x - 1] (%i6) yy: [1, 1]; (%o6) [1, 1] (%i7) augmented_lagrangian_method(FOM, xx, C, yy, iprint=[-1,0]); (%o7) [[x = 0.66665984108002, y = 0.33334027245545], %lambda = [- 1.333337940892525]]  File: maxima.info, Node: bode, Next: contrib_ode, Prev: augmented_lagrangian, Up: Top 43 bode ******* * Menu: * Functions and Variables for bode::  File: maxima.info, Node: Functions and Variables for bode, Prev: bode, Up: bode 43.1 Functions and Variables for bode ===================================== -- Function: bode_gain (, , ......) Function to draw Bode gain plots. Examples (1 through 7 from `http://www.swarthmore.edu/NatSci/echeeve1/Ref/Bode/BodeHow.html', 8 from Ron Crummett): (%i1) load("bode")$ (%i2) H1 (s) := 100 * (1 + s) / ((s + 10) * (s + 100))$ (%i3) bode_gain (H1 (s), [w, 1/1000, 1000])$ (%i4) H2 (s) := 1 / (1 + s/omega0)$ (%i5) bode_gain (H2 (s), [w, 1/1000, 1000]), omega0 = 10$ (%i6) H3 (s) := 1 / (1 + s/omega0)^2$ (%i7) bode_gain (H3 (s), [w, 1/1000, 1000]), omega0 = 10$ (%i8) H4 (s) := 1 + s/omega0$ (%i9) bode_gain (H4 (s), [w, 1/1000, 1000]), omega0 = 10$ (%i10) H5 (s) := 1/s$ (%i11) bode_gain (H5 (s), [w, 1/1000, 1000])$ (%i12) H6 (s) := 1/((s/omega0)^2 + 2 * zeta * (s/omega0) + 1)$ (%i13) bode_gain (H6 (s), [w, 1/1000, 1000]), omega0 = 10, zeta = 1/10$ (%i14) H7 (s) := (s/omega0)^2 + 2 * zeta * (s/omega0) + 1$ (%i15) bode_gain (H7 (s), [w, 1/1000, 1000]), omega0 = 10, zeta = 1/10$ (%i16) H8 (s) := 0.5 / (0.0001 * s^3 + 0.002 * s^2 + 0.01 * s)$ (%i17) bode_gain (H8 (s), [w, 1/1000, 1000])$ To use this function write first `load("bode")'. See also `bode_phase' -- Function: bode_phase (, , ......) Function to draw Bode phase plots. Examples (1 through 7 from `http://www.swarthmore.edu/NatSci/echeeve1/Ref/Bode/BodeHow.html', 8 from Ron Crummett): (%i1) load("bode")$ (%i2) H1 (s) := 100 * (1 + s) / ((s + 10) * (s + 100))$ (%i3) bode_phase (H1 (s), [w, 1/1000, 1000])$ (%i4) H2 (s) := 1 / (1 + s/omega0)$ (%i5) bode_phase (H2 (s), [w, 1/1000, 1000]), omega0 = 10$ (%i6) H3 (s) := 1 / (1 + s/omega0)^2$ (%i7) bode_phase (H3 (s), [w, 1/1000, 1000]), omega0 = 10$ (%i8) H4 (s) := 1 + s/omega0$ (%i9) bode_phase (H4 (s), [w, 1/1000, 1000]), omega0 = 10$ (%i10) H5 (s) := 1/s$ (%i11) bode_phase (H5 (s), [w, 1/1000, 1000])$ (%i12) H6 (s) := 1/((s/omega0)^2 + 2 * zeta * (s/omega0) + 1)$ (%i13) bode_phase (H6 (s), [w, 1/1000, 1000]), omega0 = 10, zeta = 1/10$ (%i14) H7 (s) := (s/omega0)^2 + 2 * zeta * (s/omega0) + 1$ (%i15) bode_phase (H7 (s), [w, 1/1000, 1000]), omega0 = 10, zeta = 1/10$ (%i16) H8 (s) := 0.5 / (0.0001 * s^3 + 0.002 * s^2 + 0.01 * s)$ (%i17) bode_phase (H8 (s), [w, 1/1000, 1000])$ (%i18) block ([bode_phase_unwrap : false], bode_phase (H8 (s), [w, 1/1000, 1000])); (%i19) block ([bode_phase_unwrap : true], bode_phase (H8 (s), [w, 1/1000, 1000])); To use this function write first `load("bode")'. See also `bode_gain'  File: maxima.info, Node: contrib_ode, Next: descriptive, Prev: bode, Up: Top 44 contrib_ode ************** * Menu: * Introduction to contrib_ode:: * Functions and Variables for contrib_ode:: * Possible improvements to contrib_ode:: * Test cases for contrib_ode:: * References for contrib_ode::  File: maxima.info, Node: Introduction to contrib_ode, Next: Functions and Variables for contrib_ode, Prev: contrib_ode, Up: contrib_ode 44.1 Introduction to contrib_ode ================================ Maxima's ordinary differential equation (ODE) solver `ode2' solves elementary linear ODEs of first and second order. The function `contrib_ode' extends `ode2' with additional methods for linear and non-linear first order ODEs and linear homogeneous second order ODEs. The code is still under development and the calling sequence may change in future releases. Once the code has stabilized it may be moved from the contrib directory and integrated into Maxima. This package must be loaded with the command `load('contrib_ode)' before use. The calling convention for `contrib_ode' is identical to `ode2'. It takes three arguments: an ODE (only the left hand side need be given if the right hand side is 0), the dependent variable, and the independent variable. When successful, it returns a list of solutions. The form of the solution differs from `ode2'. As non-linear equations can have multiple solutions, `contrib_ode' returns a list of solutions. Each solution can have a number of forms: * an explicit solution for the dependent variable, * an implicit solution for the dependent variable, * a parametric solution in terms of variable `%t', or * a tranformation into another ODE in variable `%u'. `%c' is used to represent the constant of integration for first order equations. `%k1' and `%k2' are the constants for second order equations. If `contrib_ode' cannot obtain a solution for whatever reason, it returns `false', after perhaps printing out an error message. It is necessary to return a list of solutions, as even first order non-linear ODEs can have multiple solutions. For example: (%i1) load('contrib_ode)$ (%i2) eqn:x*'diff(y,x)^2-(1+x*y)*'diff(y,x)+y=0; dy 2 dy (%o2) x (--) - (x y + 1) -- + y = 0 dx dx (%i3) contrib_ode(eqn,y,x); x (%o3) [y = log(x) + %c, y = %c %e ] (%i4) method; (%o4) factor Nonlinear ODEs can have singular solutions without constants of integration, as in the second solution of the following example: (%i1) load('contrib_ode)$ (%i2) eqn:'diff(y,x)^2+x*'diff(y,x)-y=0; dy 2 dy (%o2) (--) + x -- - y = 0 dx dx (%i3) contrib_ode(eqn,y,x); 2 2 x (%o3) [y = %c x + %c , y = - --] 4 (%i4) method; (%o4) clairault The following ODE has two parametric solutions in terms of the dummy variable `%t'. In this case the parametric solutions can be manipulated to give explicit solutions. (%i1) load('contrib_ode)$ (%i2) eqn:'diff(y,x)=(x+y)^2; dy 2 (%o2) -- = (y + x) dx (%i3) contrib_ode(eqn,y,x); (%o3) [[x = %c - atan(sqrt(%t)), y = - x - sqrt(%t)], [x = atan(sqrt(%t)) + %c, y = sqrt(%t) - x]] (%i4) method; (%o4) lagrange The following example (Kamke 1.112) demonstrates an implicit solution. (%i1) load('contrib_ode)$ (%i2) assume(x>0,y>0); (%o2) [x > 0, y > 0] (%i3) eqn:x*'diff(y,x)-x*sqrt(y^2+x^2)-y; dy 2 2 (%o3) x -- - x sqrt(y + x ) - y dx (%i4) contrib_ode(eqn,y,x); y (%o4) [x - asinh(-) = %c] x (%i5) method; (%o5) lie The following Riccati equation is transformed into a linear second order ODE in the variable `%u'. Maxima is unable to solve the new ODE, so it is returned unevaluated. (%i1) load('contrib_ode)$ (%i2) eqn:x^2*'diff(y,x)=a+b*x^n+c*x^2*y^2; 2 dy 2 2 n (%o2) x -- = c x y + b x + a dx (%i3) contrib_ode(eqn,y,x); d%u --- 2 dx 2 n - 2 a d %u (%o3) [[y = - ----, %u c (b x + --) + ---- c = 0]] %u c 2 2 x dx (%i4) method; (%o4) riccati For first order ODEs `contrib_ode' calls `ode2'. It then tries the following methods: factorization, Clairault, Lagrange, Riccati, Abel and Lie symmetry methods. The Lie method is not attempted on Abel equations if the Abel method fails, but it is tried if the Riccati method returns an unsolved second order ODE. For second order ODEs `contrib_ode' calls `ode2' then `odelin'. Extensive debugging traces and messages are displayed if the command `put('contrib_ode,true,'verbose)' is executed.  File: maxima.info, Node: Functions and Variables for contrib_ode, Next: Possible improvements to contrib_ode, Prev: Introduction to contrib_ode, Up: contrib_ode 44.2 Functions and Variables for contrib_ode ============================================ -- Function: contrib_ode (, , ) Returns a list of solutions of the ODE with independent variable and dependent variable . -- Function: odelin (, , ) `odelin' solves linear homogeneous ODEs of first and second order with independent variable and dependent variable . It returns a fundamental solution set of the ODE. For second order ODEs, `odelin' uses a method, due to Bronstein and Lafaille, that searches for solutions in terms of given special functions. (%i1) load('contrib_ode); (%i2) odelin(x*(x+1)*'diff(y,x,2)+(x+5)*'diff(y,x,1)+(-4)*y,y,x); ...trying factor method ...solving 7 equations in 4 variables ...trying the Bessel solver ...solving 1 equations in 2 variables ...trying the F01 solver ...solving 1 equations in 3 variables ...trying the spherodial wave solver ...solving 1 equations in 4 variables ...trying the square root Bessel solver ...solving 1 equations in 2 variables ...trying the 2F1 solver ...solving 9 equations in 5 variables gauss_a(- 6, - 2, - 3, - x) gauss_b(- 6, - 2, - 3, - x) (%o2) {---------------------------, ---------------------------} 4 4 x x -- Function: ode_check (, ) Returns the value of ODE after substituting a possible solution . The value is equivalent to zero if is a solution of . (%i1) load('contrib_ode)$ (%i2) eqn:'diff(y,x,2)+(a*x+b)*y; 2 d y (%o2) --- + (a x + b) y 2 dx (%i3) ans:[y = bessel_y(1/3,2*(a*x+b)^(3/2)/(3*a))*%k2*sqrt(a*x+b) +bessel_j(1/3,2*(a*x+b)^(3/2)/(3*a))*%k1*sqrt(a*x+b)]; 3/2 1 2 (a x + b) (%o3) [y = bessel_y(-, --------------) %k2 sqrt(a x + b) 3 3 a 3/2 1 2 (a x + b) + bessel_j(-, --------------) %k1 sqrt(a x + b)] 3 3 a (%i4) ode_check(eqn,ans[1]); (%o4) 0 -- System variable: `method' The variable `method' is set to the successful solution method. -- Variable: `%c' `%c' is the integration constant for first order ODEs. -- Variable: `%k1' `%k1' is the first integration constant for second order ODEs. -- Variable: `%k2' `%k2' is the second integration constant for second order ODEs. -- Function: gauss_a (, , , ) `gauss_a(a,b,c,x)' and `gauss_b(a,b,c,x)' are 2F1 geometric functions. They represent any two independent solutions of the hypergeometric differential equation `x(1-x) diff(y,x,2) + [c-(a+b+1)x diff(y,x) - aby = 0' (A&S 15.5.1). The only use of these functions is in solutions of ODEs returned by `odelin' and `contrib_ode'. The definition and use of these functions may change in future releases of Maxima. See also `gauss_b', `dgauss_a' and `gauss_b'. -- Function: gauss_b (, , , ) See `gauss_a'. -- Function: dgauss_a (, , , ) The derivative with respect to of `gauss_a(, , , )'. -- Function: dgauss_b (, , , ) The derivative with respect to of `gauss_b(, , , )'. -- Function: kummer_m (, , ) Kummer's M function, as defined in Abramowitz and Stegun, Handbook of Mathematical Functions, Section 13.1.2. The only use of this function is in solutions of ODEs returned by `odelin' and `contrib_ode'. The definition and use of this function may change in future releases of Maxima. See also `kummer_u', `dkummer_m' and `dkummer_u'. -- Function: kummer_u (, , ) Kummer's U function, as defined in Abramowitz and Stegun, Handbook of Mathematical Functions, Section 13.1.3. See `kummer_m'. -- Function: dkummer_m (, , ) The derivative with respect to of `kummer_m(, , )'. -- Function: dkummer_u (, , ) The derivative with respect to of `kummer_u(, , )'.  File: maxima.info, Node: Possible improvements to contrib_ode, Next: Test cases for contrib_ode, Prev: Functions and Variables for contrib_ode, Up: contrib_ode 44.3 Possible improvements to contrib_ode ========================================= These routines are work in progress. I still need to: * Extend the FACTOR method `ode1_factor' to work for multiple roots. * Extend the FACTOR method `ode1_factor' to attempt to solve higher order factors. At present it only attemps to solve linear factors. * Fix the LAGRANGE routine `ode1_lagrange' to prefer real roots over complex roots. * Add additional methods for Riccati equations. * Improve the detection of Abel equations of second kind. The exisiting pattern matching is weak. * Work on the Lie symmetry group routine `ode1_lie'. There are quite a few problems with it: some parts are unimplemented; some test cases seem to run forever; other test cases crash; yet others return very complex "solutions". I wonder if it really ready for release yet. * Add more test cases.  File: maxima.info, Node: Test cases for contrib_ode, Next: References for contrib_ode, Prev: Possible improvements to contrib_ode, Up: contrib_ode 44.4 Test cases for contrib_ode =============================== The routines have been tested on a approximately one thousand test cases from Murphy, Kamke, Zwillinger and elsewhere. These are included in the tests subdirectory. * The Clairault routine `ode1_clairault' finds all known solutions, including singular solutions, of the Clairault equations in Murphy and Kamke. * The other routines often return a single solution when multiple solutions exist. * Some of the "solutions" from `ode1_lie' are overly complex and impossible to check. * There are some crashes.  File: maxima.info, Node: References for contrib_ode, Prev: Test cases for contrib_ode, Up: contrib_ode 44.5 References for contrib_ode =============================== 1. E. Kamke, Differentialgleichungen Losungsmethoden und Losungen, Vol 1, Geest & Portig, Leipzig, 1961 2. G. M. Murphy, Ordinary Differential Equations and Their Solutions, Van Nostrand, New York, 1960 3. D. Zwillinger, Handbook of Differential Equations, 3rd edition, Academic Press, 1998 4. F. Schwarz, Symmetry Analysis of Abel's Equation, Studies in Applied Mathematics, 100:269-294 (1998) 5. F. Schwarz, Algorithmic Solution of Abel's Equation, Computing 61, 39-49 (1998) 6. E. S. Cheb-Terrab, A. D. Roche, Symmetries and First Order ODE Patterns, Computer Physics Communications 113 (1998), p 239. (`http://lie.uwaterloo.ca/papers/ode_vii.pdf') 7. E. S. Cheb-Terrab, T. Koloknikov, First Order ODEs, Symmetries and Linear Transformations, European Journal of Applied Mathematics, Vol. 14, No. 2, pp. 231-246 (2003). (`http://arxiv.org/abs/math-ph/0007023', `http://lie.uwaterloo.ca/papers/ode_iv.pdf') 8. G. W. Bluman, S. C. Anco, Symmetry and Integration Methods for Differential Equations, Springer, (2002) 9. M. Bronstein, S. Lafaille, Solutions of linear ordinary differential equations in terms of special functions, Proceedings of ISSAC 2002, Lille, ACM Press, 23-28. (`http://www-sop.inria.fr/cafe/Manuel.Bronstein/publications/issac2002.pdf')  File: maxima.info, Node: descriptive, Next: diag, Prev: contrib_ode, Up: Top 45 descriptive ************** * Menu: * Introduction to descriptive:: * Functions and Variables for data manipulation:: * Functions and Variables for descriptive statistics:: * Functions and Variables for specific multivariate descriptive statistics:: * Functions and Variables for statistical graphs::  File: maxima.info, Node: Introduction to descriptive, Next: Functions and Variables for data manipulation, Prev: descriptive, Up: descriptive 45.1 Introduction to descriptive ================================ Package `descriptive' contains a set of functions for making descriptive statistical computations and graphing. Together with the source code there are three data sets in your Maxima tree: `pidigits.data', `wind.data' and `biomed.data'. They can be also downloaded from the web site `http://www.biomates.net'. Any statistics manual can be used as a reference to the functions in package `descriptive'. For comments, bugs or suggestions, please contact me at <'mario AT edu DOT xunta DOT es'>. Here is a simple example on how the descriptive functions in `descriptive' do they work, depending on the nature of their arguments, lists or matrices, (%i1) load (descriptive)$ (%i2) /* univariate sample */ mean ([a, b, c]); c + b + a (%o2) --------- 3 (%i3) matrix ([a, b], [c, d], [e, f]); [ a b ] [ ] (%o3) [ c d ] [ ] [ e f ] (%i4) /* multivariate sample */ mean (%); e + c + a f + d + b (%o4) [---------, ---------] 3 3 Note that in multivariate samples the mean is calculated for each column. In case of several samples with possible different sizes, the Maxima function `map' can be used to get the desired results for each sample, (%i1) load (descriptive)$ (%i2) map (mean, [[a, b, c], [d, e]]); c + b + a e + d (%o2) [---------, -----] 3 2 In this case, two samples of sizes 3 and 2 were stored into a list. Univariate samples must be stored in lists like (%i1) s1 : [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5]; (%o1) [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5] and multivariate samples in matrices as in (%i1) s2 : matrix ([13.17, 9.29], [14.71, 16.88], [18.50, 16.88], [10.58, 6.63], [13.33, 13.25], [13.21, 8.12]); [ 13.17 9.29 ] [ ] [ 14.71 16.88 ] [ ] [ 18.5 16.88 ] (%o1) [ ] [ 10.58 6.63 ] [ ] [ 13.33 13.25 ] [ ] [ 13.21 8.12 ] In this case, the number of columns equals the random variable dimension and the number of rows is the sample size. Data can be introduced by hand, but big samples are usually stored in plain text files. For example, file `pidigits.data' contains the first 100 digits of number `%pi': 3 1 4 1 5 9 2 6 5 3 ... In order to load these digits in Maxima, (%i1) load (numericalio)$ (%i2) s1 : read_list (file_search ("pidigits.data"))$ (%i3) length (s1); (%o3) 100 On the other hand, file `wind.data' contains daily average wind speeds at 5 meteorological stations in the Republic of Ireland (This is part of a data set taken at 12 meteorological stations. The original file is freely downloadable from the StatLib Data Repository and its analysis is discused in Haslett, J., Raftery, A. E. (1989) . Applied Statistics 38, 1-50). This loads the data: (%i1) load (numericalio)$ (%i2) s2 : read_matrix (file_search ("wind.data"))$ (%i3) length (s2); (%o3) 100 (%i4) s2 [%]; /* last record */ (%o4) [3.58, 6.0, 4.58, 7.62, 11.25] Some samples contain non numeric data. As an example, file `biomed.data' (which is part of another bigger one downloaded from the StatLib Data Repository) contains four blood measures taken from two groups of patients, `A' and `B', of different ages, (%i1) load (numericalio)$ (%i2) s3 : read_matrix (file_search ("biomed.data"))$ (%i3) length (s3); (%o3) 100 (%i4) s3 [1]; /* first record */ (%o4) [A, 30, 167.0, 89.0, 25.6, 364] The first individual belongs to group `A', is 30 years old and his/her blood measures were 167.0, 89.0, 25.6 and 364. One must take care when working with categorical data. In the next example, symbol `a' is asigned a value in some previous moment and then a sample with categorical value `a' is taken, (%i1) a : 1$ (%i2) matrix ([a, 3], [b, 5]); [ 1 3 ] (%o2) [ ] [ b 5 ]  File: maxima.info, Node: Functions and Variables for data manipulation, Next: Functions and Variables for descriptive statistics, Prev: Introduction to descriptive, Up: descriptive 45.2 Functions and Variables for data manipulation ================================================== -- Function: continuous_freq () -- Function: continuous_freq (, ) The argument of `continuous_freq' must be a list of numbers, which will be then grouped in intervals and counted how many of them belong to each group. Optionally, function `continuous_freq' admits a second argument indicating the number of classes, 10 is default, (%i1) load (numericalio)$ (%i2) load (descriptive)$ (%i3) s1 : read_list (file_search ("pidigits.data"))$ (%i4) continuous_freq (s1, 5); (%o4) [[0, 1.8, 3.6, 5.4, 7.2, 9.0], [16, 24, 18, 17, 25]] The first list contains the interval limits and the second the corresponding counts: there are 16 digits inside the interval `[0, 1.8]', that is 0's and 1's, 24 digits in `(1.8, 3.6]', that is 2's and 3's, and so on. -- Function: discrete_freq () Counts absolute frequencies in discrete samples, both numeric and categorical. Its unique argument is a list, (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s1 : read_list (file_search ("pidigits.data")); (%o3) [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9, 3, 2, 3, 8, 4, 6, 2, 6, 4, 3, 3, 8, 3, 2, 7, 9, 5, 0, 2, 8, 8, 4, 1, 9, 7, 1, 6, 9, 3, 9, 9, 3, 7, 5, 1, 0, 5, 8, 2, 0, 9, 7, 4, 9, 4, 4, 5, 9, 2, 3, 0, 7, 8, 1, 6, 4, 0, 6, 2, 8, 6, 2, 0, 8, 9, 9, 8, 6, 2, 8, 0, 3, 4, 8, 2, 5, 3, 4, 2, 1, 1, 7, 0, 6, 7] (%i4) discrete_freq (s1); (%o4) [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [8, 8, 12, 12, 10, 8, 9, 8, 12, 13]] The first list gives the sample values and the second their absolute frequencies. Commands `? col' and `? transpose' should help you to understand the last input. -- Function: subsample (, ) -- Function: subsample (, , , , ...) This is a sort of variation of the Maxima `submatrix' function. The first argument is the name of the data matrix, the second is a quoted logical expression and optional additional arguments are the numbers of the columns to be taken. Its behaviour is better understood with examples, (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s2 : read_matrix (file_search ("wind.data"))$ (%i4) subsample (s2, '(%c[1] > 18)); [ 19.38 15.37 15.12 23.09 25.25 ] [ ] [ 18.29 18.66 19.08 26.08 27.63 ] (%o4) [ ] [ 20.25 21.46 19.95 27.71 23.38 ] [ ] [ 18.79 18.96 14.46 26.38 21.84 ] These are multivariate records in which the wind speeds in the first meteorological station were greater than 18. See that in the quoted logical expression the -th component is refered to as `%c[i]'. Symbol `%c[i]' is used inside function `subsample', therefore when used as a categorical variable, Maxima gets confused. In the following example, we request only the first, second and fifth components of those records with wind speeds greater or equal than 16 in station number 1 and lesser than 25 knots in station number 4, (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s2 : read_matrix (file_search ("wind.data"))$ (%i4) subsample (s2, '(%c[1] >= 16 and %c[4] < 25), 1, 2, 5); [ 19.38 15.37 25.25 ] [ ] [ 17.33 14.67 19.58 ] (%o4) [ ] [ 16.92 13.21 21.21 ] [ ] [ 17.25 18.46 23.87 ] Here is an example with the categorical variables of `biomed.data'. We want the records corresponding to those patients in group `B' who are older than 38 years, (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s3 : read_matrix (file_search ("biomed.data"))$ (%i4) subsample (s3, '(%c[1] = B and %c[2] > 38)); [ B 39 28.0 102.3 17.1 146 ] [ ] [ B 39 21.0 92.4 10.3 197 ] [ ] [ B 39 23.0 111.5 10.0 133 ] [ ] [ B 39 26.0 92.6 12.3 196 ] (%o4) [ ] [ B 39 25.0 98.7 10.0 174 ] [ ] [ B 39 21.0 93.2 5.9 181 ] [ ] [ B 39 18.0 95.0 11.3 66 ] [ ] [ B 39 39.0 88.5 7.6 168 ] Probably, the statistical analysis will involve only the blood measures, (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s3 : read_matrix (file_search ("biomed.data"))$ (%i4) subsample (s3, '(%c[1] = B and %c[2] > 38), 3, 4, 5, 6); [ 28.0 102.3 17.1 146 ] [ ] [ 21.0 92.4 10.3 197 ] [ ] [ 23.0 111.5 10.0 133 ] [ ] [ 26.0 92.6 12.3 196 ] (%o4) [ ] [ 25.0 98.7 10.0 174 ] [ ] [ 21.0 93.2 5.9 181 ] [ ] [ 18.0 95.0 11.3 66 ] [ ] [ 39.0 88.5 7.6 168 ] This is the multivariate mean of `s3', (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s3 : read_matrix (file_search ("biomed.data"))$ (%i4) mean (s3); 65 B + 35 A 317 6 NA + 8145.0 (%o4) [-----------, ---, 87.178, -------------, 18.123, 100 10 100 3 NA + 19587 ------------] 100 Here, the first component is meaningless, since `A' and `B' are categorical, the second component is the mean age of individuals in rational form, and the fourth and last values exhibit some strange behaviour. This is because symbol `NA' is used here to indicate data, and the two means are of course nonsense. A possible solution would be to take out from the matrix those rows with `NA' symbols, although this deserves some loss of information, (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s3 : read_matrix (file_search ("biomed.data"))$ (%i4) mean(subsample(s3, '(%c[4] # NA and %c[6] # NA), 3,4,5,6)); (%o4) [79.4923076923077, 86.2032967032967, 16.93186813186813, 2514 ----] 13  File: maxima.info, Node: Functions and Variables for descriptive statistics, Next: Functions and Variables for specific multivariate descriptive statistics, Prev: Functions and Variables for data manipulation, Up: descriptive 45.3 Functions and Variables for descriptive statistics ======================================================= -- Function: mean () -- Function: mean () This is the sample mean, defined as n ==== _ 1 \ x = - > x n / i ==== i = 1 Example: (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s1 : read_list (file_search ("pidigits.data"))$ (%i4) mean (s1); 471 (%o4) --- 100 (%i5) %, numer; (%o5) 4.71 (%i6) s2 : read_matrix (file_search ("wind.data"))$ (%i7) mean (s2); (%o7) [9.9485, 10.1607, 10.8685, 15.7166, 14.8441] -- Function: var () -- Function: var () This is the sample variance, defined as n ==== 2 1 \ _ 2 s = - > (x - x) n / i ==== i = 1 Example: (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s1 : read_list (file_search ("pidigits.data"))$ (%i4) var (s1), numer; (%o4) 8.425899999999999 See also function `var1'. -- Function: var1 () -- Function: var1 () This is the sample variance, defined as n ==== 1 \ _ 2 --- > (x - x) n-1 / i ==== i = 1 Example: (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s1 : read_list (file_search ("pidigits.data"))$ (%i4) var1 (s1), numer; (%o4) 8.5110101010101 (%i5) s2 : read_matrix (file_search ("wind.data"))$ (%i6) var1 (s2); (%o6) [17.39586540404041, 15.13912778787879, 15.63204924242424, 32.50152569696971, 24.66977392929294] See also function `var'. -- Function: std () -- Function: std () This is the the square root of function `var', the variance with denominator n. Example: (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s1 : read_list (file_search ("pidigits.data"))$ (%i4) std (s1), numer; (%o4) 2.902740084816414 (%i5) s2 : read_matrix (file_search ("wind.data"))$ (%i6) std (s2); (%o6) [4.149928523480858, 3.871399812729241, 3.933920277534866, 5.672434260526957, 4.941970881136392] See also functions `var' and `std1'. -- Function: std1 () -- Function: std1 () This is the the square root of function `var1', the variance with denominator n-1. Example: (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s1 : read_list (file_search ("pidigits.data"))$ (%i4) std1 (s1), numer; (%o4) 2.917363553109228 (%i5) s2 : read_matrix (file_search ("wind.data"))$ (%i6) std1 (s2); (%o6) [4.17083509672109, 3.89090320978032, 3.953738641137555, 5.701010936401517, 4.966867617451963] See also functions `var1' and `std'. -- Function: noncentral_moment (, ) -- Function: noncentral_moment (, ) The non central moment of order k, defined as n ==== 1 \ k - > x n / i ==== i = 1 Example: (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s1 : read_list (file_search ("pidigits.data"))$ (%i4) noncentral_moment (s1, 1), numer; /* the mean */ (%o4) 4.71 (%i6) s2 : read_matrix (file_search ("wind.data"))$ (%i7) noncentral_moment (s2, 5); (%o7) [319793.8724761506, 320532.1923892463, 391249.5621381556, 2502278.205988911, 1691881.797742255] See also function `central_moment'. -- Function: central_moment (, ) -- Function: central_moment (, ) The central moment of order k, defined as n ==== 1 \ _ k - > (x - x) n / i ==== i = 1 Example: (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s1 : read_list (file_search ("pidigits.data"))$ (%i4) central_moment (s1, 2), numer; /* the variance */ (%o4) 8.425899999999999 (%i6) s2 : read_matrix (file_search ("wind.data"))$ (%i7) central_moment (s2, 3); (%o7) [11.29584771375004, 16.97988248298583, 5.626661952750102, 37.5986572057918, 25.85981904394192] See also functions `central_moment' and `mean'. -- Function: cv () -- Function: cv () The variation coefficient is the quotient between the sample standard deviation (`std') and the `mean', (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s1 : read_list (file_search ("pidigits.data"))$ (%i4) cv (s1), numer; (%o4) .6193977819764815 (%i5) s2 : read_matrix (file_search ("wind.data"))$ (%i6) cv (s2); (%o6) [.4192426091090204, .3829365309260502, 0.363779605385983, .3627381836021478, .3346021393989506] See also functions `std' and `mean'. -- Function: mini () -- Function: mini () This is the minimum value of the sample , (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s1 : read_list (file_search ("pidigits.data"))$ (%i4) mini (s1); (%o4) 0 (%i5) s2 : read_matrix (file_search ("wind.data"))$ (%i6) mini (s2); (%o6) [0.58, 0.5, 2.67, 5.25, 5.17] See also function `maxi'. -- Function: maxi () -- Function: maxi () This is the maximum value of the sample , (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s1 : read_list (file_search ("pidigits.data"))$ (%i4) maxi (s1); (%o4) 9 (%i5) s2 : read_matrix (file_search ("wind.data"))$ (%i6) maxi (s2); (%o6) [20.25, 21.46, 20.04, 29.63, 27.63] See also function `mini'. -- Function: range () -- Function: range () The range is the difference between the extreme values. Example: (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s1 : read_list (file_search ("pidigits.data"))$ (%i4) range (s1); (%o4) 9 (%i5) s2 : read_matrix (file_search ("wind.data"))$ (%i6) range (s2); (%o6) [19.67, 20.96, 17.37, 24.38, 22.46] -- Function: quantile (,

) -- Function: quantile (,

) This is the

-quantile, with

a number in [0, 1], of the sample . Although there are several definitions for the sample quantile (Hyndman, R. J., Fan, Y. (1996) . American Statistician, 50, 361-365), the one based on linear interpolation is implemented in package `descriptive'. Example: (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s1 : read_list (file_search ("pidigits.data"))$ (%i4) /* 1st and 3rd quartiles */ [quantile (s1, 1/4), quantile (s1, 3/4)], numer; (%o4) [2.0, 7.25] (%i5) s2 : read_matrix (file_search ("wind.data"))$ (%i6) quantile (s2, 1/4); (%o6) [7.2575, 7.477500000000001, 7.82, 11.28, 11.48] -- Function: median () -- Function: median () Once the sample is ordered, if the sample size is odd the median is the central value, otherwise it is the mean of the two central values. Example: (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s1 : read_list (file_search ("pidigits.data"))$ (%i4) median (s1); 9 (%o4) - 2 (%i5) s2 : read_matrix (file_search ("wind.data"))$ (%i6) median (s2); (%o6) [10.06, 9.855, 10.73, 15.48, 14.105] The median is the 1/2-quantile. See also function `quantile'. -- Function: qrange () -- Function: qrange () The interquartilic range is the difference between the third and first quartiles, `quantile(,3/4) - quantile(,1/4)', (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s1 : read_list (file_search ("pidigits.data"))$ (%i4) qrange (s1); 21 (%o4) -- 4 (%i5) s2 : read_matrix (file_search ("wind.data"))$ (%i6) qrange (s2); (%o6) [5.385, 5.572499999999998, 6.0225, 8.729999999999999, 6.650000000000002] See also function `quantile'. -- Function: mean_deviation () -- Function: mean_deviation () The mean deviation, defined as n ==== 1 \ _ - > |x - x| n / i ==== i = 1 Example: (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s1 : read_list (file_search ("pidigits.data"))$ (%i4) mean_deviation (s1); 51 (%o4) -- 20 (%i5) s2 : read_matrix (file_search ("wind.data"))$ (%i6) mean_deviation (s2); (%o6) [3.287959999999999, 3.075342, 3.23907, 4.715664000000001, 4.028546000000002] See also function `mean'. -- Function: median_deviation () -- Function: median_deviation () The median deviation, defined as n ==== 1 \ - > |x - med| n / i ==== i = 1 where `med' is the median of . Example: (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s1 : read_list (file_search ("pidigits.data"))$ (%i4) median_deviation (s1); 5 (%o4) - 2 (%i5) s2 : read_matrix (file_search ("wind.data"))$ (%i6) median_deviation (s2); (%o6) [2.75, 2.755, 3.08, 4.315, 3.31] See also function `mean'. -- Function: harmonic_mean () -- Function: harmonic_mean () The harmonic mean, defined as n -------- n ==== \ 1 > -- / x ==== i i = 1 Example: (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) y : [5, 7, 2, 5, 9, 5, 6, 4, 9, 2, 4, 2, 5]$ (%i4) harmonic_mean (y), numer; (%o4) 3.901858027632205 (%i5) s2 : read_matrix (file_search ("wind.data"))$ (%i6) harmonic_mean (s2); (%o6) [6.948015590052786, 7.391967752360356, 9.055658197151745, 13.44199028193692, 13.01439145898509] See also functions `mean' and `geometric_mean'. -- Function: geometric_mean () -- Function: geometric_mean () The geometric mean, defined as / n \ 1/n | /===\ | | ! ! | | ! ! x | | ! ! i| | i = 1 | \ / Example: (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) y : [5, 7, 2, 5, 9, 5, 6, 4, 9, 2, 4, 2, 5]$ (%i4) geometric_mean (y), numer; (%o4) 4.454845412337012 (%i5) s2 : read_matrix (file_search ("wind.data"))$ (%i6) geometric_mean (s2); (%o6) [8.82476274347979, 9.22652604739361, 10.0442675714889, 14.61274126349021, 13.96184163444275] See also functions `mean' and `harmonic_mean'. -- Function: kurtosis () -- Function: kurtosis () The kurtosis coefficient, defined as n ==== 1 \ _ 4 ---- > (x - x) - 3 4 / i n s ==== i = 1 Example: (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s1 : read_list (file_search ("pidigits.data"))$ (%i4) kurtosis (s1), numer; (%o4) - 1.273247946514421 (%i5) s2 : read_matrix (file_search ("wind.data"))$ (%i6) kurtosis (s2); (%o6) [- .2715445622195385, 0.119998784429451, - .4275233490482866, - .6405361979019522, - .4952382132352935] See also functions `mean', `var' and `skewness'. -- Function: skewness () -- Function: skewness () The skewness coefficient, defined as n ==== 1 \ _ 3 ---- > (x - x) 3 / i n s ==== i = 1 Example: (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s1 : read_list (file_search ("pidigits.data"))$ (%i4) skewness (s1), numer; (%o4) .009196180476450306 (%i5) s2 : read_matrix (file_search ("wind.data"))$ (%i6) skewness (s2); (%o6) [.1580509020000979, .2926379232061854, .09242174416107717, .2059984348148687, .2142520248890832] See also functions `mean', `var' and `kurtosis'. -- Function: pearson_skewness () -- Function: pearson_skewness () Pearson's skewness coefficient, defined as _ 3 (x - med) ----------- s where is the median of . Example: (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s1 : read_list (file_search ("pidigits.data"))$ (%i4) pearson_skewness (s1), numer; (%o4) .2159484029093895 (%i5) s2 : read_matrix (file_search ("wind.data"))$ (%i6) pearson_skewness (s2); (%o6) [- .08019976629211892, .2357036272952649, .1050904062491204, .1245042340592368, .4464181795804519] See also functions `mean', `var' and `median'. -- Function: quartile_skewness () -- Function: quartile_skewness () The quartile skewness coefficient, defined as c - 2 c + c 3/4 1/2 1/4 -------------------- c - c 3/4 1/4 where c_p is the

-quantile of sample . Example: (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s1 : read_list (file_search ("pidigits.data"))$ (%i4) quartile_skewness (s1), numer; (%o4) .04761904761904762 (%i5) s2 : read_matrix (file_search ("wind.data"))$ (%i6) quartile_skewness (s2); (%o6) [- 0.0408542246982353, .1467025572005382, 0.0336239103362392, .03780068728522298, 0.210526315789474] See also function `quantile'.  File: maxima.info, Node: Functions and Variables for specific multivariate descriptive statistics, Next: Functions and Variables for statistical graphs, Prev: Functions and Variables for descriptive statistics, Up: descriptive 45.4 Functions and Variables for specific multivariate descriptive statistics ============================================================================= -- Function: cov () The covariance matrix of the multivariate sample, defined as n ==== 1 \ _ _ S = - > (X - X) (X - X)' n / j j ==== j = 1 where X_j is the j-th row of the sample matrix. Example: (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s2 : read_matrix (file_search ("wind.data"))$ (%i4) fpprintprec : 7$ /* change precision for pretty output */ (%i5) cov (s2); [ 17.22191 13.61811 14.37217 19.39624 15.42162 ] [ ] [ 13.61811 14.98774 13.30448 15.15834 14.9711 ] [ ] (%o5) [ 14.37217 13.30448 15.47573 17.32544 16.18171 ] [ ] [ 19.39624 15.15834 17.32544 32.17651 20.44685 ] [ ] [ 15.42162 14.9711 16.18171 20.44685 24.42308 ] See also function `cov1'. -- Function: cov1 () The covariance matrix of the multivariate sample, defined as n ==== 1 \ _ _ S = --- > (X - X) (X - X)' 1 n-1 / j j ==== j = 1 where X_j is the j-th row of the sample matrix. Example: (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s2 : read_matrix (file_search ("wind.data"))$ (%i4) fpprintprec : 7$ /* change precision for pretty output */ (%i5) cov1 (s2); [ 17.39587 13.75567 14.51734 19.59216 15.5774 ] [ ] [ 13.75567 15.13913 13.43887 15.31145 15.12232 ] [ ] (%o5) [ 14.51734 13.43887 15.63205 17.50044 16.34516 ] [ ] [ 19.59216 15.31145 17.50044 32.50153 20.65338 ] [ ] [ 15.5774 15.12232 16.34516 20.65338 24.66977 ] See also function `cov'. -- Function: global_variances () -- Function: global_variances (, ) Function `global_variances' returns a list of global variance measures: * : `trace(S_1)', * : `trace(S_1)/p', * : `determinant(S_1)', * : `sqrt(determinant(S_1))', * `determinant(S_1)^(1/p)', (defined in: Pen~a, D. (2002) ; McGraw-Hill, Madrid.) * : `determinant(S_1)^(1/(2*p))'. where

) Returns the value at of the probability function of a Binomial(n,p) random variable, with 0,,

) Returns the value at of the distribution function of a Binomial(n,p) random variable, with 0,,

) Returns the -quantile of a Binomial(n,p) random variable, with 0 must be an element of [0,1]. To make use of this function, write first `load(distrib)'. -- Function: mean_binomial (,

) Returns the mean of a Binomial(n,p) random variable, with 0,

) Returns the variance of a Binomial(n,p) random variable, with 0,

) Returns the standard deviation of a Binomial(n,p) random variable, with 0,

) Returns the skewness coefficient of a Binomial(n,p) random variable, with 0,

) Returns the kurtosis coefficient of a Binomial(n,p) random variable, with 0. Communications of the ACM, 31, Feb., 216. * `bernoulli', based on simulation of Bernoulli trials. * `inverse', based on the general inverse method. See also `random_binomial'. -- Function: random_binomial (,

) -- Function: random_binomial (,

,) Returns a Binomial(n,p) random variate, with 0, a random sample of size will be simulated. There are three algorithms implemented for this function, the one to be used can be selected giving a certain value to the global variable `random_binomial_algorithm', which defaults to `kachit'. See also `random_binomial_algorithm'. To make use of this function, write first `load(distrib)'. -- Function: pdf_poisson (,) Returns the value at of the probability function of a Poisson(m) random variable, with m>0. To make use of this function, write first `load(distrib)'. -- Function: cdf_poisson (,) Returns the value at of the distribution function of a Poisson(m) random variable, with m>0. This function is numerically computed if the global variable `numer' equals `true', otherwise it returns a nominal expression. (%i1) load (distrib)$ (%i2) cdf_poisson(3,5); (%o2) cdf_poisson(3, 5) (%i3) cdf_poisson(3,5), numer; (%o3) .2650259152973617 -- Function: quantile_poisson (,) Returns the -quantile of a Poisson(m) random variable, with m>0; in other words, this is the inverse of `cdf_poisson'. Argument must be an element of [0,1]. To make use of this function, write first `load(distrib)'. -- Function: mean_poisson () Returns the mean of a Poisson(m) random variable, with m>0. To make use of this function, write first `load(distrib)'. -- Function: var_poisson () Returns the variance of a Poisson(m) random variable, with m>0. To make use of this function, write first `load(distrib)'. -- Function: std_poisson () Returns the standard deviation of a Poisson(m) random variable, with m>0. To make use of this function, write first `load(distrib)'. -- Function: skewness_poisson () Returns the skewness coefficient of a Poisson(m) random variable, with m>0. To make use of this function, write first `load(distrib)'. -- Function: kurtosis_poisson () Returns the kurtosis coefficient of a Poisson random variable Poi(m), with m>0. To make use of this function, write first `load(distrib)'. -- Option variable: random_poisson_algorithm Default value: `ahrens_dieter' This is the selected algorithm for simulating random Poisson variates. Implemented algorithms are `ahrens_dieter' and `inverse': * `ahrens_dieter', based on algorithm described in Ahrens, J.H. and Dieter, U. (1982) . ACM Trans. Math. Software, 8, 2, June,163-179. * `inverse', based on the general inverse method. See also `random_poisson'. -- Function: random_poisson () -- Function: random_poisson (,) Returns a Poisson(m) random variate, with m>0. Calling `random_poisson' with a second argument , a random sample of size will be simulated. There are two algorithms implemented for this function, the one to be used can be selected giving a certain value to the global variable `random_poisson_algorithm', which defaults to `ahrens_dieter'. See also `random_poisson_algorithm'. To make use of this function, write first `load(distrib)'. -- Function: pdf_bernoulli (,

) Returns the value at of the probability function of a Bernoulli(p) random variable, with 0,

) Returns the value at of the distribution function of a Bernoulli(p) random variable, with 0,

) Returns the -quantile of a Bernoulli(p) random variable, with 0 must be an element of [0,1]. To make use of this function, write first `load(distrib)'. -- Function: mean_bernoulli (

) Returns the mean of a Bernoulli(p) random variable, with 0) Returns the variance of a Bernoulli(p) random variable, with 0) Returns the standard deviation of a Bernoulli(p) random variable, with 0) Returns the skewness coefficient of a Bernoulli(p) random variable, with 0) Returns the kurtosis coefficient of a Bernoulli(p) random variable, with 0) -- Function: random_bernoulli (

,) Returns a Bernoulli(p) random variate, with 0, a random sample of size will be simulated. This is a direct application of the `random' built-in Maxima function. See also `random'. To make use of this function, write first `load(distrib)'. -- Function: pdf_geometric (,

) Returns the value at of the probability function of a Geometric(p) random variable, with 0,

) Returns the value at of the distribution function of a Geometric(p) random variable, with 0,

) Returns the -quantile of a Geometric(p) random variable, with 0 must be an element of [0,1]. To make use of this function, write first `load(distrib)'. -- Function: mean_geometric (

) Returns the mean of a Geometric(p) random variable, with 0) Returns the variance of a Geometric(p) random variable, with 0) Returns the standard deviation of a Geometric(p) random variable, with 0) Returns the skewness coefficient of a Geometric(p) random variable, with 0) Returns the kurtosis coefficient of a geometric random variable Geo(p), with 0 Springer Verlag, p. 480. * `inverse', based on the general inverse method. See also `random_geometric'. -- Function: random_geometric (

) -- Function: random_geometric (

,) Returns a Geometric(p) random variate, with 0, a random sample of size will be simulated. There are three algorithms implemented for this function, the one to be used can be selected giving a certain value to the global variable `random_geometric_algorithm', which defaults to `bernoulli'. See also `random_geometric_algorithm'. To make use of this function, write first `load(distrib)'. -- Function: pdf_discrete_uniform (,) Returns the value at of the probability function of a Discrete Uniform(n) random variable, with n a strictly positive integer. To make use of this function, write first `load(distrib)'. -- Function: cdf_discrete_uniform (,) Returns the value at of the distribution function of a Discrete Uniform(n) random variable, with n a strictly positive integer. To make use of this function, write first `load(distrib)'. -- Function: quantile_discrete_uniform (,) Returns the -quantile of a Discrete Uniform(n) random variable, with n a strictly positive integer; in other words, this is the inverse of `cdf_discrete_uniform'. Argument must be an element of [0,1]. To make use of this function, write first `load(distrib)'. -- Function: mean_discrete_uniform () Returns the mean of a Discrete Uniform(n) random variable, with n a strictly positive integer. To make use of this function, write first `load(distrib)'. -- Function: var_discrete_uniform () Returns the variance of a Discrete Uniform(n) random variable, with n a strictly positive integer. To make use of this function, write first `load(distrib)'. -- Function: std_discrete_uniform () Returns the standard deviation of a Discrete Uniform(n) random variable, with n a strictly positive integer. To make use of this function, write first `load(distrib)'. -- Function: skewness_discrete_uniform () Returns the skewness coefficient of a Discrete Uniform(n) random variable, with n a strictly positive integer. To make use of this function, write first `load(distrib)'. -- Function: kurtosis_discrete_uniform () Returns the kurtosis coefficient of a Discrete Uniform(n) random variable, with n a strictly positive integer. To make use of this function, write first `load(distrib)'. -- Function: random_discrete_uniform () -- Function: random_discrete_uniform (,) Returns a Discrete Uniform(n) random variate, with n a strictly positive integer. Calling `random_discrete_uniform' with a second argument , a random sample of size will be simulated. This is a direct application of the `random' built-in Maxima function. See also `random'. To make use of this function, write first `load(distrib)'. -- Function: pdf_hypergeometric (,,,) Returns the value at of the probability function of a Hypergeometric(n1,n2,n) random variable, with , and non negative integers and n<=n1+n2. To make use of this function, write first `load(distrib)'. -- Function: cdf_hypergeometric (,,,) Returns the value at of the distribution function of a Hypergeometric(n1,n2,n) random variable, with , and non negative integers and n<=n1+n2. To make use of this function, write first `load(distrib)'. -- Function: quantile_hypergeometric (,,,) Returns the -quantile of a Hypergeometric(n1,n2,n) random variable, with , and non negative integers and n<=n1+n2; in other words, this is the inverse of `cdf_hypergeometric'. Argument must be an element of [0,1]. To make use of this function, write first `load(distrib)'. -- Function: mean_hypergeometric (,,) Returns the mean of a discrete uniform random variable Hyp(n1,n2,n), with , and non negative integers and n<=n1+n2. To make use of this function, write first `load(distrib)'. -- Function: var_hypergeometric (,,) Returns the variance of a hypergeometric random variable Hyp(n1,n2,n), with , and non negative integers and n<=n1+n2. To make use of this function, write first `load(distrib)'. -- Function: std_hypergeometric (,,) Returns the standard deviation of a Hypergeometric(n1,n2,n) random variable, with , and non negative integers and n<=n1+n2. To make use of this function, write first `load(distrib)'. -- Function: skewness_hypergeometric (,,) Returns the skewness coefficient of a Hypergeometric(n1,n2,n) random variable, with , and non negative integers and n<=n1+n2. To make use of this function, write first `load(distrib)'. -- Function: kurtosis_hypergeometric (,,) Returns the kurtosis coefficient of a Hypergeometric(n1,n2,n) random variable, with , and non negative integers and n<=n1+n2. To make use of this function, write first `load(distrib)'. -- Option variable: random_hypergeometric_algorithm Default value: `kachit' This is the selected algorithm for simulating random hypergeometric variates. Implemented algorithms are `kachit' and `inverse': * `kachit', based on algorithm described in Kachitvichyanukul, V., Schmeiser, B.W. (1985) Journal of Statistical Computation and Simulation 22, 127-145. * `inverse', based on the general inverse method. See also `random_hypergeometric'. -- Function: random_hypergeometric (,,) -- Function: random_hypergeometric (,,,) Returns a Hypergeometric(n1,n2,n) random variate, with , and non negative integers and n<=n1+n2. Calling `random_hypergeometric' with a fourth argument , a random sample of size will be simulated. There are two algorithms implemented for this function, the one to be used can be selected giving a certain value to the global variable `random_hypergeometric_algorithm', which defaults to `kachit'. See also `random_hypergeometric_algorithm'. To make use of this function, write first `load(distrib)'. -- Function: pdf_negative_binomial (,,

) Returns the value at of the probability function of a Negative Binomial(n,p) random variable, with 0,,

) Returns the value at of the distribution function of a Negative Binomial(n,p) random variable, with 0,,

) Returns the -quantile of a Negative Binomial(n,p) random variable, with 0 must be an element of [0,1]. To make use of this function, write first `load(distrib)'. -- Function: mean_negative_binomial (,

) Returns the mean of a Negative Binomial(n,p) random variable, with 0,

) Returns the variance of a Negative Binomial(n,p) random variable, with 0,

) Returns the standard deviation of a Negative Binomial(n,p) random variable, with 0,

) Returns the skewness coefficient of a Negative Binomial(n,p) random variable, with 0,

) Returns the kurtosis coefficient of a Negative Binomial(n,p) random variable, with 0. Springer Verlag, p. 480. * `bernoulli', based on simulation of Bernoulli trials. * `inverse', based on the general inverse method. See also `random_negative_binomial'. -- Function: random_negative_binomial (,

) -- Function: random_negative_binomial (,

,) Returns a Negative Binomial(n,p) random variate, with 0, a random sample of size will be simulated. There are three algorithms implemented for this function, the one to be used can be selected giving a certain value to the global variable `random_negative_binomial_algorithm', which defaults to `bernoulli'. See also `random_negative_binomial_algorithm'. To make use of this function, write first `load(distrib)'.  File: maxima.info, Node: draw, Next: dynamics, Prev: distrib, Up: Top 48 draw ******* * Menu: * Introduction to draw:: * Functions and Variables for draw:: * Functions and Variables for pictures:: * Functions and Variables for worldmap::  File: maxima.info, Node: Introduction to draw, Next: Functions and Variables for draw, Prev: draw, Up: draw 48.1 Introduction to draw ========================= `draw' is a Maxima-Gnuplot interface. There are three main functions to be used at Maxima level: `draw2d', `draw3d' and `draw'. Follow this link for more elaborated examples of this package: `http://www.telefonica.net/web2/biomates/maxima/gpdraw' You need Gnuplot 4.2 to run this program.  File: maxima.info, Node: Functions and Variables for draw, Next: Functions and Variables for pictures, Prev: Introduction to draw, Up: draw 48.2 Functions and Variables for draw ===================================== -- Graphic option: xrange Default value: `false' If `xrange' is `false', the range for the coordinate is computed automatically. If the user wants a specific interval for , it must be given as a Maxima list, as in `xrange=[-2, 3]'. Since this is a global graphics option, its position in the scene description does not matter. Example: (%i1) load(draw)$ (%i2) draw2d(xrange = [-3,5], explicit(x^2,x,-1,1))$ See also `yrange' and `zrange'. -- Graphic option: yrange Default value: `false' If `yrange' is `false', the range for the coordinate is computed automatically. If the user wants a specific interval for , it must be given as a Maxima list, as in `yrange=[-2, 3]'. Since this is a global graphics option, its position in the scene description does not matter. Example: (%i1) load(draw)$ (%i2) draw2d(yrange = [-2,3], explicit(x^2,x,-1,1), xrange = [-3,3])$ See also `xrange' and `zrange'. -- Graphic option: zrange Default value: `false' If `zrange' is `false', the range for the coordinate is computed automatically. If the user wants a specific interval for , it must be given as a Maxima list, as in `zrange=[-2, 3]'. Since this is a global graphics option, its position in the scene description does not matter. Example: (%i1) load(draw)$ (%i2) draw3d(yrange = [-3,3], zrange = [-2,5], explicit(x^2+y^2,x,-1,1,y,-1,1), xrange = [-3,3])$ See also `yrange' and `zrange'. -- Graphic option: logx Default value: `false' If `logx' is `true', the axis will be drawn in the logarithmic scale. Since this is a global graphics option, its position in the scene description does not matter. Example: (%i1) load(draw)$ (%i2) draw2d(explicit(log(x),x,0.01,5), logx = true)$ See also `logy' and `logz'. -- Graphic option: logy Default value: `false' If `logy' is `true', the axis will be drawn in the logarithmic scale. Since this is a global graphics option, its position in the scene description does not matter. Example: (%i1) load(draw)$ (%i2) draw2d(logy = true, explicit(exp(x),x,0,5))$ See also `logx' and `logz'. -- Graphic option: logz Default value: `false' If `logz' is `true', the axis will be drawn in the logarithmic scale. Since this is a global graphics option, its position in the scene description does not matter. Example: (%i1) load(draw)$ (%i2) draw3d(logz = true, explicit(exp(u^2+v^2),u,-2,2,v,-2,2))$ See also `logx' and `logy'. -- Graphic option: terminal Default value: `screen' Selects the terminal to be used by Gnuplot; possible values are: `screen' (default), `png', `jpg', `eps', and `eps_color'. Since this is a global graphics option, its position in the scene description does not matter. It can be also used as an argument of function `draw'. Examples: (%i1) load(draw)$ (%i2) /* screen terminal (default) */ draw2d(explicit(x^2,x,-1,1))$ (%i3) /* png file */ draw2d(terminal = 'png, pic_width = 300, explicit(x^2,x,-1,1))$ (%i4) /* jpg file */ draw2d(terminal = 'jpg, pic_width = 300, pic_height = 300, explicit(x^2,x,-1,1))$ (%i5) /* eps file */ draw2d(file_name = "myfile", explicit(x^2,x,-1,1), terminal = 'eps)$ See also `file_name', `pic_width', and `pic_height'. -- Graphic option: grid Default value: `false' If `grid' is `true', a grid will be drawn on the plane. Since this is a global graphics option, its position in the scene description does not matter. Example: (%i1) load(draw)$ (%i2) draw2d(grid = true, explicit(exp(u),u,-2,2))$ -- Graphic option: title Default value: `""' (empty string) Option `title' stores a Maxima string with the main title for the scene. By default, no title is written. Since this is a global graphics option, its position in the scene description does not matter. Example: (%i1) load(draw)$ (%i2) draw2d(explicit(exp(u),u,-2,2), title = "Exponential function")$ -- Graphic option: xlabel Default value: `""' (empty string) Option `xlabel' stores a Maxima string with the label for the axis. By default, no label is written. Since this is a global graphics option, its position in the scene description does not matter. Example: (%i1) load(draw)$ (%i2) draw2d(xlabel = "Time", explicit(exp(u),u,-2,2), ylabel = "Population")$ See also `ylabel', and `zlabel'. -- Graphic option: ylabel Default value: `""' (empty string) Option `ylabel' stores a Maxima string with the label for the axis. By default, no label is written. Since this is a global graphics option, its position in the scene description does not matter. Example: (%i1) load(draw)$ (%i2) draw2d(xlabel = "Time", ylabel = "Population", explicit(exp(u),u,-2,2) )$ See also `xlabel', and `zlabel'. -- Graphic option: zlabel Default value: `""' (empty string) Option `zlabel' stores a Maxima string with the label for the axis. By default, no label is written. Since this is a global graphics option, its position in the scene description does not matter. Example: (%i1) load(draw)$ (%i2) draw3d(zlabel = "Z variable", ylabel = "Y variable", explicit(sin(x^2+y^2),x,-2,2,y,-2,2), xlabel = "X variable" )$ See also `xlabel', and `ylabel'. -- Graphic option: xtics Default value: `true' If `xtics' is `true', tics will be written in the axis. Since this is a global graphics option, its position in the scene description does not matter. Example: (%i1) load(draw)$ (%i2) /* No tics in the x-axis */ draw2d(xtics = false, explicit(exp(u),u,-2,2))$ See also `ytics', and `ztics'. -- Graphic option: ytics Default value: `true' If `ytics' is `true', tics will be written in the axis. Since this is a global graphics option, its position in the scene description does not matter. Example: (%i1) load(draw)$ (%i2) draw2d(ytics = false, explicit(exp(u),u,-2,2), xtics = false)$ See also `xtics', and `ztics'. -- Graphic option: ztics Default value: `true' If `ztics' is `true', tics will be written in the axis. Since this is a global graphics option, its position in the scene description does not matter. Example: (%i1) load(draw)$ (%i2) /* No tics in the z-axis */ draw3d(ztics = false, explicit(sin(x^2+y^2),x,-2,2,y,-2,2) )$ See also `xtics', and `ytics'. -- Graphic option: rot_vertical Default value: 60 `rot_vertical' is the angle (in degrees) of vertical rotation (around the axis) to set the view point in 3d scenes. The angle is bounded to the [0, 180] interval. Since this is a global graphics option, its position in the scene description does not matter. Example: (%i1) load(draw)$ (%i2) draw3d(rot_vertical = 170, explicit(sin(x^2+y^2),x,-2,2,y,-2,2) )$ See also `rot_horizontal'. -- Graphic option: rot_horizontal Default value: 30 `rot_horizontal' is the angle (in degrees) of horizontal rotation (around the axis) to set the view point in 3d scenes. The angle is bounded to the [0, 360] interval. Since this is a global graphics option, its position in the scene description does not matter. Example: (%i1) load(draw)$ (%i2) draw3d(rot_vertical = 170, rot_horizontal = 360, explicit(sin(x^2+y^2),x,-2,2,y,-2,2) )$ See also `rot_vertical'. -- Graphic option: xy_file Default value: `""' (empty string) `xy_file' is the name of the file where the coordinates will be saved after clicking with the mouse button and hitting the 'x' key. By default, no coordinates are saved. Since this is a global graphics option, its position in the scene description does not matter. -- Graphic option: user_preamble Default value: `""' (empty string) Expert Gnuplot users can make use of this option to fine tune Gnuplot's behaviour by writing settings to be sent before the `plot' or `splot' command. The value of this option must be a string or a list of strings (one per line). Since this is a global graphics option, its position in the scene description does not matter. Example: The dumb terminal is not supported by package `draw', but it is possible to set it by making use of option `user_preamble', (%i1) load(draw)$ (%i2) draw2d(explicit(exp(x)-1,x,-1,1), parametric(cos(u),sin(u),u,0,2*%pi), user_preamble="set terminal dumb")$ -- Graphic option: file_name Default value: `"maxima_out"' This is the name of the file where terminals `png', `jpg', `eps' and `eps_color' will save the graphic. Since this is a global graphics option, its position in the scene description does not matter. It can be also used as an argument of function `draw'. Example: (%i1) load(draw)$ (%i2) draw2d(file_name = "myfile", explicit(x^2,x,-1,1), terminal = 'png)$ See also `terminal', `pic_width', and `pic_height'. -- Graphic option: pic_width Default value: 640 This is the width of the bitmap file generated by terminals `png' and `jpg'. Since this is a global graphics option, its position in the scene description does not matter. It can be also used as an argument of function `draw'. Example: (%i1) load(draw)$ (%i2) draw2d(terminal = 'png, pic_width = 300, pic_height = 300, explicit(x^2,x,-1,1))$ See also `terminal', `file_name', and `pic_height'. -- Graphic option: pic_height Default value: 640 This is the height of the bitmap file generated by terminals `png' and `jpg'. Since this is a global graphics option, its position in the scene description does not matter. It can be also used as an argument of function `draw'. Example: (%i1) load(draw)$ (%i2) draw2d(terminal = 'png, pic_width = 300, pic_height = 300, explicit(x^2,x,-1,1))$ See also `terminal', `file_name', and `pic_width'. -- Graphic option: eps_width Default value: 12 This is the width (measured in cm) of the Postscipt file generated by terminals `eps' and `eps_color'. Since this is a global graphics option, its position in the scene description does not matter. It can be also used as an argument of function `draw'. Example: (%i1) load(draw)$ (%i2) draw2d(terminal = 'eps, eps_width = 3, eps_height = 3, explicit(x^2,x,-1,1))$ See also `terminal', `file_name', and `eps_height'. -- Graphic option: eps_height Default value: 8 This is the height (measured in cm) of the Postscipt file generated by terminals `eps' and `eps_color'. Since this is a global graphics option, its position in the scene description does not matter. It can be also used as an argument of function `draw'. Example: (%i1) load(draw)$ (%i2) draw2d(terminal = 'eps, eps_width = 3, eps_height = 3, explicit(x^2,x,-1,1))$ See also `terminal', `file_name', and `eps_width'. -- Graphic option: axis_bottom Default value: `true' If `axis_bottom' is `true', the bottom axis is shown in 2d scenes. Since this is a global graphics option, its position in the scene description does not matter. Example: (%i1) load(draw)$ (%i2) draw2d(axis_bottom = false, explicit(x^3,x,-1,1))$ See also `axis_left', `axis_top', `axis_right', and `axis_3d'. -- Graphic option: axis_left Default value: `true' If `axis_left' is `true', the left axis is shown in 2d scenes. Since this is a global graphics option, its position in the scene description does not matter. Example: (%i1) load(draw)$ (%i2) draw2d(axis_left = false, explicit(x^3,x,-1,1))$ See also `axis_bottom', `axis_top', `axis_right', and `axis_3d'. -- Graphic option: axis_top Default value: `true' If `axis_top' is `true', the top axis is shown in 2d scenes. Since this is a global graphics option, its position in the scene description does not matter. Example: (%i1) load(draw)$ (%i2) draw2d(axis_top = false, explicit(x^3,x,-1,1))$ See also `axis_bottom', `axis_left', `axis_right', and `axis_3d'. -- Graphic option: axis_right Default value: `true' If `axis_right' is `true', the right axis is shown in 2d scenes. Since this is a global graphics option, its position in the scene description does not matter. Example: (%i1) load(draw)$ (%i2) draw2d(axis_right = false, explicit(x^3,x,-1,1))$ See also `axis_bottom', `axis_left', `axis_top', and `axis_3d'. -- Graphic option: axis_3d Default value: `true' If `axis_3d' is `true', the , and axis are shown in 3d scenes. Since this is a global graphics option, its position in the scene description does not matter. Example: (%i1) load(draw)$ (%i2) draw3d(axis_3d = false, explicit(sin(x^2+y^2),x,-2,2,y,-2,2) )$ See also `axis_bottom', `axis_left', `axis_top', and `axis_right' for axis in 2d. -- Graphic option: palette Default value: `color' `palette' indicates how to map the real values of a matrix passed to object `image' onto color components. `palette' is a vector of length three with components ranging from -36 to +36; each value is an index for a formula mapping the levels onto red, green and blue colors, respectively: 0: 0 1: 0.5 2: 1 3: x 4: x^2 5: x^3 6: x^4 7: sqrt(x) 8: sqrt(sqrt(x)) 9: sin(90x) 10: cos(90x) 11: |x-0.5| 12: (2x-1)^2 13: sin(180x) 14: |cos(180x)| 15: sin(360x) 16: cos(360x) 17: |sin(360x)| 18: |cos(360x)| 19: |sin(720x)| 20: |cos(720x)| 21: 3x 22: 3x-1 23: 3x-2 24: |3x-1| 25: |3x-2| 26: (3x-1)/2 27: (3x-2)/2 28: |(3x-1)/2| 29: |(3x-2)/2| 30: x/0.32-0.78125 31: 2*x-0.84 32: 4x;1;-2x+1.84;x/0.08-11.5 33: |2*x - 0.5| 34: 2*x 35: 2*x - 0.5 36: 2*x - 1 negative numbers mean negative colour component. `palette = gray' and `palette = color' are short cuts for `palette = [3,3,3]' and `palette = [7,5,15]', respectively. Since this is a global graphics option, its position in the scene description does not matter. Examples: (%i1) load(draw)$ (%i2) im: apply( 'matrix, makelist(makelist(random(200),i,1,30),i,1,30))$ (%i3) /* palette = color, default */ draw2d(image(im,0,0,30,30))$ (%i4) draw2d(palette = gray, image(im,0,0,30,30))$ (%i5) draw2d(palette = [15,20,-4], colorbox=false, image(im,0,0,30,30))$ See also `colorbox'. -- Graphic option: colorbox Default value: `true' If `colorbox' is `true', a color scale is drawn together with `image' objects. Since this is a global graphics option, its position in the scene description does not matter. Example: (%i1) load(draw)$ (%i2) im: apply('matrix, makelist(makelist(random(200),i,1,30),i,1,30))$ (%i3) draw2d(image(im,0,0,30,30))$ (%i4) draw2d(colorbox=false, image(im,0,0,30,30))$ See also `palette'. -- Graphic option: enhanced3d Default value: `false' If `enhanced3d' is `true', surfaces are colored in 3d plots; in other words, it sets Gnuplot's pm3d mode. See option `palette' to learn how palettes are specified. Example: (%i1) load(draw)$ (%i2) draw3d(surface_hide = true, enhanced3d = true, palette = gray, explicit(20*exp(-x^2-y^2)-10,x,-3,3,y,-3,3))$ -- Graphic option: point_size Default value: 1 `point_size' sets the size for plotted points. It must be a non negative number. This option affects the following graphic objects: * `gr2d': `points'. * `gr3d': `points'. Example: (%i1) load(draw)$ (%i2) draw2d(points(makelist([random(20),random(50)],k,1,10)), point_size = 5, points(makelist(k,k,1,20),makelist(random(30),k,1,20)))$ -- Graphic option: point_type Default value: 1 `point_type' indicates how isolated points are displayed; the value of this option can be any integer index greater or equal than -1, or the name of a point style: `$none' (-1), `dot' (0), `plus' (1), `multiply' (2), `asterisk' (3), `square' (4), `filled_square' (5), `circle' (6), `filled_circle' (7), `up_triangle' (8), `filled_up_triangle' (9), `down_triangle' (10), `filled_down_triangle' (11), `diamant' (12) and `filled_diamant' (13). This option affects the following graphic objects: * `gr2d': `points'. * `gr3d': `points'. Example: (%i1) load(draw)$ (%i2) draw2d(xrange = [0,10], yrange = [0,10], point_size = 3, point_type = diamant, points([[1,1],[5,1],[9,1]]), point_type = filled_down_triangle, points([[1,2],[5,2],[9,2]]), point_type = asterisk, points([[1,3],[5,3],[9,3]]), point_type = filled_diamant, points([[1,4],[5,4],[9,4]]), point_type = 5, points([[1,5],[5,5],[9,5]]), point_type = 6, points([[1,6],[5,6],[9,6]]), point_type = filled_circle, points([[1,7],[5,7],[9,7]]), point_type = 8, points([[1,8],[5,8],[9,8]]), point_type = filled_diamant, points([[1,9],[5,9],[9,9]]) )$ -- Graphic option: points_joined Default value: `false' If `points_joined' is `true', points are joined by lines. This option affects the following graphic objects: * `gr2d': `points'. * `gr3d': `points'. Example: (%i1) load(draw)$ (%i2) draw2d(xrange = [0,10], yrange = [0,4], point_size = 3, point_type = up_triangle, color = blue, points([[1,1],[5,1],[9,1]]), points_joined = true, point_type = square, line_type = dots, points([[1,2],[5,2],[9,2]]), point_type = circle, color = red, line_width = 7, points([[1,3],[5,3],[9,3]]) )$ -- Graphic option: filled_func Default value: `false' `filled_func' indicates whether a function is filled (`true') or not (`false'). This option affects only the 2d graphic object `explicit'. Example: (%i1) load(draw)$ (%i2) draw2d(fill_color = red, filled_func = true, explicit(sin(x),x,0,10) )$ See also `fill_color'. -- Graphic option: transparent Default value: `false' If `transparent' is `true', interior regions of polygons are filled according to `fill_color'. This option affects the following graphic objects: * `gr2d': `polygon', `rectangle', and `ellipse'. Example: (%i1) load(draw)$ (%i2) draw2d(polygon([[3,2],[7,2],[5,5]]), transparent = true, color = blue, polygon([[5,2],[9,2],[7,5]]) )$ -- Graphic option: border Default value: `true' If `border' is `true', borders of polygons are painted according to `line_type' and `line_width'. This option affects the following graphic objects: * `gr2d': `polygon', `rectangle', and `ellipse'. Example: (%i1) load(draw)$ (%i2) draw2d(color = brown, line_width = 8, polygon([[3,2],[7,2],[5,5]]), border = false, fill_color = blue, polygon([[5,2],[9,2],[7,5]]) )$ -- Graphic option: head_both Default value: `false' If `head_both' is `true', vectors are plotted with two arrow heads. If `false', only one arrow is plotted. This option is relevant only for `vector' objects. Example: (%i1) load(draw)$ (%i2) draw2d(xrange = [0,8], yrange = [0,8], head_length = 0.7, vector([1,1],[6,0]), head_both = true, vector([1,7],[6,0]) )$ See also `head_length', `head_angle', and `head_type'. -- Graphic option: head_length Default value: 2 `head_length' indicates, in -axis units, the length of arrow heads. This option is relevant only for `vector' objects. Example: (%i1) load(draw)$ (%i2) draw2d(xrange = [0,12], yrange = [0,8], vector([0,1],[5,5]), head_length = 1, vector([2,1],[5,5]), head_length = 0.5, vector([4,1],[5,5]), head_length = 0.25, vector([6,1],[5,5]))$ See also `head_both', `head_angle', and `head_type'. -- Graphic option: head_angle Default value: 45 `head_angle' indicates the angle, in degrees, between the arrow heads and the segment. This option is relevant only for `vector' objects. Example: (%i1) load(draw)$ (%i2) draw2d(xrange = [0,10], yrange = [0,9], head_length = 0.7, head_angle = 10, vector([1,1],[0,6]), head_angle = 20, vector([2,1],[0,6]), head_angle = 30, vector([3,1],[0,6]), head_angle = 40, vector([4,1],[0,6]), head_angle = 60, vector([5,1],[0,6]), head_angle = 90, vector([6,1],[0,6]), head_angle = 120, vector([7,1],[0,6]), head_angle = 160, vector([8,1],[0,6]), head_angle = 180, vector([9,1],[0,6]) )$ See also `head_both', `head_length', and `head_type'. -- Graphic option: head_type Default value: `filled' `head_type' is used to specify how arrow heads are plotted. Possible values are: `filled' (closed and filled arrow heads), `empty' (closed but not filled arrow heads), and `nofilled' (open arrow heads). This option is relevant only for `vector' objects. Example: (%i1) load(draw)$ (%i2) draw2d(xrange = [0,12], yrange = [0,10], head_length = 1, vector([0,1],[5,5]), /* default type */ head_type = 'empty, vector([3,1],[5,5]), head_type = 'nofilled, vector([6,1],[5,5]))$ See also `head_both', `head_angle', and `head_length'. -- Graphic option: label_alignment Default value: `center' `label_alignment' is used to specify where to write labels with respect to the given coordinates. Possible values are: `center', `left', and `right'. This option is relevant only for `label' objects. Example: (%i1) load(draw)$ (%i2) draw2d(xrange = [0,10], yrange = [0,10], points_joined = true, points([[5,0],[5,10]]), color = blue, label(["Centered alignment (default)",5,2]), label_alignment = 'left, label(["Left alignment",5,5]), label_alignment = 'right, label(["Right alignment",5,8]))$ See also `label_orientation', and `color'. -- Graphic option: label_orientation Default value: `horizontal' `label_orientation' is used to specify orientation of labels. Possible values are: `horizontal', and `vertical'. This option is relevant only for `label' objects. Example: In this example, a dummy point is added to get an image. Package `draw' needs always data to draw an scene. (%i1) load(draw)$ (%i2) draw2d(xrange = [0,10], yrange = [0,10], point_size = 0, points([[5,5]]), color = navy, label(["Horizontal orientation (default)",5,2]), label_orientation = 'vertical, color = "#654321", label(["Vertical orientation",1,5]))$ See also `label_alignment' and `color'. -- Graphic option: color Default value: `"black"' `color' specifies the color for plotting lines, points, borders of polygons and labels. Colors can be given as names or in hexadecimal rgb code. Available color names are: `"white"', `"black"', `"gray0"', `"grey0"', `"gray10"', `"grey10"', `"gray20"', `"grey20"', `"gray30"', `"grey30"', `"gray40"', `"grey40"', `"gray50"', `"grey50"', `"gray60"', `"grey60"', `"gray70"', `"grey70"', `"gray80"', `"grey80"', `"gray90"', `"grey90"', `"gray100"', `"grey100"', `"gray"', `"grey"', `"light-gray"', `"light-grey"', `"dark-gray"', `"dark-grey"', `"red"', `"light-red"', `"dark-red"', `"yellow"', `"light-yellow"', `"dark-yellow"', `"green"', `"light-green"', `"dark-green"', `"spring-green"', `"forest-green"', `"sea-green"', `"blue"', `"light-blue"', `"dark-blue"', `"midnight-blue"', `"navy"', `"medium-blue"', `"royalblue"', `"skyblue"', `"cyan"', `"light-cyan"', `"dark-cyan"', `"magenta"', `"light-magenta"', `"dark-magenta"', `"turquoise"', `"light-turquoise"', `"dark-turquoise"', `"pink"', `"light-pink"', `"dark-pink"', `"coral"', `"light-coral"', `"orange-red"', `"salmon"', `"light-salmon"', `"dark-salmon"', `"aquamarine"', `"khaki"', `"dark-khaki"', `"goldenrod"', `"light-goldenrod"', `"dark-goldenrod"', `"gold"', `"beige"', `"brown"', `"orange"', `"dark-orange"', `"violet"', `"dark-violet"', `"plum"' and `"purple"'. Cromatic componentes in hexadecimal code are introduced in the form `"#rrggbb"'. Example: (%i1) load(draw)$ (%i2) draw2d(explicit(x^2,x,-1,1), /* default is black */ color = "red", explicit(0.5 + x^2,x,-1,1), color = blue, explicit(1 + x^2,x,-1,1), color = "light-blue", /* double quotes if - is used */ explicit(1.5 + x^2,x,-1,1), color = "#23ab0f", label(["This is a label",0,1.2]) )$ See also `fill_color'. -- Graphic option: fill_color Default value: `"red"' `fill_color' specifies the color for filling polygons and 2d explicit functions. See `color' to learn how colors are specified. -- Graphic option: line_width Default value: 1 `line_width' is the width of plotted lines. Its value must be a positive number. This option affects the following graphic objects: * `gr2d': `points', `polygon', `rectangle', `ellipse', `vector', `explicit', `implicit', `parametric' and `polar'. * `gr3d': `points' and `parametric'. Example: (%i1) load(draw)$ (%i2) draw2d(explicit(x^2,x,-1,1), /* default width */ line_width = 5.5, explicit(1 + x^2,x,-1,1), line_width = 10, explicit(2 + x^2,x,-1,1))$ See also `line_type'. -- Graphic option: line_type Default value: `solid' `line_type' indicates how lines are displayed; possible values are `solid' and `dots'. This option affects the following graphic objects: * `gr2d': `points', `polygon', `rectangle', `ellipse', `vector', `explicit', `implicit', `parametric' and `polar'. * `gr3d': `points', `explicit', `parametric' and `parametric_surface'. Example: (%i1) load(draw)$ (%i2) draw2d(line_type = dots, explicit(1 + x^2,x,-1,1), line_type = solid, /* default */ explicit(2 + x^2,x,-1,1))$ See also `line_width'. -- Graphic option: nticks Default value: 30 `nticks' is the number of sample points used by the plotting routine. This option affects the following graphic objects: * `gr2d': `ellipse', `explicit', `parametric' and `polar'. * `gr3d': `parametric'. Example: (%i1) load(draw)$ (%i2) draw2d(transparent = true, ellipse(0,0,4,2,0,180), nticks = 5, ellipse(0,0,4,2,180,180) )$ -- Graphic option: adapt_depth Default value: 10 `adapt_depth' is the maximum number of splittings used by the adaptive plotting routine. This option is relevant only for 2d `explicit' functions. -- Graphic option: key Default value: `""' (empty string) `key' is the name of a function in the legend. If `key' is an empty string, no key is assigned to the function. This option affects the following graphic objects: * `gr2d': `points', `polygon', `rectangle', `ellipse', `vector', `explicit', `implicit', `parametric', and `polar'. * `gr3d': `points', `explicit', `parametric', and `parametric_surface'. Example: (%i1) load(draw)$ (%i2) draw2d(key = "Sinus", explicit(sin(x),x,0,10), key = "Cosinus", color = red, explicit(cos(x),x,0,10) )$ -- Graphic option: xu_grid Default value: 30 `xu_grid' is the number of coordinates of the first variable (`x' in explicit and `u' in parametric 3d surfaces) to build the grid of sample points. This option affects the following graphic objects: * `gr3d': `explicit' and `parametric_surface'. Example: (%i1) load(draw)$ (%i2) draw3d(xu_grid = 10, yv_grid = 50, explicit(x^2+y^2,x,-3,3,y,-3,3) )$ See also `yv_grid'. -- Graphic option: yv_grid Default value: 30 `yv_grid' is the number of coordinates of the second variable (`y' in explicit and `v' in parametric 3d surfaces) to build the grid of sample points. This option affects the following graphic objects: * `gr3d': `explicit' and `parametric_surface'. Example: (%i1) load(draw)$ (%i2) draw3d(xu_grid = 10, yv_grid = 50, explicit(x^2+y^2,x,-3,3,y,-3,3) )$ See also `xu_grid'. -- Graphic option: surface_hide Default value: `false' If `surface_hide' is `true', hidden parts are not plotted in 3d surfaces. Since this is a global graphics option, its position in the scene description does not matter. Example: (%i1) load(draw)$ (%i2) draw(columns=2, gr3d(explicit(exp(sin(x)+cos(x^2)),x,-3,3,y,-3,3)), gr3d(surface_hide = true, explicit(exp(sin(x)+cos(x^2)),x,-3,3,y,-3,3)) )$ -- Graphic option: contour Default value: `none' Option `contour' enables the user to select where to plot contour lines. Possible values are: * `none': no contour lines are plotted. * `base': contour lines are projected on the xy plane. * `surface': contour lines are plotted on the surface. * `both': two contour lines are plotted: on the xy plane and on the surface. * `map': contour lines are projected on the xy plane, and the view point is set just in the vertical. Since this is a global graphics option, its position in the scene description does not matter. Example: (%i1) load(draw)$ (%i2) draw3d(explicit(20*exp(-x^2-y^2)-10,x,0,2,y,-3,3), contour_levels = 15, contour = both, surface_hide = true) $ -- Graphic option: contour_levels Default value: 5 `contour_levels' is the number of levels in contour plots. Since this is a global graphics option, its position in the scene description does not matter. Example: (%i1) load(draw)$ (%i2) draw3d(explicit(20*exp(-x^2-y^2)-10,x,0,2,y,-3,3), contour_levels = 15, contour = both, surface_hide = true) $ -- Graphic option: columns Default value: 1 `columns' is the number of columns in multiple plots. Since this is a global graphics option, its position in the scene description does not matter. It can be also used as an argument of function `draw'. Example: (%i1) load(draw)$ (%i2) scene1: gr2d(title="Ellipse", nticks=30, parametric(2*cos(t),5*sin(t),t,0,2*%pi))$ (%i3) scene2: gr2d(title="Triangle", polygon([4,5,7],[6,4,2]))$ (%i4) draw(scene1, scene2, columns = 2)$ -- Graphic option: ip_grid Default value: `[50, 50]' `ip_grid' sets the grid for the first sampling in implicit plots. This option is relevant only for `implicit' objects. -- Graphic option: ip_grid_in Default value: `[5, 5]' `ip_grid_in' sets the grid for the second sampling in implicit plots. This option is relevant only for `implicit' objects. -- Scene constructor: gr2d (, ..., , ...) Function `gr2d' builds an object describing a 2D scene. Arguments are graphic options and graphic objects. This scene is interpreted sequentially: graphic options affect those graphic objects placed on its right. Some graphic options affect the global appearence of the scene. This is the list of graphic objects available for scenes in two dimensions: `points', `polygon', `rectangle', `ellipse', `label', `vector', `explicit', `implicit', `polar', `parametric', `image' and `geomap'. See also the following global graphic options: `xrange', `yrange', `logx', `logy', `terminal', `grid', `title', `xlabel', `ylabel', `xtics', `ytics', `xy_file', `file_name', `pic_width', `pic_height', `eps_width', `eps_height', `user_preamble', `axis_bottom', `axis_left', `axis_top' and `axis_right'. To make use of this function, write first `load(draw)'. -- Scene constructor: gr3d (, ..., , ...) Function `gr3d' builds an object describing a 3d scene. Arguments are graphic options and graphic objects. This scene is interpreted sequentially: graphic options affect those graphic objects placed on its right. Some graphic options affect the global appearence of the scene. This is the list of graphic objects available for scenes in three dimensions: `points', `label', `vector', `explicit', `parametric' and `parametric_surface'. See also the following graphic options: `xrange', `yrange', `zrange', `logx', `logy', `logz', `terminal', `grid', `title', `xlabel', `ylabel', `zlabel', `xtics', `ytics', `ztics', `xy_file', `user_preamble', `axis_bottom', `axis_left', `axis_top', `file_name', `pic_width', `pic_height', `eps_width', `eps_height', `axis_right', `rot_vertical', `rot_horizontal', `axis_3d', `xu_grid', `yv_grid', `surface_hide', `contour', `contour_levels', `palette', `colorbox' and `enhanced3d'. To make use of this function, write first `load(draw)'. -- Graphic object: points ([[,], [,],...]) -- Graphic object: points ([,,...], [,,...]) -- Graphic object: points ([,,...]) -- Graphic object: points ([[,,], [,,],...]) -- Graphic object: points ([,,...], [,,...], [,,...]) Draws points in 2D and 3D. This object is affected by the following graphic options: `point_size', `point_type', `points_joined', `line_width', `key', `line_type' and `color'. 2D `points ([[,], [,],...])' or `points ([,,...], [,,...])' plots points `[x1,y1]', `[x2,y2]', etc. If abscissas are not given, they are set to consecutive positive integers, so that `points ([,,...])' draws points `[1,]', `[2,]', etc. Example: (%i1) load(draw)$ (%i2) draw2d( key = "Small points", points(makelist([random(20),random(50)],k,1,10)), point_type = circle, point_size = 3, points_joined = true, key = "Great points", points(makelist(k,k,1,20),makelist(random(30),k,1,20)), point_type = filled_down_triangle, key = "Automatic abscissas", color = red, points([2,12,8]))$ 3D `points ([[,,], [,,],...])' or `points ([,,...], [,,...], [,,...])' plots points `[,,]', `[,,]', etc. Examples: One tridimensional sample, (%i1) load(draw)$ (%i2) load (numericalio)$ (%i3) s2 : read_matrix (file_search ("wind.data"))$ (%i4) draw3d(title = "Daily average wind speeds", point_size = 2, points(args(submatrix (s2, 4, 5))) )$ Two tridimensional samples, (%i1) load(draw)$ (%i2) load (numericalio)$ (%i3) s2 : read_matrix (file_search ("wind.data"))$ (%i4) draw3d( title = "Daily average wind speeds. Two data sets", point_size = 2, key = "Sample from stations 1, 2 and 3", points(args(submatrix (s2, 4, 5))), point_type = 4, key = "Sample from stations 1, 4 and 5", points(args(submatrix (s2, 2, 3))) )$ -- Graphic object: polygon ([[,], [,],...]) -- Graphic object: polygon ([,,...], [,,...]) Draws polygons in 2D. 2D `polygon ([[,], [,],...])' or `polygon ([,,...], [,,...])': plots on the plane a polygon with vertices `[,]', `[,]', etc.. This object is affected by the following graphic options: `transparent', `fill_color', `border', `line_width', `key', `line_type' and `color'. Example: (%i1) load(draw)$ (%i2) draw2d(color = "#e245f0", line_width = 8, polygon([[3,2],[7,2],[5,5]]), border = false, fill_color = yellow, polygon([[5,2],[9,2],[7,5]]) )$ -- Graphic object: rectangle ([,], [,]) Draws rectangles in 2D. 2D `rectangle ([,], [,])' draws a rectangle with opposite vertices `[,]' and `[,]'. This object is affected by the following graphic options: `transparent', `fill_color', `border', `line_width', `key', `line_type' and `color'. Example: (%i1) load(draw)$ (%i2) draw2d(fill_color = red, line_width = 6, line_type = dots, transparent = false, fill_color = blue, rectangle([-2,-2],[8,-1]), /* opposite vertices */ transparent = true, line_type = solid, line_width = 1, rectangle([9,4],[2,-1.5]), xrange = [-3,10], yrange = [-3,4.5] )$ -- Graphic object: ellipse (, , , , , ) Draws ellipses and circles in 2D. 2D `ellipse (, , , , , )' plots an ellipse centered at `[, ]' with horizontal and vertical semi axis and , respectively, from angle to angle . This object is affected by the following graphic options: `nticks', `transparent', `fill_color', `border', `line_width', `line_type', `key' and `color'. Example: (%i1) load(draw)$ (%i2) draw2d(transparent = false, fill_color = red, color = gray30, transparent = false, line_width = 5, ellipse(0,6,3,2,270,-270), /* center (x,y), a, b, start & end in degrees */ transparent = true, color = blue, line_width = 3, ellipse(2.5,6,2,3,30,-90), xrange = [-3,6], yrange = [2,9] )$ -- Graphic object: label ([,,],...) -- Graphic object: label ([,,,],...) Writes labels in 2D and 3D. This object is affected by the following graphic options: `label_alignment', `label_orientation' and `color'. 2D `label([,,])' writes the at point `[,]'. Example: (%i1) load(draw)$ (%i2) draw2d(yrange = [0.1,1.4], color = "red", label(["Label in red",0,0.3]), color = "#0000ff", label(["Label in blue",0,0.6]), color = "light-blue", label(["Label in light-blue",0,0.9], ["Another ligght-blue",0,1.2]) )$ 3D `label([,,,])' writes the at point `[,,]'. Example: (%i1) load(draw)$ (%i2) draw3d(explicit(exp(sin(x)+cos(x^2)),x,-3,3,y,-3,3), color = red, label(["UP 1",-2,0,3], ["UP 2",1.5,0,4]), color = blue, label(["DOWN 1",2,0,-3]) )$ -- Graphic object: vector ([,], [,]) -- Graphic object: vector ([,,], [,,]) Draws vectors in 2D and 3D. This object is affected by the following graphic options: `head_both', `head_length', `head_angle', `head_type', `line_width', `line_type', `key' and `color'. 2D `vector([,], [,])' plots vector `[,]' with origin in `[,]'. Example: (%i1) load(draw)$ (%i2) draw2d(xrange = [0,12], yrange = [0,10], head_length = 1, vector([0,1],[5,5]), /* default type */ head_type = 'empty, vector([3,1],[5,5]), head_both = true, head_type = 'nofilled, line_type = dots, vector([6,1],[5,5]))$ 3D `vector([,,], [,,])' plots vector `[,,]' with origin in `[,,]'. Example: (%i1) load(draw)$ (%i2) draw3d(color = cyan, vector([0,0,0],[1,1,1]/sqrt(3)), vector([0,0,0],[1,-1,0]/sqrt(2)), vector([0,0,0],[1,1,-2]/sqrt(6)) )$ -- Graphic object: explicit (,,,) -- Graphic object: explicit (,,,,,,) Draws explicit functions in 2D and 3D. 2D `explicit(,,,)' plots explicit function , with variable taking values from to . This object is affected by the following graphic options: `nticks', `adapt_depth', `line_width', `line_type', `key', `filled_func', `fill_color' and `color'. Example: (%i1) load(draw)$ (%i2) draw2d(line_width = 3, color = blue, explicit(x^2,x,-3,3) )$ (%i3) draw2d(fill_color = brown, filled_func = true, explicit(x^2,x,-3,3) )$ 3D `explicit(,,,,,,)' plots explicit function , with variable taking values from to and variable taking values from to . This object is affected by the following graphic options: `xu_grid', `yv_grid', `line_type', `key' and `color'. Example: (%i1) load(draw)$ (%i2) draw3d(key = "Gauss", color = "#a02c00", explicit(20*exp(-x^2-y^2)-10,x,-3,3,y,-3,3), yv_grid = 10, color = blue, key = "Plane", explicit(x+y,x,-5,5,y,-5,5), surface_hide = true)$ -- Graphic object: implicit (,,,,,,) Draws implicit functions in 2D. 2D `implicit(,,,,,,)' plots the implicit function defined by , with variable taking values from to , and variable taking values from to . This object is affected by the following graphic options: `ip_grid', `ip_grid_in', `line_width', `line_type', `key' and `color'. Example: (%i1) load(draw)$ (%i2) draw2d(terminal = eps, grid = true, line_type = solid, key = "y^2=x^3-2*x+1", implicit(y^2=x^3-2*x+1, x, -4,4, y, -4,4), line_type = dots, key = "x^3+y^3 = 3*x*y^2-x-1", implicit(x^3+y^3 = 3*x*y^2-x-1, x,-4,4, y,-4,4), title = "Two implicit functions" )$ -- Graphic object: polar (,,,) Draws 2D functions defined in polar coordinates. 2D `polar (,,,)' plots function `()' defined in polar coordinates, with variable taking values from to . This object is affected by the following graphic options: `nticks', `line_width', `line_type', `key' and `color'. Example: (%i1) load(draw)$ (%i2) draw2d(user_preamble = "set grid polar", nticks = 200, xrange = [-5,5], yrange = [-5,5], color = blue, line_width = 3, title = "Hyperbolic Spiral", polar(10/theta,theta,1,10*%pi) )$ -- Graphic object: parametric (,,,,) -- Graphic object: parametric (,,,,,) Draws parametric functions in 2D and 3D. This object is affected by the following graphic options: `nticks', `line_width', `line_type', `key' and `color'. 2D `parametric (,,,,)' plots parametric function `[,]', with parameter taking values from to . Example: (%i1) load(draw)$ (%i2) draw2d(explicit(exp(x),x,-1,3), color = red, key = "This is the parametric one!!", parametric(2*cos(rrr),rrr^2,rrr,0,2*%pi))$ 3D `parametric (,,,,,)' plots parametric curve `[,,]', with parameter taking values from to . Example: (%i1) load(draw)$ (%i2) draw3d(explicit(exp(sin(x)+cos(x^2)),x,-3,3,y,-3,3), color = royalblue, parametric(cos(5*u)^2,sin(7*u),u-2,u,0,2), color = turquoise, line_width = 2, parametric(t^2,sin(t),2+t,t,0,2), surface_hide = true, title = "Surface & curves" )$ -- Graphic object: image (,,,,) Renders images in 2D. 2D `image (,,,,)' plots image in the rectangular region from vertex `(,)' to `(x0+,y0+)' on the real plane. Argument must be a matrix of real numbers, a matrix of vectors of length three or a object. If is a matrix of real numbers or a `levels picture' object, pixel values are interpreted according to graphic option `palette', which is a vector of length three with components ranging from -36 to +36; each value is an index for a formula mapping the levels onto red, green and blue colors, respectively: 0: 0 1: 0.5 2: 1 3: x 4: x^2 5: x^3 6: x^4 7: sqrt(x) 8: sqrt(sqrt(x)) 9: sin(90x) 10: cos(90x) 11: |x-0.5| 12: (2x-1)^2 13: sin(180x) 14: |cos(180x)| 15: sin(360x) 16: cos(360x) 17: |sin(360x)| 18: |cos(360x)| 19: |sin(720x)| 20: |cos(720x)| 21: 3x 22: 3x-1 23: 3x-2 24: |3x-1| 25: |3x-2| 26: (3x-1)/2 27: (3x-2)/2 28: |(3x-1)/2| 29: |(3x-2)/2| 30: x/0.32-0.78125 31: 2*x-0.84 32: 4x;1;-2x+1.84;x/0.08-11.5 33: |2*x - 0.5| 34: 2*x 35: 2*x - 0.5 36: 2*x - 1 negative numbers mean negative colour component. `palette = gray' and `palette = color' are short cuts for `palette = [3,3,3]' and `palette = [7,5,15]', respectively. If is a matrix of vectors of length three or an `rgb picture' object, they are interpreted as red, green and blue color components. Examples: If is a matrix of real numbers, pixel values are interpreted according to graphic option `palette'. (%i1) load(draw)$ (%i2) im: apply( 'matrix, makelist(makelist(random(200),i,1,30),i,1,30))$ (%i3) /* palette = color, default */ draw2d(image(im,0,0,30,30))$ (%i4) draw2d(palette = gray, image(im,0,0,30,30))$ (%i5) draw2d(palette = [15,20,-4], colorbox=false, image(im,0,0,30,30))$ See also `colorbox'. If is a matrix of vectors of length three, they are interpreted as red, green and blue color components. (%i1) load(draw)$ (%i2) im: apply( 'matrix, makelist( makelist([random(300), random(300), random(300)],i,1,30),i,1,30))$ (%i3) draw2d(image(im,0,0,30,30))$ Package `draw' automatically loads package `picture'. In this example, a level picture object is built by hand and then rendered. (%i1) load(draw)$ (%i2) im: make_level_picture([45,87,2,134,204,16],3,2); (%o2) picture(level, 3, 2, {Array: #(45 87 2 134 204 16)}) (%i3) /* default color palette */ draw2d(image(im,0,0,30,30))$ (%i4) /* gray palette */ draw2d(palette = gray, image(im,0,0,30,30))$ An xpm file is read and then rendered. (%i1) load(draw)$ (%i2) im: read_xpm("myfile.xpm")$ (%i3) draw2d(image(im,0,0,10,7))$ See also `make_level_picture', `make_rgb_picture' and `read_xpm'. URL `http://www.telefonica.net/web2/biomates/maxima/gpdraw/image' contains more elaborated examples. -- Global variable: boundaries_array Default value: `false' `boundaries_array' is where the graphic object `geomap' looks for boundaries coordinates. Each component of `boundaries_array' is an array of floating point quantities, the coordinates of a polygonal segment or map boundary. See also `geomap'. -- Graphic object: geomap (,,...) Draws cartographic maps in 2D. 2D This function works together with global variable `boundaries_array'. Arguments are numbers or lists containing numbers or lists of numbers. All these numbers must be integers greater or equal than zero, representing the components of global array `boundaries_array'. Each component of `boundaries_array' is an array of floating point quantities, the coordinates of a polygonal segment or map boundary. `geomap (,,...)' flattens its arguments and draws the associated boundaries in `boundaries_array'. This object is affected by the following graphic options: `line_width', `line_type' and `color'. Examples: A simple map defined by hand: (%i1) load(draw)$ (%i2) /* Vertices of boundary #0: {(1,1),(2,5),(4,3)} */ ( bnd0: make_array(flonum,6), bnd0[0]:1.0, bnd0[1]:1.0, bnd0[2]:2.0, bnd0[3]:5.0, bnd0[4]:4.0, bnd0[5]:3.0 )$ (%i3) /* Vertices of boundary #1: {(4,3),(5,4),(6,4),(5,1)} */ ( bnd1: make_array(flonum,8), bnd1[0]:4.0, bnd1[1]:3.0, bnd1[2]:5.0, bnd1[3]:4.0, bnd1[4]:6.0, bnd1[5]:4.0, bnd1[6]:5.0, bnd1[7]:1.0)$ (%i4) /* Vertices of boundary #2: {(5,1), (3,0), (1,1)} */ ( bnd2: make_array(flonum,6), bnd2[0]:5.0, bnd2[1]:1.0, bnd2[2]:3.0, bnd2[3]:0.0, bnd2[4]:1.0, bnd2[5]:1.0 )$ (%i5) /* Vertices of boundary #3: {(1,1), (4,3)} */ ( bnd3: make_array(flonum,4), bnd3[0]:1.0, bnd3[1]:1.0, bnd3[2]:4.0, bnd3[3]:3.0)$ (%i6) /* Vertices of boundary #4: {(4,3), (5,1)} */ ( bnd4: make_array(flonum,4), bnd4[0]:4.0, bnd4[1]:3.0, bnd4[2]:5.0, bnd4[3]:1.0)$ (%i7) /* Pack all together in boundaries_array */ ( boundaries_array: make_array(any,5), boundaries_array[0]: bnd0, boundaries_array[1]: bnd1, boundaries_array[2]: bnd2, boundaries_array[3]: bnd3, boundaries_array[4]: bnd4 )$ (%i8) draw2d(geomap([0,1,2,3,4]))$ Auxiliary package `worldmap' sets global variable `boundaries_array' to real world boundaries in (longitude, latitude) coordinates. These data are in the public domain and come from `http://www-cger.nies.go.jp/grid-e/gridtxt/grid19.html'. Package `worldmap' defines also boundaries for countries and continents as lists with the necessary components of `boundaries_array' (see file `share/draw/worldmap.mac' for more information). Package `draw' does not automatically load `worldmap'. (%i1) load(draw)$ (%i2) load(worldmap)$ (%i3) c1: gr2d(geomap(Canada,United_States, Mexico,Cuba))$ (%i4) c2: gr2d(geomap(Africa))$ (%i5) c3: gr2d(geomap(Oceania,China,Japan))$ (%i6) c4: gr2d(geomap(France,Portugal,Spain, Morocco,Western_Sahara))$ (%i7) draw(columns = 2, c1,c2,c3,c4)$ Package `worldmap' is also useful for plotting countries as polygons. In this case, graphic object `geomap' is no longer necessary and the `polygon' object is used instead. Since lists are now used and not arrays, maps rendering will be slower. See also `make_poly_country' and `make_poly_continent' to understand the following code. (%i1) load(draw)$ (%i2) load(worldmap)$ (%i3) mymap: append( [color = white], /* borders are white */ [fill_color = red], make_poly_country(Bolivia), [fill_color = cyan], make_poly_country(Paraguay), [fill_color = green], make_poly_country(Colombia), [fill_color = blue], make_poly_country(Chile), [fill_color = "#23ab0f"], make_poly_country(Brazil), [fill_color = goldenrod], make_poly_country(Argentina), [fill_color = "midnight-blue"], make_poly_country(Uruguay))$ (%i4) apply(draw2d, mymap)$ See also `http://www.telefonica.net/web2/biomates/maxima/gpdraw/geomap' for more elaborated examples. -- Graphic object: parametric_surface (,,,,,,,,) Draws parametric surfaces in 3D. 3D `parametric_surface (,,,,,,,,)' plots parametric surface `[,,]', with parameter taking values from to and parameter taking values from to . This object is affected by the following graphic options: `xu_grid', `yv_grid', `line_type', `key' and `color'. Example: (%i1) load(draw)$ (%i2) draw3d(title = "Sea shell", xu_grid = 100, yv_grid = 25, rot_vertical = 100, rot_horizontal = 20, surface_hide = true, parametric_surface(0.5*u*cos(u)*(cos(v)+1), 0.5*u*sin(u)*(cos(v)+1), u*sin(v) - ((u+3)/8*%pi)^2 - 20, u, 0, 13*%pi, v, -%pi, %pi) )$ -- Function: draw (, ..., , ..., , ...) Plots a series of scenes; its arguments are `gr2d' and/or `gr3d' objects, together with some options. By default, the scenes are put together in one column. Function `draw' accepts two possible options: `terminal' and `columns'. Functions `draw2d' and `draw3d' are short cuts to be used when only one scene is required, in two or three dimensions, respectively. To make use of this function, write first `load(draw)'. Example: (%i1) load(draw)$ (%i2) scene1: gr2d(title="Ellipse", nticks=30, parametric(2*cos(t),5*sin(t),t,0,2*%pi))$ (%i3) scene2: gr2d(title="Triangle", polygon([4,5,7],[6,4,2]))$ (%i4) draw(scene1, scene2, columns = 2)$ -- Function: draw2d (

is the dimension of the multivariate random variable and S_1 the covariance matrix returned by `cov1'. Example: (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s2 : read_matrix (file_search ("wind.data"))$ (%i4) global_variances (s2); (%o4) [105.338342060606, 21.06766841212119, 12874.34690469686, 113.4651792608502, 6.636590811800794, 2.576158149609762] Function `global_variances' has an optional logical argument: `global_variances(x,true)' tells Maxima that `x' is the data matrix, making the same as `global_variances(x)'. On the other hand, `global_variances(x,false)' means that `x' is not the data matrix, but the covariance matrix, avoiding its recalculation, (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s2 : read_matrix (file_search ("wind.data"))$ (%i4) s : cov1 (s2)$ (%i5) global_variances (s, false); (%o5) [105.338342060606, 21.06766841212119, 12874.34690469686, 113.4651792608502, 6.636590811800794, 2.576158149609762] See also `cov' and `cov1'. -- Function: cor () -- Function: cor (, ) The correlation matrix of the multivariate sample. Example: (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) fpprintprec:7$ (%i4) s2 : read_matrix (file_search ("wind.data"))$ (%i5) cor (s2); [ 1.0 .8476339 .8803515 .8239624 .7519506 ] [ ] [ .8476339 1.0 .8735834 .6902622 0.782502 ] [ ] (%o5) [ .8803515 .8735834 1.0 .7764065 .8323358 ] [ ] [ .8239624 .6902622 .7764065 1.0 .7293848 ] [ ] [ .7519506 0.782502 .8323358 .7293848 1.0 ] Function `cor' has an optional logical argument: `cor(x,true)' tells Maxima that `x' is the data matrix, making the same as `cor(x)'. On the other hand, `cor(x,false)' means that `x' is not the data matrix, but the covariance matrix, avoiding its recalculation, (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) fpprintprec:7$ (%i4) s2 : read_matrix (file_search ("wind.data"))$ (%i5) s : cov1 (s2)$ (%i6) cor (s, false); /* this is faster */ [ 1.0 .8476339 .8803515 .8239624 .7519506 ] [ ] [ .8476339 1.0 .8735834 .6902622 0.782502 ] [ ] (%o6) [ .8803515 .8735834 1.0 .7764065 .8323358 ] [ ] [ .8239624 .6902622 .7764065 1.0 .7293848 ] [ ] [ .7519506 0.782502 .8323358 .7293848 1.0 ] See also `cov' and `cov1'. -- Function: list_correlations () -- Function: list_correlations (, ) Function `list_correlations' returns a list of correlation measures: * : the inverse of the covariance matrix S_1, -1 ij S = (s ) 1 i,j = 1,2,...,p * : (R_1^2, R_2^2, ..., R_p^2), with 2 1 R = 1 - ------- i ii s s ii being an indicator of the goodness of fit of the linear multivariate regression model on X_i when the rest of variables are used as regressors. * : with element (i, j) being ij s r = - ------------ ij.rest / ii jj\ 1/2 |s s | \ / Example: (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s2 : read_matrix (file_search ("wind.data"))$ (%i4) z : list_correlations (s2)$ (%i5) fpprintprec : 5$ /* for pretty output */ (%i6) z[1]; /* precision matrix */ [ .38486 - .13856 - .15626 - .10239 .031179 ] [ ] [ - .13856 .34107 - .15233 .038447 - .052842 ] [ ] (%o6) [ - .15626 - .15233 .47296 - .024816 - .10054 ] [ ] [ - .10239 .038447 - .024816 .10937 - .034033 ] [ ] [ .031179 - .052842 - .10054 - .034033 .14834 ] (%i7) z[2]; /* multiple correlation vector */ (%o7) [.85063, .80634, .86474, .71867, .72675] (%i8) z[3]; /* partial correlation matrix */ [ - 1.0 .38244 .36627 .49908 - .13049 ] [ ] [ .38244 - 1.0 .37927 - .19907 .23492 ] [ ] (%o8) [ .36627 .37927 - 1.0 .10911 .37956 ] [ ] [ .49908 - .19907 .10911 - 1.0 .26719 ] [ ] [ - .13049 .23492 .37956 .26719 - 1.0 ] Function `list_correlations' also has an optional logical argument: `list_correlations(x,true)' tells Maxima that `x' is the data matrix, making the same as `list_correlations(x)'. On the other hand, `list_correlations(x,false)' means that `x' is not the data matrix, but the covariance matrix, avoiding its recalculation. See also `cov' and `cov1'.  File: maxima.info, Node: Functions and Variables for statistical graphs, Prev: Functions and Variables for specific multivariate descriptive statistics, Up: descriptive 45.5 Functions and Variables for statistical graphs =================================================== -- Function: dataplot () -- Function: dataplot (, , , ...) -- Function: dataplot () -- Function: dataplot (, , , ...) Funtion `dataplot' permits direct visualization of sample data, both univariate () and multivariate (). Giving values to the following some aspects of the plot can be controlled: * `'outputdev', default `"x"', indicates the output device; correct values are `"x"', `"eps"' and `"png"', for the screen, postscript and png format files, respectively. * `'maintitle', default `""', is the main title between double quotes. * `'axisnames', default `["x","y","z"]', is a list with the names of axis `x', `y' and `z'. * `'joined', default `false', a logical value to select points in 2D to be joined or isolated. * `'picturescales', default `[1.0, 1.0]', scaling factors for the size of the plot. * `'threedim', default `true', tells Maxima whether to plot a three column matrix with a 3D diagram or a multivariate scatterplot. See examples bellow. * `'axisrot', default `[60, 30]', changes the point of view when `'threedim' is set to `true' and data are stored in a three column matrix. The first number is the rotation angle of the -axis, and the second number is the rotation angle of the -axis, both measured in degrees. * `'nclasses', default `10', is the number of classes for the histograms in the diagonal of multivariate scatterplots. * `'pointstyle', default `1', is an integer to indicate how to display sample points. For example, with the following input a simple plot of the first twenty digits of `%pi' is requested. (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s1 : read_list (file_search ("pidigits.data"))$ (%i4) dataplot (makelist (s1[k], k, 1, 20), 'pointstyle = 3)$ Note that one dimensional data are plotted as a time series. In the next case, same more data with different settings, (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s1 : read_list (file_search ("pidigits.data"))$ (%i4) dataplot (makelist (s1[k], k, 1, 50), 'axisnames = ["digit order", "digit value"], 'pointstyle = 2, 'maintitle = "First pi digits", 'joined = true)$ Function `dataplot' can be used to plot points in the plane. The next example is a scatterplot of the pairs of wind speeds corresponding to the first and fifth meteorological stations, (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s2 : read_matrix (file_search ("wind.data"))$ (%i4) dataplot (submatrix (s2, 2, 3, 4), 'pointstyle = 2, 'maintitle = "Pairs of wind speeds measured in knots", 'axisnames = ["Wind speed in A", "Wind speed in E"])$ If points are stored in a two column matrix, `dataplot' can plot them directly, but if they are formatted as a list of pairs, their must be transformed to a matrix as in the following example. (%i1) load (descriptive)$ (%i2) x : [[-1, 2], [5, 7], [5, -3], [-6, -9], [-4, 6]]$ (%i3) dataplot (apply ('matrix, x), 'maintitle = "Points", 'joined=true, 'axisnames=["", ""], 'picturescales=[0.5, 1.0])$ Points in three dimensional space can be seen as a projection on the plane. In this example, plots of wind speeds corresponding to three meteorological stations are requested, first in a 3D plot and then in a multivariate scatterplot. (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s2 : read_matrix (file_search ("wind.data"))$ (%i4) /* 3D plot */ dataplot (submatrix (s2, 4, 5), 'pointstyle = 2, 'maintitle = "Pairs of wind speeds measured in knots", 'axisnames = ["Station A", "Station B", "Station C"])$ (%i5) /* Multivariate scatterplot */ dataplot (submatrix (s2, 4, 5), 'nclasses = 6, 'threedim = false)$ Note that in the last example, the number of classes in the histograms of the diagonal is set to 6, and that option `'threedim' is set to `false'. For more than three dimensions only multivariate scatterplots are possible, as in (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s2 : read_matrix (file_search ("wind.data"))$ (%i4) dataplot (s2)$ -- Function: histogram () -- Function: histogram (, , , ...) -- Function: histogram () -- Function: histogram (, , , ...) This function plots an histogram. Sample data must be stored in a list of numbers or a one column matrix. Giving values to the following some aspects of the plot can be controlled: * `'outputdev', default `"x"', indicates the output device; correct values are `"x"', `"eps"' and `"png"', for the screen, postscript and png format files, respectively. * `'maintitle', default `""', is the main title between double quotes. * `'axisnames', default `["x", "Fr."]', is a list with the names of axis `x' and `y'. * `'picturescales', default `[1.0, 1.0]', scaling factors for the size of the plot. * `'nclasses', default `10', is the number of classes or bars. * `'relbarwidth', default `0.9', a decimal number between 0 and 1 to control bars width. * `'barcolor', default `1', an integer to indicate bars color. * `'colorintensity', default `1', a decimal number between 0 and 1 to fix color intensity. In the next two examples, histograms are requested for the first 100 digits of number `%pi' and for the wind speeds in the third meteorological station. (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s1 : read_list (file_search ("pidigits.data"))$ (%i4) histogram (s1, 'maintitle = "pi digits", 'axisnames = ["", "Absolute frequency"], 'relbarwidth = 0.2, 'barcolor = 3, 'colorintensity = 0.6)$ (%i5) s2 : read_matrix (file_search ("wind.data"))$ (%i6) histogram (col (s2, 3), 'colorintensity = 0.3)$ Note that in the first case, `s1' is a list and in the second example, `col(s2,3)' is a matrix. See also function `barsplot'. -- Function: barsplot () -- Function: barsplot (, , , ...) -- Function: barsplot () -- Function: barsplot (, , , ...) Similar to `histogram' but for discrete, numeric or categorical, statistical variables. These are the options, * `'outputdev', default `"x"', indicates the output device; correct values are `"x"', `"eps"' and `"png"', for the screen, postscript and png format files, respectively. * `'maintitle', default `""', is the main title between double quotes. * `'axisnames', default `["x", "Fr."]', is a list with the names of axis `x' and `y'. * `'picturescales', default `[1.0, 1.0]', scaling factors for the size of the plot. * `'relbarwidth', default `0.9', a decimal number between 0 and 1 to control bars width. * `'barcolor', default `1', an integer to indicate bars color. * `'colorintensity', default `1', a decimal number between 0 and 1 to fix color intensity. This example plots the barchart for groups `A' and `B' of patients in sample `s3', (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s3 : read_matrix (file_search ("biomed.data"))$ (%i4) barsplot (col (s3, 1), 'maintitle = "Groups of patients", 'axisnames=["Group", "# of individuals"], 'colorintensity=0.2)$ The first column in sample `s3' stores the categorical values `A' and `B', also known sometimes as factors. On the other hand, the positive integer numbers in the second column are ages, in years, which is a discrete variable, so we can plot the absolute frequencies for these values, (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s3 : read_matrix (file_search ("biomed.data"))$ (%i4) barsplot (col (s3, 2), 'maintitle = "Ages", 'axisnames = ["Years", "# of individuals"], 'colorintensity = 0.2, 'relbarwidth = 0.6)$ See also function `histogram'. -- Function: boxplot () -- Function: boxplot (, , , ...) This function plots box diagrams. Argument can be a list, which is not of great interest, since these diagrams are mainly used for comparing different samples, or a matrix, so it is possible to compare two or more components of a multivariate statistical variable. But it is also allowed to be a list of samples with possible different sample sizes, in fact this is the only function in package `descriptive' that admits this type of data structure. See example bellow. These are the options, * `'outputdev', default `"x"', indicates the output device; correct values are `"x"', `"eps"' and `"png"', for the screen, postscript and png format files, respectively. * `'maintitle', default `""', is the main title between double quotes. * `'axisnames', default `["sample", "y"]', is a list with the names of axis `x' and `y'. * `'picturescales', default `[1.0, 1.0]', scaling factors for the size of the plot. Examples: (%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s2 : read_matrix (file_search ("wind.data"))$ (%i4) boxplot (s2, 'maintitle = "Windspeed in knots", 'axisnames = ["Seasons", ""])$ (%i5) A : [[6, 4, 6, 2, 4, 8, 6, 4, 6, 4, 3, 2], [8, 10, 7, 9, 12, 8, 10], [16, 13, 17, 12, 11, 18, 13, 18, 14, 12]]$ (%i6) boxplot (A)$  File: maxima.info, Node: diag, Next: distrib, Prev: descriptive, Up: Top 46 diag ******* * Menu: * Functions and Variables for diag::  File: maxima.info, Node: Functions and Variables for diag, Prev: diag, Up: diag 46.1 Functions and Variables for diag ===================================== -- Function: diag () Constructs a square matrix with the matrices of in the diagonal. is a list of matrices or scalars. Example: (%i1) load("diag")$ (%i2) a1:matrix([1,2,3],[0,4,5],[0,0,6])$ (%i3) a2:matrix([1,1],[1,0])$ (%i4) diag([a1,x,a2]); [ 1 2 3 0 0 0 ] [ ] [ 0 4 5 0 0 0 ] [ ] [ 0 0 6 0 0 0 ] (%o4) [ ] [ 0 0 0 x 0 0 ] [ ] [ 0 0 0 0 1 1 ] [ ] [ 0 0 0 0 1 0 ] To use this function write first `load("diag")'. -- Function: JF (,) Returns the Jordan cell of order with eigenvalue . Example: (%i1) load("diag")$ (%i2) JF(2,5); [ 2 1 0 0 0 ] [ ] [ 0 2 1 0 0 ] [ ] (%o2) [ 0 0 2 1 0 ] [ ] [ 0 0 0 2 1 ] [ ] [ 0 0 0 0 2 ] (%i3) JF(3,2); [ 3 1 ] (%o3) [ ] [ 0 3 ] To use this function write first `load("diag")'. -- Function: jordan () Returns the Jordan form of matrix , but codified in a Maxima list. To get the corresponding matrix, call function `dispJordan' using as argument the output of `jornan'. Example: (%i1) load("diag")$ (%i3) a:matrix([2,0,0,0,0,0,0,0], [1,2,0,0,0,0,0,0], [-4,1,2,0,0,0,0,0], [2,0,0,2,0,0,0,0], [-7,2,0,0,2,0,0,0], [9,0,-2,0,1,2,0,0], [-34,7,1,-2,-1,1,2,0], [145,-17,-16,3,9,-2,0,3])$ (%i34) jordan(a); (%o4) [[2, 3, 3, 1], [3, 1]] (%i5) dispJordan(%); [ 2 1 0 0 0 0 0 0 ] [ ] [ 0 2 1 0 0 0 0 0 ] [ ] [ 0 0 2 0 0 0 0 0 ] [ ] [ 0 0 0 2 1 0 0 0 ] (%o5) [ ] [ 0 0 0 0 2 1 0 0 ] [ ] [ 0 0 0 0 0 2 0 0 ] [ ] [ 0 0 0 0 0 0 2 0 ] [ ] [ 0 0 0 0 0 0 0 3 ] To use this function write first `load("diag")'. See also `dispJordan' and `minimalPoly'. -- Function: dispJordan () Returns the Jordan matrix associated to the codification given by the Maxima list , which is the output given by function `jordan'. Example: (%i1) load("diag")$ (%i2) b1:matrix([0,0,1,1,1], [0,0,0,1,1], [0,0,0,0,1], [0,0,0,0,0], [0,0,0,0,0])$ (%i3) jordan(b1); (%o3) [[0, 3, 2]] (%i4) dispJordan(%); [ 0 1 0 0 0 ] [ ] [ 0 0 1 0 0 ] [ ] (%o4) [ 0 0 0 0 0 ] [ ] [ 0 0 0 0 1 ] [ ] [ 0 0 0 0 0 ] To use this function write first `load("diag")'. See also `jordan' and `minimalPoly'. -- Function: minimalPoly () Returns the minimal polynomial associated to the codification given by the Maxima list , which is the output given by function `jordan'. Example: (%i1) load("diag")$ (%i2) a:matrix([2,1,2,0], [-2,2,1,2], [-2,-1,-1,1], [3,1,2,-1])$ (%i3) jordan(a); (%o3) [[- 1, 1], [1, 3]] (%i4) minimalPoly(%); 3 (%o4) (x - 1) (x + 1) To use this function write first `load("diag")'. See also `jordan' and `dispJordan'. -- Function: ModeMatrix (,) Returns the matrix such that (M^^-1).A.M=J, where is the Jordan form of . The Maxima list is the codified form of the Jordan form as returned by function `jordan'. Example: (%i1) load("diag")$ (%i2) a:matrix([2,1,2,0], [-2,2,1,2], [-2,-1,-1,1], [3,1,2,-1])$ (%i3) jordan(a); (%o3) [[- 1, 1], [1, 3]] (%i4) M: ModeMatrix(a,%); [ 1 - 1 1 1 ] [ ] [ 1 ] [ - - - 1 0 0 ] [ 9 ] [ ] (%o4) [ 13 ] [ - -- 1 - 1 0 ] [ 9 ] [ ] [ 17 ] [ -- - 1 1 1 ] [ 9 ] (%i5) is( (M^^-1).a.M = dispJordan(%o3) ); (%o5) true Note that `dispJordan(%o3)' is the Jordan form of matrix `a'. To use this function write first `load("diag")'. See also `jordan' and `dispJordan'. -- Function: mat_function (,) Returns f(mat), where is an analytic function and a matrix. This computation is based on Cauchy's integral formula, which states that if `f(x)' is analytic and mat = diag([JF(m1,n1),...,JF(mk,nk)]), then f(mat) = ModeMatrix*diag([f(JF(m1,n1)), ..., f(JF(mk,nk))]) *ModeMatrix^^(-1) Note that there are about 6 or 8 other methods for this calculation. Some examples follow. Example 1: (%i1) load("diag")$ (%i2) b2:matrix([0,1,0], [0,0,1], [-1,-3,-3])$ (%i3) mat_function(exp,t*b2); 2 - t t %e - t - t (%o3) matrix([-------- + t %e + %e , 2 - t - t - t 2 %e %e - t - t %e t (- ----- - ----- + %e ) + t (2 %e - -----) t 2 t t - t - t - t - t - t %e 2 %e %e + 2 %e , t (%e - -----) + t (----- - -----) t 2 t 2 - t - t - t - t t %e 2 %e %e - t + %e ], [- --------, - t (- ----- - ----- + %e ), 2 t 2 t - t - t 2 - t 2 %e %e t %e - t - t (----- - -----)], [-------- - t %e , 2 t 2 - t - t - t 2 %e %e - t - t %e t (- ----- - ----- + %e ) - t (2 %e - -----), t 2 t t - t - t - t 2 %e %e - t %e t (----- - -----) - t (%e - -----)]) 2 t t (%i4) ratsimp(%); [ 2 - t ] [ (t + 2 t + 2) %e ] [ -------------------- ] [ 2 ] [ ] [ 2 - t ] (%o4) Col 1 = [ t %e ] [ - -------- ] [ 2 ] [ ] [ 2 - t ] [ (t - 2 t) %e ] [ ---------------- ] [ 2 ] [ 2 - t ] [ (t + t) %e ] [ ] Col 2 = [ 2 - t ] [ - (t - t - 1) %e ] [ ] [ 2 - t ] [ (t - 3 t) %e ] [ 2 - t ] [ t %e ] [ -------- ] [ 2 ] [ ] [ 2 - t ] Col 3 = [ (t - 2 t) %e ] [ - ---------------- ] [ 2 ] [ ] [ 2 - t ] [ (t - 4 t + 2) %e ] [ -------------------- ] [ 2 ] Example 2: (%i5) b1:matrix([0,0,1,1,1], [0,0,0,1,1], [0,0,0,0,1], [0,0,0,0,0], [0,0,0,0,0])$ (%i6) mat_function(exp,t*b1); [ 2 ] [ t ] [ 1 0 t t -- + t ] [ 2 ] [ ] (%o6) [ 0 1 0 t t ] [ ] [ 0 0 1 0 t ] [ ] [ 0 0 0 1 0 ] [ ] [ 0 0 0 0 1 ] (%i7) minimalPoly(jordan(b1)); 3 (%o7) x (%i8) ident(5)+t*b1+1/2*(t^2)*b1^^2; [ 2 ] [ t ] [ 1 0 t t -- + t ] [ 2 ] [ ] (%o8) [ 0 1 0 t t ] [ ] [ 0 0 1 0 t ] [ ] [ 0 0 0 1 0 ] [ ] [ 0 0 0 0 1 ] (%i9) mat_function(exp,%i*t*b1); [ 2 ] [ t ] [ 1 0 %i t %i t %i t - -- ] [ 2 ] [ ] (%o9) [ 0 1 0 %i t %i t ] [ ] [ 0 0 1 0 %i t ] [ ] [ 0 0 0 1 0 ] [ ] [ 0 0 0 0 1 ] (%i10) mat_function(cos,t*b1)+%i*mat_function(sin,t*b1); [ 2 ] [ t ] [ 1 0 %i t %i t %i t - -- ] [ 2 ] [ ] (%o10) [ 0 1 0 %i t %i t ] [ ] [ 0 0 1 0 %i t ] [ ] [ 0 0 0 1 0 ] [ ] [ 0 0 0 0 1 ] Example 3: (%i11) a1:matrix([2,1,0,0,0,0], [-1,4,0,0,0,0], [-1,1,2,1,0,0], [-1,1,-1,4,0,0], [-1,1,-1,1,3,0], [-1,1,-1,1,1,2])$ (%i12) fpow(x):=block([k],declare(k,integer),x^k)$ (%i13) mat_function(fpow,a1); [ k k - 1 ] [ k - 1 ] [ 3 - k 3 ] [ k 3 ] [ ] [ ] [ k - 1 ] [ k k - 1 ] [ - k 3 ] [ 3 + k 3 ] [ ] [ ] [ k - 1 ] [ k - 1 ] [ - k 3 ] [ k 3 ] (%o13) Col 1 = [ ] Col 2 = [ ] [ k - 1 ] [ k - 1 ] [ - k 3 ] [ k 3 ] [ ] [ ] [ k - 1 ] [ k - 1 ] [ - k 3 ] [ k 3 ] [ ] [ ] [ k - 1 ] [ k - 1 ] [ - k 3 ] [ k 3 ] [ 0 ] [ 0 ] [ ] [ ] [ 0 ] [ 0 ] [ ] [ ] [ k k - 1 ] [ k - 1 ] [ 3 - k 3 ] [ k 3 ] [ ] [ ] Col 3 = [ k - 1 ] Col 4 = [ k k - 1 ] [ - k 3 ] [ 3 + k 3 ] [ ] [ ] [ k - 1 ] [ k - 1 ] [ - k 3 ] [ k 3 ] [ ] [ ] [ k - 1 ] [ k - 1 ] [ - k 3 ] [ k 3 ] [ 0 ] [ ] [ 0 ] [ 0 ] [ ] [ ] [ 0 ] [ 0 ] [ ] [ ] [ 0 ] Col 5 = [ 0 ] Col 6 = [ ] [ ] [ 0 ] [ k ] [ ] [ 3 ] [ 0 ] [ ] [ ] [ k k ] [ k ] [ 3 - 2 ] [ 2 ] To use this function write first `load("diag")'.  File: maxima.info, Node: distrib, Next: draw, Prev: diag, Up: Top 47 distrib ********** * Menu: * Introduction to distrib:: * Functions and Variables for continuous distributions:: * Functions and Variables for discrete distributions::  File: maxima.info, Node: Introduction to distrib, Next: Functions and Variables for continuous distributions, Prev: distrib, Up: distrib 47.1 Introduction to distrib ============================ Package `distrib' contains a set of functions for making probability computations on both discrete and continuous univariate models. What follows is a short reminder of basic probabilistic related definitions. Let f(x) be the of an absolute continuous random variable X. The is defined as x / [ F(x) = I f(u) du ] / minf which equals the probability . The value is a localization parameter and is defined as inf / [ E[X] = I x f(x) dx ] / minf The is a measure of variation, inf / [ 2 V[X] = I f(x) (x - E[X]) dx ] / minf which is a positive real number. The square root of the variance is the , D[X]=sqrt(V[X]), and it is another measure of variation. The is a measure of non-symmetry, inf / 1 [ 3 SK[X] = ----- I f(x) (x - E[X]) dx 3 ] D[X] / minf And the measures the peakedness of the distribution, inf / 1 [ 4 KU[X] = ----- I f(x) (x - E[X]) dx - 3 4 ] D[X] / minf If X is gaussian, KU[X]=0. In fact, both skewness and kurtosis are shape parameters used to measure the non-gaussianity of a distribution. If the random variable X is discrete, the density, or , function f(x) takes positive values within certain countable set of numbers x_i, and zero elsewhere. In this case, the distribution function is ==== \ F(x) = > f(x ) / i ==== x <= x i The mean, variance, standard deviation, skewness coefficient and kurtosis coefficient take the form ==== \ E[X] = > x f(x ) , / i i ==== x i ==== \ 2 V[X] = > f(x ) (x - E[X]) , / i i ==== x i D[X] = sqrt(V[X]), ==== 1 \ 3 SK[X] = ------- > f(x ) (x - E[X]) D[X]^3 / i i ==== x i and ==== 1 \ 4 KU[X] = ------- > f(x ) (x - E[X]) - 3 , D[X]^4 / i i ==== x i respectively. Package `distrib' includes functions for simulating random variates. Some of these functions make use of optional variables indicating the algorithm to be used. The general inverse method (based on the fact that if is an uniform random number in (0,1), then is a random variate with distribution F) is implemented in most cases; this is a suboptimal method in terms of timing, but useful for comparing with other algorithms. In this example, the perandom_formance of algorithms `ahrens_cheng' and `inverse' for simulating chi-square variates are compared by means of their histograms: (%i1) load(distrib)$ (%i2) load(descriptive)$ (%i3) showtime: true$ Evaluation took 0.00 seconds (0.00 elapsed) using 32 bytes. (%i4) random_chi2_algorithm: 'ahrens_cheng$ histogram(random_chi2(10,500))$ Evaluation took 0.00 seconds (0.00 elapsed) using 40 bytes. Evaluation took 0.69 seconds (0.71 elapsed) using 5.694 MB. (%i6) random_chi2_algorithm: 'inverse$ histogram(random_chi2(10,500))$ Evaluation took 0.00 seconds (0.00 elapsed) using 32 bytes. Evaluation took 10.15 seconds (10.17 elapsed) using 322.098 MB. In order to make visual comparisons among algorithms for a discrete variate, function `barsplot' of the `descriptive' package should be used. Note that some work remains to be done, since these simulating functions are not yet checked by more rigurous goodness of fit tests. Please, consult an introductory manual on probability and statistics for more information about all this mathematical stuff. There is a naming convention in package `distrib'. Every function name has two parts, the first one makes reference to the function or parameter we want to calculate, Functions: Density function (pdf_*) Distribution function (cdf_*) Quantile (quantile_*) Mean (mean_*) Variance (var_*) Standard deviation (std_*) Skewness coefficient (skewness_*) Kurtosis coefficient (kurtosis_*) Random variate (random_*) The second part is an explicit reference to the probabilistic model, Continuous distributions: Normal (*normal) Student (*student_t) Chi^2 (*chi2) F (*f) Exponential (*exp) Lognormal (*lognormal) Gamma (*gamma) Beta (*beta) Continuous uniform (*continuous_uniform) Logistic (*logistic) Pareto (*pareto) Weibull (*weibull) Rayleigh (*rayleigh) Laplace (*laplace) Cauchy (*cauchy) Gumbel (*gumbel) Discrete distributions: Binomial (*binomial) Poisson (*poisson) Bernoulli (*bernoulli) Geometric (*geometric) Discrete uniform (*discrete_uniform) hypergeometric (*hypergeometric) Negative binomial (*negative_binomial) For example, `pdf_student_t(x,n)' is the density function of the Student distribution with degrees of freedom, `std_pareto(a,b)' is the standard deviation of the Pareto distribution with parameters and and `kurtosis_poisson(m)' is the kurtosis coefficient of the Poisson distribution with mean . In order to make use of package `distrib' you need first to load it by typing (%i1) load(distrib)$ For comments, bugs or suggestions, please contact the author at <'mario AT edu DOT xunta DOT es'>.  File: maxima.info, Node: Functions and Variables for continuous distributions, Next: Functions and Variables for discrete distributions, Prev: Introduction to distrib, Up: distrib 47.2 Functions and Variables for continuous distributions ========================================================= -- Function: pdf_normal (,,) Returns the value at of the density function of a Normal(m,s) random variable, with s>0. To make use of this function, write first `load(distrib)'. -- Function: cdf_normal (,,) Returns the value at of the distribution function of a Normal(m,s) random variable, with s>0. This function is defined in terms of Maxima's built-in error function `erf'. (%i1) load (distrib)$ (%i2) assume(s>0)$ cdf_normal(x,m,s); x - m erf(---------) sqrt(2) s 1 (%o3) -------------- + - 2 2 See also `erf'. -- Function: quantile_normal (,,) Returns the -quantile of a Normal(m,s) random variable, with s>0; in other words, this is the inverse of `cdf_normal'. Argument must be an element of [0,1]. To make use of this function, write first `load(distrib)'. -- Function: mean_normal (,) Returns the mean of a Normal(m,s) random variable, with s>0, namely . To make use of this function, write first `load(distrib)'. -- Function: var_normal (,) Returns the variance of a Normal(m,s) random variable, with s>0, namely . To make use of this function, write first `load(distrib)'. -- Function: std_normal (,) Returns the standard deviation of a Normal(m,s) random variable, with s>0, namely . To make use of this function, write first `load(distrib)'. -- Function: skewness_normal (,) Returns the skewness coefficient of a Normal(m,s) random variable, with s>0, which is always equal to 0. To make use of this function, write first `load(distrib)'. -- Function: kurtosis_normal (,) Returns the kurtosis coefficient of a Normal(m,s) random variable, with s>0, which is always equal to 0. To make use of this function, write first `load(distrib)'. -- Option variable: random_normal_algorithm Default value: `box_mueller' This is the selected algorithm for simulating random normal variates. Implemented algorithms are `box_mueller' and `inverse': * `box_mueller', based on algorithm described in Knuth, D.E. (1981) Addison-Wesley. * `inverse', based on the general inverse method. See also `random_normal'. -- Function: random_normal (,) -- Function: random_normal (,,) Returns a Normal(m,s) random variate, with s>0. Calling `random_normal' with a third argument , a random sample of size will be simulated. There are two algorithms implemented for this function, the one to be used can be selected giving a certain value to the global variable `random_normal_algorithm', which defaults to `box_mueller'. See also `random_normal_algorithm'. To make use of this function, write first `load(distrib)'. -- Function: pdf_student_t (,) Returns the value at of the density function of a Student random variable t(n), with n>0. To make use of this function, write first `load(distrib)'. -- Function: cdf_student_t (,) Returns the value at of the distribution function of a Student random variable t(n), with n>0. This function has no closed form and it is numerically computed if the global variable `numer' equals `true', otherwise it returns a nominal expression. (%i1) load (distrib)$ (%i2) cdf_student_t(1/2, 7/3); 1 7 (%o2) cdf_student_t(-, -) 2 3 (%i3) %,numer; (%o3) .6698450596140417 -- Function: quantile_student_t (,) Returns the -quantile of a Student random variable t(n), with n>0; in other words, this is the inverse of `cdf_student_t'. Argument must be an element of [0,1]. To make use of this function, write first `load(distrib)'. -- Function: mean_student_t () Returns the mean of a Student random variable t(n), with n>0, which is always equal to 0. To make use of this function, write first `load(distrib)'. -- Function: var_student_t () Returns the variance of a Student random variable t(n), with n>2. (%i1) load (distrib)$ (%i2) assume(n>2)$ var_student_t(n); n (%o3) ----- n - 2 -- Function: std_student_t () Returns the standard deviation of a Student random variable t(n), with n>2. To make use of this function, write first `load(distrib)'. -- Function: skewness_student_t () Returns the skewness coefficient of a Student random variable t(n), with n>3, which is always equal to 0. To make use of this function, write first `load(distrib)'. -- Function: kurtosis_student_t () Returns the kurtosis coefficient of a Student random variable t(n), with n>4. To make use of this function, write first `load(distrib)'. -- Option variable: random_student_t_algorithm Default value: `ratio' This is the selected algorithm for simulating random Student variates. Implemented algorithms are `inverse' and `ratio': * `inverse', based on the general inverse method. * `ratio', based on the fact that if is a normal random variable N(0,1) and S^2 is chi square random variable with degrees of freedom, Chi^2(n), then Z X = ------------- / 2 \ 1/2 | S | | --- | \ n / is a Student random variable with degrees of freedom, t(n). See also `random_student_t'. -- Function: random_student_t () -- Function: random_student_t (,) Returns a Student random variate t(n), with n>0. Calling `random_student_t' with a second argument , a random sample of size will be simulated. There are two algorithms implemented for this function, the one to be used can be selected giving a certain value to the global variable `random_student_t_algorithm', which defaults to `ratio'. See also `random_student_t_algorithm'. To make use of this function, write first `load(distrib)'. -- Function: pdf_chi2 (,) Returns the value at of the density function of a Chi-square random variable Chi^2(n), with n>0. The Chi^2(n) random variable is equivalent to the Gamma(n/2,2), therefore when Maxima has not enough information to get the result, a noun form based on the gamma density is returned. (%i1) load (distrib)$ (%i2) pdf_chi2(x,n); n (%o2) pdf_gamma(x, -, 2) 2 (%i3) assume(x>0, n>0)$ pdf_chi2(x,n); n/2 - 1 - x/2 x %e (%o4) ---------------- n/2 n 2 gamma(-) 2 -- Function: cdf_chi2 (,) Returns the value at of the distribution function of a Chi-square random variable Chi^2(n), with n>0. This function has no closed form and it is numerically computed if the global variable `numer' equals `true', otherwise it returns a nominal expression based on the gamma distribution, since the Chi^2(n) random variable is equivalent to the Gamma(n/2,2). (%i1) load (distrib)$ (%i2) cdf_chi2(3,4); (%o2) cdf_gamma(3, 2, 2) (%i3) cdf_chi2(3,4),numer; (%o3) .4421745996289249 -- Function: quantile_chi2 (,) Returns the -quantile of a Chi-square random variable Chi^2(n), with n>0; in other words, this is the inverse of `cdf_chi2'. Argument must be an element of [0,1]. This function has no closed form and it is numerically computed if the global variable `numer' equals `true', otherwise it returns a nominal expression based on the gamma quantile function, since the Chi^2(n) random variable is equivalent to the Gamma(n/2,2). (%i1) load (distrib)$ (%i2) quantile_chi2(0.99,9); (%o2) 21.66599433346194 (%i3) quantile_chi2(0.99,n); n (%o3) quantile_gamma(0.99, -, 2) 2 -- Function: mean_chi2 () Returns the mean of a Chi-square random variable Chi^2(n), with n>0. The Chi^2(n) random variable is equivalent to the Gamma(n/2,2), therefore when Maxima has not enough information to get the result, a noun form based on the gamma mean is returned. (%i1) load (distrib)$ (%i2) mean_chi2(n); n (%o2) mean_gamma(-, 2) 2 (%i3) assume(n>0)$ mean_chi2(n); (%o4) n -- Function: var_chi2 () Returns the variance of a Chi-square random variable Chi^2(n), with n>0. The Chi^2(n) random variable is equivalent to the Gamma(n/2,2), therefore when Maxima has not enough information to get the result, a noun form based on the gamma variance is returned. (%i1) load (distrib)$ (%i2) var_chi2(n); n (%o2) var_gamma(-, 2) 2 (%i3) assume(n>0)$ var_chi2(n); (%o4) 2 n -- Function: std_chi2 () Returns the standard deviation of a Chi-square random variable Chi^2(n), with n>0. The Chi^2(n) random variable is equivalent to the Gamma(n/2,2), therefore when Maxima has not enough information to get the result, a noun form based on the gamma standard deviation is returned. (%i1) load (distrib)$ (%i2) std_chi2(n); n (%o2) std_gamma(-, 2) 2 (%i3) assume(n>0)$ std_chi2(n); (%o4) sqrt(2) sqrt(n) -- Function: skewness_chi2 () Returns the skewness coefficient of a Chi-square random variable Chi^2(n), with n>0. The Chi^2(n) random variable is equivalent to the Gamma(n/2,2), therefore when Maxima has not enough information to get the result, a noun form based on the gamma skewness coefficient is returned. (%i1) load (distrib)$ (%i2) skewness_chi2(n); n (%o2) skewness_gamma(-, 2) 2 (%i3) assume(n>0)$ skewness_chi2(n); 2 sqrt(2) (%o4) --------- sqrt(n) -- Function: kurtosis_chi2 () Returns the kurtosis coefficient of a Chi-square random variable Chi^2(n), with n>0. The Chi^2(n) random variable is equivalent to the Gamma(n/2,2), therefore when Maxima has not enough information to get the result, a noun form based on the gamma kurtosis coefficient is returned. (%i1) load (distrib)$ (%i2) kurtosis_chi2(n); n (%o2) kurtosis_gamma(-, 2) 2 (%i3) assume(n>0)$ kurtosis_chi2(n); 12 (%o4) -- n -- Option variable: random_chi2_algorithm Default value: `ahrens_cheng' This is the selected algorithm for simulating random Chi-square variates. Implemented algorithms are `ahrens_cheng' and `inverse': * `ahrens_cheng', based on the random simulation of gamma variates. See `random_gamma_algorithm' for details. * `inverse', based on the general inverse method. See also `random_chi2'. -- Function: random_chi2 () -- Function: random_chi2 (,) Returns a Chi-square random variate Chi^2(n), with n>0. Calling `random_chi2' with a second argument , a random sample of size will be simulated. There are two algorithms implemented for this function, the one to be used can be selected giving a certain value to the global variable `random_chi2_algorithm', which defaults to `ahrens_cheng'. See also `random_chi2_algorithm'. To make use of this function, write first `load(distrib)'. -- Function: pdf_f (,,) Returns the value at of the density function of a F random variable F(m,n), with m,n>0. To make use of this function, write first `load(distrib)'. -- Function: cdf_f (,,) Returns the value at of the distribution function of a F random variable F(m,n), with m,n>0. This function has no closed form and it is numerically computed if the global variable `numer' equals `true', otherwise it returns a nominal expression. (%i1) load (distrib)$ (%i2) cdf_f(2,3,9/4); 9 (%o2) cdf_f(2, 3, -) 4 (%i3) %,numer; (%o3) 0.66756728179008 -- Function: quantile_f (,,) Returns the -quantile of a F random variable F(m,n), with m,n>0; in other words, this is the inverse of `cdf_f'. Argument must be an element of [0,1]. This function has no closed form and it is numerically computed if the global variable `numer' equals `true', otherwise it returns a nominal expression. (%i1) load (distrib)$ (%i2) quantile_f(2/5,sqrt(3),5); 2 (%o2) quantile_f(-, sqrt(3), 5) 5 (%i3) %,numer; (%o3) 0.518947838573693 -- Function: mean_f (,) Returns the mean of a F random variable F(m,n), with m>0, n>2. To make use of this function, write first `load(distrib)'. -- Function: var_f (,) Returns the variance of a F random variable F(m,n), with m>0, n>4. To make use of this function, write first `load(distrib)'. -- Function: std_f (,) Returns the standard deviation of a F random variable F(m,n), with m>0, n>4. To make use of this function, write first `load(distrib)'. -- Function: skewness_f (,) Returns the skewness coefficient of a F random variable F(m,n), with m>0, n>6. To make use of this function, write first `load(distrib)'. -- Function: kurtosis_f (,) Returns the kurtosis coefficient of a F random variable F(m,n), with m>0, n>8. To make use of this function, write first `load(distrib)'. -- Option variable: random_f_algorithm Default value: `inverse' This is the selected algorithm for simulating random F variates. Implemented algorithms are `ratio' and `inverse': * `ratio', based on the fact that if is a Chi^2(m) random variable and Y is a Chi^2(n) random variable, then n X F = --- m Y is a F random variable with and degrees of freedom, F(m,n). * `inverse', based on the general inverse method. See also `random_f'. -- Function: random_f (,) -- Function: random_f (,,) Returns a F random variate F(m,n), with m,n>0. Calling `random_f' with a third argument , a random sample of size will be simulated. There are two algorithms implemented for this function, the one to be used can be selected giving a certain value to the global variable `random_f_algorithm', which defaults to `inverse'. See also `random_f_algorithm'. To make use of this function, write first `load(distrib)'. -- Function: pdf_exp (,) Returns the value at of the density function of an Exponential(m) random variable, with m>0. The Exponential(m) random variable is equivalent to the Weibull(1,1/m), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull density is returned. (%i1) load (distrib)$ (%i2) pdf_exp(x,m); 1 (%o2) pdf_weibull(x, 1, -) m (%i3) assume(x>0,m>0)$ pdf_exp(x,m); - m x (%o4) m %e -- Function: cdf_exp (,) Returns the value at of the distribution function of an Exponential(m) random variable, with m>0. The Exponential(m) random variable is equivalent to the Weibull(1,1/m), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull distribution is returned. (%i1) load (distrib)$ (%i2) cdf_exp(x,m); 1 (%o2) cdf_weibull(x, 1, -) m (%i3) assume(x>0,m>0)$ cdf_exp(x,m); - m x (%o4) 1 - %e -- Function: quantile_exp (,) Returns the -quantile of an Exponential(m) random variable, with m>0; in other words, this is the inverse of `cdf_exp'. Argument must be an element of [0,1]. The Exponential(m) random variable is equivalent to the Weibull(1,1/m), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull quantile is returned. (%i1) load (distrib)$ (%i2) quantile_exp(0.56,5); (%o2) .1641961104139661 (%i3) quantile_exp(0.56,m); 1 (%o3) quantile_weibull(0.56, 1, -) m -- Function: mean_exp () Returns the mean of an Exponential(m) random variable, with m>0. The Exponential(m) random variable is equivalent to the Weibull(1,1/m), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull mean is returned. (%i1) load (distrib)$ (%i2) mean_exp(m); 1 (%o2) mean_weibull(1, -) m (%i3) assume(m>0)$ mean_exp(m); 1 (%o4) - m -- Function: var_exp () Returns the variance of an Exponential(m) random variable, with m>0. The Exponential(m) random variable is equivalent to the Weibull(1,1/m), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull variance is returned. (%i1) load (distrib)$ (%i2) var_exp(m); 1 (%o2) var_weibull(1, -) m (%i3) assume(m>0)$ var_exp(m); 1 (%o4) -- 2 m -- Function: std_exp () Returns the standard deviation of an Exponential(m) random variable, with m>0. The Exponential(m) random variable is equivalent to the Weibull(1,1/m), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull standard deviation is returned. (%i1) load (distrib)$ (%i2) std_exp(m); 1 (%o2) std_weibull(1, -) m (%i3) assume(m>0)$ std_exp(m); 1 (%o4) - m -- Function: skewness_exp () Returns the skewness coefficient of an Exponential(m) random variable, with m>0. The Exponential(m) random variable is equivalent to the Weibull(1,1/m), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull skewness coefficient is returned. (%i1) load (distrib)$ (%i2) skewness_exp(m); 1 (%o2) skewness_weibull(1, -) m (%i3) assume(m>0)$ skewness_exp(m); (%o4) 2 -- Function: kurtosis_exp () Returns the kurtosis coefficient of an Exponential(m) random variable, with m>0. The Exponential(m) random variable is equivalent to the Weibull(1,1/m), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull kurtosis coefficient is returned. (%i1) load (distrib)$ (%i2) kurtosis_exp(m); 1 (%o2) kurtosis_weibull(1, -) m (%i3) assume(m>0)$ kurtosis_exp(m); (%o4) 6 -- Option variable: random_exp_algorithm Default value: `inverse' This is the selected algorithm for simulating random exponential variates. Implemented algorithms are `inverse', `ahrens_cheng' and `ahrens_dieter' * `inverse', based on the general inverse method. * `ahrens_cheng', based on the fact that the Exp(m) random variable is equivalent to the Gamma(1,1/m). See `random_gamma_algorithm' for details. * `ahrens_dieter', based on algorithm described in Ahrens, J.H. and Dieter, U. (1972) Comm, ACM, 15, Oct., 873-882. See also `random_exp'. -- Function: random_exp () -- Function: random_exp (,) Returns an Exponential(m) random variate, with m>0. Calling `random_exp' with a second argument , a random sample of size will be simulated. There are three algorithms implemented for this function, the one to be used can be selected giving a certain value to the global variable `random_exp_algorithm', which defaults to `inverse'. See also `random_exp_algorithm'. To make use of this function, write first `load(distrib)'. -- Function: pdf_lognormal (,,) Returns the value at of the density function of a Lognormal(m,s) random variable, with s>0. To make use of this function, write first `load(distrib)'. -- Function: cdf_lognormal (,,) Returns the value at of the distribution function of a Lognormal(m,s) random variable, with s>0. This function is defined in terms of Maxima's built-in error function `erf'. (%i1) load (distrib)$ (%i2) assume(x>0, s>0)$ cdf_lognormal(x,m,s); log(x) - m erf(----------) sqrt(2) s 1 (%o3) --------------- + - 2 2 See also `erf'. -- Function: quantile_lognormal (,,) Returns the -quantile of a Lognormal(m,s) random variable, with s>0; in other words, this is the inverse of `cdf_lognormal'. Argument must be an element of [0,1]. To make use of this function, write first `load(distrib)'. -- Function: mean_lognormal (,) Returns the mean of a Lognormal(m,s) random variable, with s>0. To make use of this function, write first `load(distrib)'. -- Function: var_lognormal (,) Returns the variance of a Lognormal(m,s) random variable, with s>0. To make use of this function, write first `load(distrib)'. -- Function: std_lognormal (,) Returns the standard deviation of a Lognormal(m,s) random variable, with s>0. To make use of this function, write first `load(distrib)'. -- Function: skewness_lognormal (,) Returns the skewness coefficient of a Lognormal(m,s) random variable, with s>0. To make use of this function, write first `load(distrib)'. -- Function: kurtosis_lognormal (,) Returns the kurtosis coefficient of a Lognormal(m,s) random variable, with s>0. To make use of this function, write first `load(distrib)'. -- Function: random_lognormal (,) -- Function: random_lognormal (,,) Returns a Lognormal(m,s) random variate, with s>0. Calling `random_lognormal' with a third argument , a random sample of size will be simulated. Log-normal variates are simulated by means of random normal variates. There are two algorithms implemented for this function, the one to be used can be selected giving a certain value to the global variable `random_normal_algorithm', which defaults to `box_mueller'. See also `random_normal_algorithm'. To make use of this function, write first `load(distrib)'. -- Function: pdf_gamma (,,) Returns the value at of the density function of a Gamma(a,b) random variable, with a,b>0. To make use of this function, write first `load(distrib)'. -- Function: cdf_gamma (,,) Returns the value at of the distribution function of a Gamma(a,b) random variable, with a,b>0. This function has no closed form and it is numerically computed if the global variable `numer' equals `true', otherwise it returns a nominal expression. (%i1) load (distrib)$ (%i2) cdf_gamma(3,5,21); (%o2) cdf_gamma(3, 5, 21) (%i3) %,numer; (%o3) 4.402663157135039E-7 -- Function: quantile_gamma (,,) Returns the -quantile of a Gamma(a,b) random variable, with a,b>0; in other words, this is the inverse of `cdf_gamma'. Argument must be an element of [0,1]. To make use of this function, write first `load(distrib)'. -- Function: mean_gamma (,) Returns the mean of a Gamma(a,b) random variable, with a,b>0. To make use of this function, write first `load(distrib)'. -- Function: var_gamma (,) Returns the variance of a Gamma(a,b) random variable, with a,b>0. To make use of this function, write first `load(distrib)'. -- Function: std_gamma (,) Returns the standard deviation of a Gamma(a,b) random variable, with a,b>0. To make use of this function, write first `load(distrib)'. -- Function: skewness_gamma (,) Returns the skewness coefficient of a Gamma(a,b) random variable, with a,b>0. To make use of this function, write first `load(distrib)'. -- Function: kurtosis_gamma (,) Returns the kurtosis coefficient of a Gamma(a,b) random variable, with a,b>0. To make use of this function, write first `load(distrib)'. -- Option variable: random_gamma_algorithm Default value: `ahrens_cheng' This is the selected algorithm for simulating random gamma variates. Implemented algorithms are `ahrens_cheng' and `inverse' * `ahrens_cheng', this is a combinantion of two procedures, depending on the value of parameter : For a>=1, Cheng, R.C.H. and Feast, G.M. (1979). . Appl. Stat., 28, 3, 290-295. For 0. Computing, 12, 223-246. * `inverse', based on the general inverse method. See also `random_gamma'. -- Function: random_gamma (,) -- Function: random_gamma (,,) Returns a Gamma(a,b) random variate, with a,b>0. Calling `random_gamma' with a third argument , a random sample of size will be simulated. There are two algorithms implemented for this function, the one to be used can be selected giving a certain value to the global variable `random_gamma_algorithm', which defaults to `ahrens_cheng'. See also `random_gamma_algorithm'. To make use of this function, write first `load(distrib)'. -- Function: pdf_beta (,,) Returns the value at of the density function of a Beta(a,b) random variable, with a,b>0. To make use of this function, write first `load(distrib)'. -- Function: cdf_beta (,,) Returns the value at of the distribution function of a Beta(a,b) random variable, with a,b>0. This function has no closed form and it is numerically computed if the global variable `numer' equals `true', otherwise it returns a nominal expression. (%i1) load (distrib)$ (%i2) cdf_beta(1/3,15,2); 1 (%o2) cdf_beta(-, 15, 2) 3 (%i3) %,numer; (%o3) 7.666089131388224E-7 -- Function: quantile_beta (,,) Returns the -quantile of a Beta(a,b) random variable, with a,b>0; in other words, this is the inverse of `cdf_beta'. Argument must be an element of [0,1]. To make use of this function, write first `load(distrib)'. -- Function: mean_beta (,) Returns the mean of a Beta(a,b) random variable, with a,b>0. To make use of this function, write first `load(distrib)'. -- Function: var_beta (,) Returns the variance of a Beta(a,b) random variable, with a,b>0. To make use of this function, write first `load(distrib)'. -- Function: std_beta (,) Returns the standard deviation of a Beta(a,b) random variable, with a,b>0. To make use of this function, write first `load(distrib)'. -- Function: skewness_beta (,) Returns the skewness coefficient of a Beta(a,b) random variable, with a,b>0. To make use of this function, write first `load(distrib)'. -- Function: kurtosis_beta (,) Returns the kurtosis coefficient of a Beta(a,b) random variable, with a,b>0. To make use of this function, write first `load(distrib)'. -- Option variable: random_beta_algorithm Default value: `cheng' This is the selected algorithm for simulating random beta variates. Implemented algorithms are `cheng', `inverse' and `ratio' * `cheng', this is the algorithm defined in Cheng, R.C.H. (1978). . Communications of the ACM, 21:317-322 * `inverse', based on the general inverse method. * `ratio', based on the fact that if is a random variable Gamma(a,1) and is Gamma(b,1), then the ratio X/(X+Y) is distributed as Beta(a,b). See also `random_beta'. -- Function: random_beta (,) -- Function: random_beta (,,) Returns a Beta(a,b) random variate, with a,b>0. Calling `random_beta' with a third argument , a random sample of size will be simulated. There are three algorithms implemented for this function, the one to be used can be selected giving a certain value to the global variable `random_beta_algorithm', which defaults to `cheng'. See also `random_beta_algorithm'. To make use of this function, write first `load(distrib)'. -- Function: pdf_continuous_uniform (,,) Returns the value at of the density function of a Continuous Uniform(a,b) random variable, with a,,) Returns the value at of the distribution function of a Continuous Uniform(a,b) random variable, with a,,) Returns the -quantile of a Continuous Uniform(a,b) random variable, with a must be an element of [0,1]. To make use of this function, write first `load(distrib)'. -- Function: mean_continuous_uniform (,) Returns the mean of a Continuous Uniform(a,b) random variable, with a,) Returns the variance of a Continuous Uniform(a,b) random variable, with a,) Returns the standard deviation of a Continuous Uniform(a,b) random variable, with a,) Returns the skewness coefficient of a Continuous Uniform(a,b) random variable, with a,) Returns the kurtosis coefficient of a Continuous Uniform(a,b) random variable, with a,) -- Function: random_continuous_uniform (,,) Returns a Continuous Uniform(a,b) random variate, with a, a random sample of size will be simulated. This is a direct application of the `random' built-in Maxima function. See also `random'. To make use of this function, write first `load(distrib)'. -- Function: pdf_logistic (,,) Returns the value at of the density function of a Logistic(a,b) random variable , with b>0. To make use of this function, write first `load(distrib)'. -- Function: cdf_logistic (,,) Returns the value at of the distribution function of a Logistic(a,b) random variable , with b>0. To make use of this function, write first `load(distrib)'. -- Function: quantile_logistic (,,) Returns the -quantile of a Logistic(a,b) random variable , with b>0; in other words, this is the inverse of `cdf_logistic'. Argument must be an element of [0,1]. To make use of this function, write first `load(distrib)'. -- Function: meanlog (,) Returns the mean of a Logistic(a,b) random variable , with b>0. To make use of this function, write first `load(distrib)'. -- Function: var_logistic (,) Returns the variance of a Logistic(a,b) random variable , with b>0. To make use of this function, write first `load(distrib)'. -- Function: std_logistic (,) Returns the standard deviation of a Logistic(a,b) random variable , with b>0. To make use of this function, write first `load(distrib)'. -- Function: skewness_logistic (,) Returns the skewness coefficient of a Logistic(a,b) random variable , with b>0. To make use of this function, write first `load(distrib)'. -- Function: kurtosis_logistic (,) Returns the kurtosis coefficient of a Logistic(a,b) random variable , with b>0. To make use of this function, write first `load(distrib)'. -- Function: random_logistic (,) -- Function: random_logistic (,,) Returns a Logistic(a,b) random variate, with b>0. Calling `random_logistic' with a third argument , a random sample of size will be simulated. Only the inverse method is implemented. To make use of this function, write first `load(distrib)'. -- Function: pdf_pareto (,,) Returns the value at of the density function of a Pareto(a,b) random variable, with a,b>0. To make use of this function, write first `load(distrib)'. -- Function: cdf_pareto (,,) Returns the value at of the distribution function of a Pareto(a,b) random variable, with a,b>0. To make use of this function, write first `load(distrib)'. -- Function: quantile_pareto (,,) Returns the -quantile of a Pareto(a,b) random variable, with a,b>0; in other words, this is the inverse of `cdf_pareto'. Argument must be an element of [0,1]. To make use of this function, write first `load(distrib)'. -- Function: mean_pareto (,) Returns the mean of a Pareto(a,b) random variable, with a>1,b>0. To make use of this function, write first `load(distrib)'. -- Function: var_pareto (,) Returns the variance of a Pareto(a,b) random variable, with a>2,b>0. To make use of this function, write first `load(distrib)'. -- Function: std_pareto (,) Returns the standard deviation of a Pareto(a,b) random variable, with a>2,b>0. To make use of this function, write first `load(distrib)'. -- Function: skewness_pareto (,) Returns the skewness coefficient of a Pareto(a,b) random variable, with a>3,b>0. To make use of this function, write first `load(distrib)'. -- Function: kurtosis_pareto (,) Returns the kurtosis coefficient of a Pareto(a,b) random variable, with a>4,b>0. To make use of this function, write first `load(distrib)'. -- Function: random_pareto (,) -- Function: random_pareto (,,) Returns a Pareto(a,b) random variate, with a>0,b>0. Calling `random_pareto' with a third argument , a random sample of size will be simulated. Only the inverse method is implemented. To make use of this function, write first `load(distrib)'. -- Function: pdf_weibull (,,) Returns the value at of the density function of a Weibull(a,b) random variable, with a,b>0. To make use of this function, write first `load(distrib)'. -- Function: cdf_weibull (,,) Returns the value at of the distribution function of a Weibull(a,b) random variable, with a,b>0. To make use of this function, write first `load(distrib)'. -- Function: quantile_weibull (,,) Returns the -quantile of a Weibull(a,b) random variable, with a,b>0; in other words, this is the inverse of `cdf_weibull'. Argument must be an element of [0,1]. To make use of this function, write first `load(distrib)'. -- Function: mean_weibull (,) Returns the mean of a Weibull(a,b) random variable, with a,b>0. To make use of this function, write first `load(distrib)'. -- Function: var_weibull (,) Returns the variance of a Weibull(a,b) random variable, with a,b>0. To make use of this function, write first `load(distrib)'. -- Function: std_weibull (,) Returns the standard deviation of a Weibull(a,b) random variable, with a,b>0. To make use of this function, write first `load(distrib)'. -- Function: skewness_weibull (,) Returns the skewness coefficient of a Weibull(a,b) random variable, with a,b>0. To make use of this function, write first `load(distrib)'. -- Function: kurtosis_weibull (,) Returns the kurtosis coefficient of a Weibull(a,b) random variable, with a,b>0. To make use of this function, write first `load(distrib)'. -- Function: random_weibull (,) -- Function: random_weibull (,,) Returns a Weibull(a,b) random variate, with a,b>0. Calling `random_weibull' with a third argument , a random sample of size will be simulated. Only the inverse method is implemented. To make use of this function, write first `load(distrib)'. -- Function: pdf_rayleigh (,) Returns the value at of the density function of a Rayleigh(b) random variable, with b>0. The Rayleigh(b) random variable is equivalent to the Weibull(2,1/b), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull density is returned. (%i1) load (distrib)$ (%i2) pdf_rayleigh(x,b); 1 (%o2) pdf_weibull(x, 2, -) b (%i3) assume(x>0,b>0)$ pdf_rayleigh(x,b); 2 2 2 - b x (%o4) 2 b x %e -- Function: cdf_rayleigh (,) Returns the value at of the distribution function of a Rayleigh(b) random variable, with b>0. The Rayleigh(b) random variable is equivalent to the Weibull(2,1/b), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull distribution is returned. (%i1) load (distrib)$ (%i2) cdf_rayleigh(x,b); 1 (%o2) cdf_weibull(x, 2, -) b (%i3) assume(x>0,b>0)$ cdf_rayleigh(x,b); 2 2 - b x (%o4) 1 - %e -- Function: quantile_rayleigh (,) Returns the -quantile of a Rayleigh(b) random variable, with b>0; in other words, this is the inverse of `cdf_rayleigh'. Argument must be an element of [0,1]. The Rayleigh(b) random variable is equivalent to the Weibull(2,1/b), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull quantile is returned. (%i1) load (distrib)$ (%i2) quantile_rayleigh(0.99,b); 1 (%o2) quantile_weibull(0.99, 2, -) b (%i3) assume(x>0,b>0)$ quantile_rayleigh(0.99,b); 2.145966026289347 (%o4) ----------------- b -- Function: mean_rayleigh () Returns the mean of a Rayleigh(b) random variable, with b>0. The Rayleigh(b) random variable is equivalent to the Weibull(2,1/b), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull mean is returned. (%i1) load (distrib)$ (%i2) mean_rayleigh(b); 1 (%o2) mean_weibull(2, -) b (%i3) assume(b>0)$ mean_rayleigh(b); sqrt(%pi) (%o4) --------- 2 b -- Function: var_rayleigh () Returns the variance of a Rayleigh(b) random variable, with b>0. The Rayleigh(b) random variable is equivalent to the Weibull(2,1/b), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull variance is returned. (%i1) load (distrib)$ (%i2) var_rayleigh(b); 1 (%o2) var_weibull(2, -) b (%i3) assume(b>0)$ var_rayleigh(b); %pi 1 - --- 4 (%o4) ------- 2 b -- Function: std_rayleigh () Returns the standard deviation of a Rayleigh(b) random variable, with b>0. The Rayleigh(b) random variable is equivalent to the Weibull(2,1/b), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull standard deviation is returned. (%i1) load (distrib)$ (%i2) std_rayleigh(b); 1 (%o2) std_weibull(2, -) b (%i3) assume(b>0)$ std_rayleigh(b); %pi sqrt(1 - ---) 4 (%o4) ------------- b -- Function: skewness_rayleigh () Returns the skewness coefficient of a Rayleigh(b) random variable, with b>0. The Rayleigh(b) random variable is equivalent to the Weibull(2,1/b), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull skewness coefficient is returned. (%i1) load (distrib)$ (%i2) skewness_rayleigh(b); 1 (%o2) skewness_weibull(2, -) b (%i3) assume(b>0)$ skewness_rayleigh(b); 3/2 %pi 3 sqrt(%pi) ------ - ----------- 4 4 (%o4) -------------------- %pi 3/2 (1 - ---) 4 -- Function: kurtosis_rayleigh () Returns the kurtosis coefficient of a Rayleigh(b) random variable, with b>0. The Rayleigh(b) random variable is equivalent to the Weibull(2,1/b), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull kurtosis coefficient is returned. (%i1) load (distrib)$ (%i2) kurtosis_rayleigh(b); 1 (%o2) kurtosis_weibull(2, -) b (%i3) assume(b>0)$ kurtosis_rayleigh(b); 2 3 %pi 2 - ------ 16 (%o4) ---------- - 3 %pi 2 (1 - ---) 4 -- Function: random_rayleigh () -- Function: random_rayleigh (,) Returns a Rayleigh(b) random variate, with b>0. Calling `random_rayleigh' with a second argument , a random sample of size will be simulated. Only the inverse method is implemented. To make use of this function, write first `load(distrib)'. -- Function: pdf_laplace (,,) Returns the value at of the density function of a Laplace(a,b) random variable, with b>0. To make use of this function, write first `load(distrib)'. -- Function: cdf_laplace (,,) Returns the value at of the distribution function of a Laplace(a,b) random variable, with b>0. To make use of this function, write first `load(distrib)'. -- Function: quantile_laplace (,,) Returns the -quantile of a Laplace(a,b) random variable, with b>0; in other words, this is the inverse of `cdf_laplace'. Argument must be an element of [0,1]. To make use of this function, write first `load(distrib)'. -- Function: mean_laplace (,) Returns the mean of a Laplace(a,b) random variable, with b>0. To make use of this function, write first `load(distrib)'. -- Function: var_laplace (,) Returns the variance of a Laplace(a,b) random variable, with b>0. To make use of this function, write first `load(distrib)'. -- Function: std_laplace (,) Returns the standard deviation of a Laplace(a,b) random variable, with b>0. To make use of this function, write first `load(distrib)'. -- Function: skewness_laplace (,) Returns the skewness coefficient of a Laplace(a,b) random variable, with b>0. To make use of this function, write first `load(distrib)'. -- Function: kurtosis_laplace (,) Returns the kurtosis coefficient of a Laplace(a,b) random variable, with b>0. To make use of this function, write first `load(distrib)'. -- Function: random_laplace (,) -- Function: random_laplace (,,) Returns a Laplace(a,b) random variate, with b>0. Calling `random_laplace' with a third argument , a random sample of size will be simulated. Only the inverse method is implemented. To make use of this function, write first `load(distrib)'. -- Function: pdf_cauchy (,,) Returns the value at of the density function of a Cauchy(a,b) random variable, with b>0. To make use of this function, write first `load(distrib)'. -- Function: cdf_cauchy (,,) Returns the value at of the distribution function of a Cauchy(a,b) random variable, with b>0. To make use of this function, write first `load(distrib)'. -- Function: quantile_cauchy (,,) Returns the -quantile of a Cauchy(a,b) random variable, with b>0; in other words, this is the inverse of `cdf_cauchy'. Argument must be an element of [0,1]. To make use of this function, write first `load(distrib)'. -- Function: random_cauchy (,) -- Function: random_cauchy (,,) Returns a Cauchy(a,b) random variate, with b>0. Calling `random_cauchy' with a third argument , a random sample of size will be simulated. Only the inverse method is implemented. To make use of this function, write first `load(distrib)'. -- Function: pdf_gumbel (,,) Returns the value at of the density function of a Gumbel(a,b) random variable, with b>0. To make use of this function, write first `load(distrib)'. -- Function: cdf_gumbel (,,) Returns the value at of the distribution function of a Gumbel(a,b) random variable, with b>0. To make use of this function, write first `load(distrib)'. -- Function: quantile_gumbel (,,) Returns the -quantile of a Gumbel(a,b) random variable, with b>0; in other words, this is the inverse of `cdf_gumbel'. Argument must be an element of [0,1]. To make use of this function, write first `load(distrib)'. -- Function: mean_gumbel (,) Returns the mean of a Gumbel(a,b) random variable, with b>0. (%i1) load (distrib)$ (%i2) assume(b>0)$ mean_gumbel(a,b); (%o3) %gamma b + a where symbol `%gamma' stands for the Euler-Mascheroni constant. See also `%gamma'. -- Function: var_gumbel (,) Returns the variance of a Gumbel(a,b) random variable, with b>0. To make use of this function, write first `load(distrib)'. -- Function: std_gumbel (,) Returns the standard deviation of a Gumbel(a,b) random variable, with b>0. To make use of this function, write first `load(distrib)'. -- Function: skewness_gumbel (,) Returns the skewness coefficient of a Gumbel(a,b) random variable, with b>0. (%i1) load (distrib)$ (%i2) assume(b>0)$ skewness_gumbel(a,b); 12 sqrt(6) zeta(3) (%o3) ------------------ 3 %pi (%i4) numer:true$ skewness_gumbel(a,b); (%o5) 1.139547099404649 where `zeta' stands for the Riemann's zeta function. -- Function: kurtosis_gumbel (,) Returns the kurtosis coefficient of a Gumbel(a,b) random variable, with b>0. To make use of this function, write first `load(distrib)'. -- Function: random_gumbel (,) -- Function: random_gumbel (,,) Returns a Gumbel(a,b) random variate, with b>0. Calling `random_gumbel' with a third argument , a random sample of size will be simulated. Only the inverse method is implemented. To make use of this function, write first `load(distrib)'.  File: maxima.info, Node: Functions and Variables for discrete distributions, Prev: Functions and Variables for continuous distributions, Up: distrib 47.3 Functions and Variables for discrete distributions ======================================================= -- Function: pdf_binomial (,,