HANDS-ON COMPUTER-AIDED PROGRAMMING FOR CHEMICAL
ENGINEERING APPLICATIONS
CHEATSHEET : 1
MATLAB Built-in Mathematical Functions
1. Basic Arithmetic Operations
• + (Addition)
• - (Subtraction)
• * (Multiplication)
• / (Right division)
• \ (Left division)
• .^ (Element-wise power)
• ^ (Matrix power)
2. Exponential and Logarithmic Functions
• exp(x) : Exponential function ex
• log(x) : Natural logarithm ln(x)
• log10(x) : Base-10 logarithm
• log2(x) : Base-2 logarithm
• expm1(x) : 𝑒 𝑥 − 1 (for numerical stability)
• log1p(x) : −𝑙𝑛(1 + 𝑥) (for small xx)
3. Power and Root Functions
• sqrt(x) : Square root (√𝑥)
• nthroot(x, n) : Real nth root of x
• power(x, y) : Equivalent to x.^y
4. Absolute and Sign Functions
• abs(x) : Absolute value ∣x∣
• sign(x) : Sign function (-1, 0, or 1)
5. Trigonometric Functions
• sin(x), cos(x), tan(x) : Sine, cosine, and tangent
• cot(x), sec(x), csc(x) : Cotangent, secant, and cosecant
• sind(x), cosd(x), tand(x) : Degree-based sine, cosine, and tangent
• asind(x), acosd(x), atand(x) : Inverse trigonometric functions in degrees
• asin(x), acos(x), atan(x) : Inverse trigonometric functions in radians
• atan2(y, x) : Four-quadrant inverse tangent
• hypot(x, y) : Hypotenuse √𝑥 2 + 𝑦2
•
6. Hyperbolic Functions
• sinh(x), cosh(x), tanh(x) : Hyperbolic sine, cosine, and tangent
• asinh(x), acosh(x), atanh(x) : Inverse hyperbolic functions
7. Rounding and Modulo Functions
• round(x) : Round to nearest integer
• floor(x) : Round down
• ceil(x) : Round up
• fix(x) : Round towards zero
• mod(x, y) : Modulo operation
• rem(x, y) : Remainder after division
8. Complex Number Functions
• real(x), imag(x) : Extract real and imaginary parts
• conj(x) : Complex conjugate
• angle(x) : Phase angle in radians
• abs(x) : Magnitude of a complex number
• complex(x, y) : Create a complex number (x+y i)
9. Vector and Matrix Operations
• sum(x), prod(x) : Summation and product
• cumprod(x), cumsum(x) : Cumulative product and sum
• diff(x) : First-order difference
• dot(x, y), cross(x, y) : Dot product and cross product
• norm(x) : Vector/matrix norm
• det(A) : Determinant of a matrix
• inv(A) : Inverse of a matrix
• pinv(A) : Pseudoinverse
• rank(A) : Rank of a matrix
• trace(A) : Sum of diagonal elements
• eig(A) : Eigenvalues and eigenvectors
• svd(A) : Singular Value Decomposition
• chol(A) : Cholesky decomposition
• lu(A) : LU decomposition
• qr(A) : QR decomposition
10. Special Functions
• factorial(n) : Factorial (n!)
• gamma(x) : Gamma function Γ(x)
• gammaln(x) : Log of gamma function
• beta(x, y) : Beta function
• erf(x), erfc(x) : Error functions
• besselj(n, x), bessely(n, x) : Bessel functions of the first and second kind
11. Logical Functions
• and, or, not, xor : Logical operators
• all(x), any(x) : Test if all or any elements are nonzero
• isnan(x), isinf(x), isfinite(x) : Check for NaN, infinity, or finite values
• logical(x) : Convert to logical type
• bitand(x, y), bitor(x, y), bitxor(x, y) : Bitwise operations