

The first returns two columns with x and y′.$ mcx -vp=2 -f3f15.10 dat -diff:nord=5 -e3 x1 x2 'x1^(p-1)*(p-lam*x1)*exp(-lam*x1)' -e3 x1 x2 x2-x3Īll of them differentiate the second column with respect to the first, using p=2. This example also uses the tabulated data to interpolate it to another mesh.Ĭopy the contents of the box below into file dat. Integrate and differentiate the function, by tabulating it on a mesh and evaluating integrals and derivatives numerically. See Instruction Summary Example 2.4 Numerical integration, differentiation, and interpolation of a function Note: this formula should still work even if h is not hermitian. s 1 and s 1 are mathematically identical so the difference should be zero.

H z −x : pushes h and z onto the stack and multiplies them. One array remains on the stack, s 0 = z × e. −v2dia : Turns s 0 (a vector or 2×1 array of eigenvalues) into a diagonal 2×2 array. −tog : toggles s 0 and s 1, making s 1 = z and s 0 = e. Now the stack has two arrays, s 0 = z and s 1 = e. H −evc : pushes h onto the stack and replaces s 0 with its eigenvectors. H −evl : pushes h onto s 0 and replaces s 0 with its eigenvalues. −a h : copies s 0 to a named array h and pops it from the stack. Mat2 : reads file mat2 and pushes it onto s 0. Mcx mat2 -herm -a h h -evl h -evc -ap z -tog -v2dia -x h z -x. You can force mat2 to be hermitian (symmetric since mat2 is real) with −herm. The imaginary part follows the real part this is how mcx displays and reads complex arrays in ASCII format. The eigenvalues are complex because the matrix is not hermitian. mcx passes the input through a file preprocessor first in addition a directive specifying some combination nr and nc, e.g. You can include a directive at the start of the file, before any data is read. −nc=# this switch is used in Example 2.2. You can specify the number of columns on the command line, with −nc=# similarly with the number of rows ( −nr=#). The ASCII format of the file is quite flexible you can specify the number of rows nr and number of columns nc in a number of ways: The old s 0 becomes s 1, the old s 1 becomes s 2, etc. The contents are parsed and if the reading is successful, pushed on the stack, becoming array s 0. mcx h attempts to read an array from file h. You read an array from disk by naming the file in a command-line argument, e.g. mcx is stack-based: each time you read an array from a file (or create a new array by some other means) it is pushed onto the stack. Usually arrays are read from disk files in ASCII format, though mcx can read binary files, and has limited ability to create arrays from command-line arguments (see for example the –array and -1 constructs). Some Questaal testing scripts make use of it to analyze whether a test passes a certain criterion. It is command-line driven and can efficiently manipulate arrays for analysis. It is mainly designed to work with 2D arrays it operates on numerical arrays. Mcx is a matrix extension of an ordinary calculator.
#Matrix calculator manual
This manual is written for version 1.062. Mcx is required and is assumed to be in your path. Data parsed in files makes use of the programming language capabilities of the preprocessor. The most recent, or top-level array is called s 0 arrays deeper in the stack are called s 1, s 2, ….Īrrays are normally read from disk files, which have the standard Questaal format, and a few other formats. The calculator manipulates array elements on the stack.

Two-dimensional matrices are read from disk files (or generated by other constructs) and pushed onto a stack.
