# Full text of "hp_manual_c00043591"

## See other formats

hp 48gll graphing calculator user's guide invent Edition 4 HP part number F2226-90020 Notice REGISTER YOUR PRODUCT AT: www.reqister.hp.com THIS MANUAL AND ANY EXAMPLES CONTAINED HEREIN ARE PROVIDED 'AS IS" AND ARE SUBJECT TO CHANGE WITHOUT NOTICE. HEWLETT-PACKARD COMPANY MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS MANUAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. HEWLETT-PACKARD CO. SHALL NOT BE LIABLE FOR ANY ERRORS OR FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES IN CONNECTION WITH THE FURNISHING, PERFORMANCE, OR USE OF THIS MANUAL OR THE EXAMPLES CONTAINED HEREIN. © Copyright 2003 Hewlett-Packard Development Company, L.P. Reproduction, adaptation, or translation of this manual is prohibited without prior written permission of Hewlett-Packard Company, except as allowed under the copyright laws. Hewlett-Packard Company 4995 Murphy Canyon Rd, Suite 301 San Diego,CA 92123 Printing History Edition 4 April 2004 Preface You have in your hands a compact symbolic and numerical computer that will facilitate calculation and mathematical analysis of problems in a variety of disciplines, from elementary mathematics to advanced engineering and science subjects. Although referred to as a calculator, because of its compact format resembling typical hand-held calculating devices, the hp 48gll should be thought of as a graphics/programmable hand-held computer. The hp 48gll can be operated in two different calculating modes, the Reverse Polish Notation (RPN) mode and the Algebraic (ALG) mode (see page 1-11 in user's guide for additional details). The RPN mode was incorporated into calculators to make calculations more efficient. In this mode, the operands in an operation (e.g., '2 and '3' in the operation '2+3') are entered into the calculator screen, referred to as the stack, and then the operator (e.g., '+' in the operation '2+3') is entered to complete the operation. The ALG mode, on the other hand, mimics the way you type arithmetic expressions in paper. Thus, the operation '2+3' , in ALG mode, will be entered in the calculator by pressing the keys '2' , '+' , and '3' , in that order. To complete the operation we use the ENTER key. Examples of applications of the different functions and operations in this calculator are illustrated in this user's guide in both modes. This guide contains examples that illustrate the use of the basic calculator functions and operations. The chapters in this user's guide are organized by subject in order of difficulty. Starting with the setting of calculator modes and display options, and continuing with real and complex number calculations, operations with lists, vectors, and matrices, detailed examples of graph applications, use of strings, basic programming, graphics programming, string manipulation, advanced calculus and multivariate calculus applications, advanced differential equations applications (including Laplace transform, and Fourier series and transforms), and probability and statistic applications. For symbolic operations the calculator includes a powerful Computer Algebraic System (CAS) that lets you select different modes of operation, e.g., complex numbers vs. real numbers, or exact (symbolic) vs. approximate (numerical) mode. The display can be adjusted to provide textbook-type expressions, which can be useful when working with matrices, vectors, fractions, summations, derivatives, and integrals. The high-speed graphics of the calculator are very convenient for producing complex figures in very little time. Thanks to the infrared port and the RS 232 cable available with your calculator, you can connect your calculator with other calculators or computers. The high-speed connection through infrared or RS 232 allows the fast and efficient exchange of programs and data with other calculators or computers. The calculator provides a flash memory card port to facilitate storage and exchange of data with other users. The programming capabilities of the calculator allow you or other users to develop efficient applications for specific purposes. Whether it is advanced mathematical applications, specific problem solution, or data logging, the programming languages available in your calculator make it into a very versatile computing device. We hope your calculator will become a faithful companion for your school and professional applications. Table of contents A note about screenshots in this guide, Note 1 Chapter 1 - Getting started, 1-1 Basic Operations, 1-1 Batteries, 1-1 Turning the calculator on and off, 1-2 Adjusting the display contrast, 1-2 Contents of the calculator's display, 1-2 Menus, 1-3 SOFT menus vs. CHOOSE boxes, 1-3 Selecting SOFT menus or CHOOSE boxes, 1-4 The TOOL menu, 1-6 Setting time and date, 1-7 Introducing the calculator's keyboard, 1-10 Setting calculator's mode, 1-11 Operating mode, 1-12 Number format and decimal dot or comma, 1 -1 6 Angle measure, 1-21 Coordinate system, 1-22 Beep, Key Click, and Last Stack, 1-23 Selecting CAS settings, 1 -24 Selecting Display modes, 1 -24 Selecting the display font, 1-25 Selecting properties of the line editor, 1-26 Selecting properties of the Stack, 1-26 Selecting properties of the Equation Writer (EQW), 1-27 Selecting the size of the header, 1-28 Selecting the clock display, 1-28 Chapter 2 - Introducing the calculator, 2-1 Calculator objects, 2-1 Editing expressions in the screen, 2-3 Creating arithmetic expressions, 2-3 Editing arithmetic expressions, 2-6 Page TOC-1 Creating algebraic expressions, 2-7 Editing algebraic expressions, 2-8 Using the Equation Writer (EQW) to create expressions, 2-1 0 Creating arithmetic expressions, 2-1 1 Editing arithmetic expressions, 2-16 Creating algebraic expressions, 2-19 Editing algebraic expressions, 2-20 Creating and editing summations, derivatives, and integrals, 2-28 Organizing data in the calculator, 2-32 Functions for manipulation of variables, 2-33 The HOME directory, 2-34 The CASDIR sub-directory, 2-35 Typing directory and variable names, 2-37 Creating sub-directories, 2-38 Moving among sub-directories, 2-42 Deleting sub-directories, 2-42 Variables, 2 46 Creating variables, 2-46 Checking variable contents, 2-51 Replacing the contents of variables, 2-53 Copying variables, 2-54 Reordering variables in a directory, 2-57 Moving variables using the FILES menu, 2-58 Deleting variables, 2-59 UNDO and CMD functions, 2 61 Flags, 2 62 Example of flag setting: general solution vs. principal value, 2-63 Other flags of interest, 2-64 CHOOSE boxes vs. SOFT menus, 2-65 Selected CHOOSE boxes, 2-66 Chapter 3 - Simple calculations with real numbers, 3-1 Checking calculator settings, 3-1 Checking calculator mode, 3-2 Real number calculations, 3-2 Changing sing of a number, variable, or expression, 3-3 Page TOC-2 The inverse function, 3-3 Addition, subtraction, multiplication, division, 3-3 Using parentheses, 3-4 Absolute value function, 3-4 Squares and square roots, 3-4 Powers and roots, 3-5 Base-10 logarithms and powers of 10, 3-5 Using powers of 10 in entering data, 3-5 Natural logarithms and exponential function, 3-6 Trigonometric functions, 3-6 Inverse trigonometric functions, 3-6 Differences between functions and operators, 3-7 Real number functions in the MTH menu, 3-7 Hyperbolic functions and their inverses, 3-9 Real number functions, 3-1 1 Special functions, 3-14 Calculator constants, 3-16 Operation with units, 3-1 7 The UNITS menu, 3-17 Available units, 3-1 8 Converting to base units, 3-21 Attaching units to numbers, 3-22 Operations with units, 3-25 Units manipulation tools, 3-27 Physical constants in the calculator, 3-28 Special physical functions, 3-3 1 Function Z FACTOR, 3-32 Function F0?i, 3-32 Function SIDENS, 3-32 Function TDELTA, 3-33 Function TINC, 3-33 Defining and using functions, 3-33 Functions defined by more than one expression, 3-35 The IFTE function, 3-35 Combined IFTE functions, 3-36 Chapter 4 - Calculations with complex numbers, 4-1 Definitions, 4-1 Setting the calculator to COMPLEX mode, 4 1 Entering complex numbers, 4-2 Polar representation of a complex number, 4-3 Simple operations with complex numbers, 4-4 Changing sign of a complex number, 4-4 Entering the unit imaginary number, 4-5 The CMPLX menus, 4 5 CMPLX menu through the MTH menu, 4-5 CMPLX menu in keyboard, 4-7 Functions applied to complex numbers, 4-8 Functions from the MTH menu, 4-8 Function DROITE: equation of a straight line, 4-9 Chapter 5 - Algebraic and arithmetic operations, 5-1 Entering algebraic objects, 5-1 Simple operations with algebraic objects, 5-2 Functions in the ALG menu, 5-3 COLLECT, 5-5 EXPAND, 5-5 FACTOR, 5-5 LNCOLLECT, 5-5 LIN, 5-5 PARTFRAC, 5-5 SOLVE, 5-5 SUBST, 5-5 TEXPAND, 5-5 Other forms of substitution in algebraic expressions, 5-6 Operations with transcendental functions, 5-7 Expansion and factoring using log-exp functions, 5-8 Expansion and factoring using trigonometric functions, 5-8 Functions in the ARITHMETIC menu, 5 9 DIVIS, 5-10 Page TOC-4 FACTORS, 5-10 LGCD, 5-10 PROPFRAC, 5-10 SIMP2, 5-10 INTEGER menu, 5-10 POLYNOMIAL menu, 5-1 1 MODULO menu, 5-12 Applications of the ARITHMETIC menu, 5 1 2 Modular arithmetic, 5-1 2 Finite arithmetic in the calculator, 5-15 Polynomials, 5-1 8 Modular arithmetic with polynomials, 5-19 The CHINREM function, 5-19 The EGCD function, 5-19 The GCD function, 5-19 The HERMITE function, 5-20 The HORNER function, 5-20 The variable VX, 5-20 The LAGRANGE function, 5-21 The LCM function, 5-21 The LEGENDRE function, 5-22 The PCOEF function, 5-22 The PROOT function, 5-22 The PTAYL function, 5-22 The QUOTIENT and REMAINDER functions, 5-23 The EPSX0 function and the CAS variable EPS, 5-23 The PEVAL function, 5-23 The TCHEBYCHEFF function, 5-24 Fractions, 5-24 The SIMP2 function, 5-24 The PROPFRAC function, 5-24 The PARTFRAC function, 5-25 The FCOEF function, 5-25 The FROOTS function, 5-26 Step-by-step operations with polynomial fractions, 5-26 The CONVERT menu and algebraic operations, 5-27 UNITS convert menu, 5-27 BASE convert menu, 5-28 TRIGONOMETRIC convert menu, 5-28 MATRICES convert menu, 5-28 REWRITE convert menu, 5-28 Chapter 6 - Solution to single equations, 6 1 Symbolic solution of algebraic equations, 6-2 Function ISOL, 6-1 Function SOLVE, 6-2 Function SOLVEVX, 6-4 Function ZEROS, 6-4 Numerical solver menu, 6-5 Polynomial equations, 6-6 Financial calculations, 6-9 Solving equations with one unknown through NUM.SLV, 6-14 The SOLVE soft menu, 6 27 The ROOT sub-menu, 6-27 Function ROOT, 6-27 Variable EQ, 6-28 The SOLVR sub-menu, 6-28 The DIFFE sub-menu, 6-30 The POLY sub-menu, 6-30 The SYS sub-menu, 6-31 The TVM sub-menu, 6-31 Chapter 7 - Solving multiple equations, 7-1 Rational equation systems, 7-1 Example 1 - Projectile motion, 7-1 Example 2 - Stresses in a thick wall cylinder, 7-2 Example 3 - System of polynomial equations, 7-4 Solution to simultaneous equations with MSLV, 7-4 Example 1 - Example from the help facility, 7-5 Example 2 - Entrance from a lake into an open channel, 7-6 Using the Multiple Equation Solver (MES), 7-1 0 Application 1 - Solution of triangles, 7-10 Page TOC-6 Application 2 - Velocity and acceleration in polar coordinates, 7-1 8 Chapter 8 - Operations with Lists, 8 1 Definitions, 8-1 Creating and storing lists, 8-1 Composing and decomposing lists, 8-2 Operations with lists of numbers, 8-3 Changing sign, 8-3 Addition, subtraction, multiplication, division, 8-3 Real number functions from the keyboard, 8-5 Real number functions from the WITH menu, 8-5 Examples of functions that use two arguments, 8-6 Lists of complex numbers, 8-7 Lists of algebraic objects, 8-8 The MTH/LIST menu, 8 8 Manipulating elements of a list, 8-1 0 List size, 8-10 Extracting and inserting elements, 8-10 Element position in the list, 8-1 1 HEAD and TAIL functions, 8-1 1 The SEQ function, 8-1 1 The MAP function, 8-12 Defining functions that use lists, 8-1 3 Applications of lists, 8-14 Harmonic mean of a list, 8-1 5 Geometric mean of a list, 8-16 Weighted average, 8-17 Statistics of grouped data, 8-1 8 Chapter 9 - Vectors, 9 1 Definitions, 9-1 Entering vectors, 9-2 Typing vectors in the stack, 9-2 Storing vectors into variables, 9-3 Page TOC-7 Using the Matrix Writer (MTWR) to enter vectors, 9-3 Building a vector with -^ARRY, 9-6 Identifying, extracting, and inserting vector elements, 9-7 Simple operations with vectors, 9-9 Changing sign, 9-9 Addition, subtraction, 9-9 Multiplication and division by a scalar, 9-10 Absolute value function, 9-10 The MTH/VECTOR menu, 9 1 0 Magnitude, 9-1 1 Dot product, 9-1 1 Cross product, 9-1 1 Decomposing a vector, 9-1 2 Building a two-dimensional vector, 9-12 Building a three-dimensional vector, 9-13 Changing coordinate system, 9-1 3 Application of vector operations, 9-1 6 Resultant of forces, 9-1 6 Angle between vectors, 9-16 Moment of a force, 9-1 7 Equation of a plane in space, 9-1 8 Row vectors, column vectors, and lists, 9-1 9 Function OBJ^, 9-20 Function -^LIST, 9-20 Function DROP, 9-21 Transforming a row vector into a column vector, 9-21 Transforming a column vector into a row vector, 9-22 Transforming a list into a vector, 9-24 Transforming a vector (or matrix) into a list, 9-25 Chapter 10 - Creating and manipulating matrices, 10 1 Definitions, 10-1 Entering matrices in the stack, 1 0-2 Using the Matrix Writer, 1 0-2 Typing the matrix directly into the stack, 1 0-3 Creating matrices with calculator functions, 1 0-3 Page TOC-8 Functions GET and PUT, 10-6 Functions GETI and PUTI, 10-6 Function SIZE, 10-7 Function TRN, 10-8 Function CON, 10-8 Function IDN, 10-9 Function RDM, 10-10 Function RANM, 10-1 1 Function SUB, 10-1 1 Function REPL, 10-12 Function ->DIAG, 10-12 Function DIAG->, 10-13 Function VANDERMONDE, 10-14 Function HUBERT, 10-14 A program to build a matrix out of a number of lists, 10-15 Lists represent columns of the matrix, 1 0-1 5 Lists represent rows of the matrix, 10-17 Manipulating matrices by columns, 10-18 Function -^COL, 10-18 Function COL^, 10-19 Function COL+, 1 0-20 Function COL-, 10-20 Function CSWP, 10-21 Manipulating matrices by rows, 1 0-2 1 Function ^ROW, 10-22 Function ROW 10-23 Function ROW+, 1 0-24 Function ROW-, 10-24 Function RSWP, 10-25 Function RCI, 10-25 Function RCIJ, 10-26 Chapter 1 1 - Matrix Operations and Linear Algebra, 111 Operations with matrices, 11-1 Addition and subtraction, 1 1-2 Multiplication, 1 1 -2 Page TOC-9 Characterizing a matrix (the matrix NORM menu), 1 1 -6 Function ABS, 1 1-7 Function SNRM, 11-7 Functions RNRM and CNRM, 1 1-8 Function SRAD, 1 1-9 Function COND, 1 1-9 Function RANK, 11-10 Function DET, 11-11 Function TRACE, 11-13 Function TRAN, 11-14 Additional matrix operations (the matrix OPER menu), 11-14 Function AXL, 11-15 Function AXM, 11-15 Function LCXM, 11-15 Solution of linear systems, 11-16 Using the numerical solver for linear systems, 11-17 Least-square solution (function LSQ), 1 1-23 Solution with the inverse matrix, 1 1-26 Solution by "division" of matrices, 1 1-26 Solving multiple set of equations with the same coefficient matrix, 1 1 -27 Gaussian and Gauss-Jordan elimination, 1 1-28 Step-by-step calculator procedure for solving linear systems, 1 1-37 Solution to linear systems using calculator functions, 1 1-46 Residual errors in linear system solutions (function RSD) , 1 1-43 Eigenvalues and eigenvectors, 1 1 -44 Function PCAR, 1 1-44 Function EGVL, 11-45 Function EGV, 1 1-46 Function JORDAN, 11-47 Function MAD, 1 1-47 Matrix factorization, 1 1 -48 Function LU, 1 1-49 Orthogonal matrices and singular value decomposition, 1 1-49 Function SCHUR, 1 1-50 Function LQ, 11-51 Page TOG 10 Function QR, 11-51 Matrix Quadratic Forms, 11-51 The QUADF menu, 11-52 Linear Applications, 1 1 -54 Function IMAGE, 1 1-54 Function ISOM, 1 1-54 Function KER, 1 1-55 Function MKISOM, 11-55 Chapter 12 - Graphics, 12-1 Graphs options in the calculator, 1 2-1 Plotting an expression of the form y = f(x) , 1 2-2 Some useful PLOT operations for FUNCTION plots, 1 2-5 Saving a graph for future use, 1 2-8 Graphics of transcendental functions, 12-10 Graph of ln(X) , 1 2-8 Graph of the exponential function, 1 2-1 0 The PPAR variable, 12 11 Inverse functions and their graphs, 12-12 Summary of FUNCTION plot operation, 12-13 Plots of trigonometric and hyperbolic functions and their inverses, 12-16 Generating a table of values for a function, 12-17 The TPAR variable, 12-18 Plots in polar coordinates, 12-19 Plotting conic curves, 1 2-2 1 Parametric plots, 1 2-23 Generating a table of parametric equations, 1 2-26 Plotting the solution to simple differential equations, 1 2-26 Truth plots, 1 2 29 Plotting histograms, bar plots, and scatterplots, 1 2-30 Bar plots, 1 2-30 Scatter plots, 1 2-32 Slope fields, 1 2 34 Fast 3D plots, 1 2 35 Wireframe plots, 1 2-37 Ps-Contour plots, 12 39 Page TOC-1 1 Y-Slice plots, 12-41 Gridmap plots, 1 2-42 Pr-Surface plots, 1 2-43 The VPAR variable, 1 2-44 Interactive drawing, 1 2-44 DOT+ and DOT-, 1 2-45 MARK, 1 2-46 LINE, 12-46 TUNE, 12-46 BOX, 12-47 CIRCL, 12-47 LABEL, 12-47 DEL, 12-47 ERASE, 12-48 MENU, 12-48 SUB, 1 2-48 REPL, 1 2-48 PICT^, 1 2-48 X,Y^, 12-48 Zooming in and out in the graphics display, 1 2- ZFACT, ZIN, ZOUT, and ZLAST, 1 2-49 BOXZ, 12-50 ZDFLT, ZAUTO, 1 2-50 HZIN, HZOUT, VZIN, and VZOUT, 1 2-50 CNTR, 12-50 ZDECI, 12-50 ZINTG, 12-51 ZSQR, 12-51 ZTRIG, 12-51 The SYMBOLIC menu and graphs, 1 2-5 1 The SYMB/GRAPH menu, 12-52 Function DRAW3DMATRIX, 1 2-54 Chapter 13 - Calculus Applications, 13-1 The CALC (Calculus) menu, 13-1 Limits and derivatives, 13-1 Function lim, 1 3-2 Derivatives, 1 3-3 Function DERIV and DERVX,! 3-3 The DERIV&INTEG menu, 13-3 Calculating derivatives with d, 1 3-4 The chain rule, 1 3-6 Derivatives of equations, 1 3-6 Implicit derivatives, 1 3-7 Application of derivatives, 1 3-7 Analyzing graphics of functions,! 3-7 Function DOMAIN, 13-9 Function TABVAL, 1 3-9 Function SIGNTAB, 13-10 Function TABVAR, 13-10 Using derivatives to calculate extreme points, 1 3-1 2 Higher-order derivatives, 1 3-1 3 Anti-derivatives and integrals, ,13-14 Functions INT, INTVX, RISCH, SIGMA, and SIGMAVX,1 3-14 Definite integrals, 13-15 Step-by-step evaluation of derivatives and integrals, 13-16 Integrating an equation, 13-18 Techniques of integration, 13-18 Substitution or change of variables, 1 3-1 8 Integration by parts and differentials, 1 3-1 9 Integration by partial fractions, 1 3-20 Improper integrals, 13-21 Integration with units, 1 3-2 1 Infinite series, 1 3-23 Taylor and Maclaurin's series, 1 3-23 Taylor polynomial and remainder,! 3-23 Functions TAYLR, TAYRLO, and SERIES,! 3-24 Chapter 14 - Multi-variate Calculus Applications, 14 1 Multi-variate functions, 1 4-1 Partial derivatives, 14-1 Higher-order derivatives, 14-3 Page TOG 13 The chain rule for partial derivatives, 14-4 Total differential of a function z = z(x,y) , 14-5 Determining extrema in functions of two variables, 14-5 Using function HESS to analyze extrema, 14-6 Multiple integrals, 1 4-8 Jacobian of coordinate transformation, 14-9 Double integral in polar coordinates, 14-9 Chapter 15 - Vector Analysis Applications, 15-1 Definitions, 15-1 Gradient and directional derivative, 1 5-1 A program to calculate the gradient, 1 5-2 Using function HESS to obtain the gradient, 15-2 Potential of a gradient, 1 5-3 Divergence, 15-4 Laplacian, 15-4 Curl, 1 5-5 Irrotational fields and potential function, 1 5-5 Vector potential, 1 5-6 Chapter 16 - Differential Equations, 16 1 Basic operations with differential equations, 1 6-1 Entering differential equations, 16-1 Checking solutions in the calculator, 16-2 Slope field visualization of solutions, 1 6-3 The CALC/DIFF menu, 1 6 4 Solution to linear and non-linear equations, 1 6-4 Function LDEC, 16-4 Function DESOLVE, 16-7 The variable ODETYPE, 16-8 Laplace transforms, 16-10 Definitions, 16-10 Laplace transform and inverses in the calculator, 16-1 1 Laplace transform theorems, 1 6-1 2 Dirac's delta function and Heaviside's step function, 16-15 Applications of Laplace transform in the solution of ODEs, 1 6-1 7 Page TOG 14 Fourier series, 16-27 Function FOURIER, 16-28 Fourier series for a quadratic function, 1 6-29 Fourier series for a triangular wave, 1 6-35 Fourier series for a square wave, 1 6-39 Fourier series applications in differential equations, 16-42 Fourier Transforms, 1 6-43 Definition of Fourier transforms, 1 6-46 Properties of the Fourier transform, 1 6-48 Fast Fourier Transform (FFT) , 1 6-49 Examples of FFT applications, 16-50 Solution to specific second-order differential equations, 1 6-53 The Cauchy or Euler equation , 1 6-53 Legendre's equation, 1 6-54 Bessel's equation, 16-55 Chebyshev or Tchebycheff polynomials, 1 6-57 Laguerre's equation, 16-58 Weber's equation and Hermite polynomials, 1 6-59 Numerical and graphical solutions to ODEs, 1 6-60 Numerical solution of first-order ODE, 16-60 Graphical solution of first-order ODE, 1 6-62 Numerical solution of second-order ODE, 16-64 Graphical solution for a second-order ODE, 16-66 Numerical solution for stiff first-order ODE, 1 6-68 Numerical solution to ODEs with the SOLVE/DIFF menu, 1 6 69 Function RKF, 1 6-70 Function RRK, 16-71 Function RKFSTEP, 16-72 Function RRKSTEP, 16-73 Function RKFST, 16-72 Function RKFERR, 16-72 Function RSBERR, 16-73 Chapter 17 - Probability Applications, 17-1 The MTH/PROBABILITY.. sub-menu - part 1,17 1 Factorials, combinations, and permutations, 17-1 Page TOG 15 Random numbers, 1 7-2 Discrete probability distributions, 1 7-4 Binomial distribution, 17-4 Poisson distribution, 17-5 Continuous probability distributions, 1 7-6 The gamma distribution, 17-6 The exponential distribution, 1 7-7 The beta distribution, 17-7 The Weibull distribution, 1 7-7 Functions for continuous distributions, 1 7-7 Continuous distributions for statistical inference, 1 7-9 Normal distribution pdf, 17-9 Normal distribution cdf, 17-10 The Student-t distribution, 1 7-1 0 The Chi-square distribution, 1 7-1 1 The F distribution, 17-12 Inverse cumulative distribution functions, 17-13 Chapter 18 - Statistical Applications, 18 1 Pre-programmed statistical features, 1 8-1 Entering data, 1 8-1 Calculating single-variable statistics, 18-2 Obtaining frequency distributions, 18-5 Fitting data to a function y = f(x) , 18-10 Obtaining additional summary statistics, 1 8-1 3 Calculation of percentiles, 18-14 The STAT soft menu, 18 15 The DATA sub-menu, 1 8-1 5 The 2PAR sub-menu, 18-16 The 1VAR sub-menu, 18-16 The PLOT sub-menu, 18-17 The FIT sub-menu, 1 8-1 8 Example of STAT menu operations, 1 8-1 8 Confidence intervals, 1 8-22 Estimation of Confidence Intervals, 1 8-23 Definitions, 1 8-23 Confidence intervals for the population mean when the population variance is known, 1 8-23 Confidence intervals for the population mean when the population variance is unknown, 1 8-24 Confidence interval for a proportion, 1 8-24 Sampling distributions of differences and sums of statistics, 1 8-25 Confidence intervals for sums and differences of mean values, 1 8-26 Determining confidence intervals, 1 8-27 Confidence intervals for the variance, 1 8-33 Hypothesis testing, 1 8-34 Procedure for testing hypotheses, 1 8-35 Errors in hypothesis testing, 1 8-35 Inferences concerning one mean, 18-36 Inferences concerning two means, 18-39 Paired sample tests, 1 8-40 Inferences concerning one proportion, 1 8-41 Testing the difference between two proportions, 1 8-41 Hypothesis testing using pre-programmed features, 18-43 Inferences concerning one variance, 1 8-47 Inferences concerning two variances, 1 8-48 Additional notes on linear regression, 1 8-49 The method of least squares, 1 8-49 Additional equations for linear regression, 1 8-51 Prediction error, 18-51 Confidence intervals and hypothesis testing in linear regression, 1 8-52 Procedure for inference statistics for linear regression using the calculator, 1 8-53 Multiple linear fitting, 1 8-56 Polynomial fitting, 1 8 58 Selecting the best fitting, 1 8-62 Chapter 19 - Numbers in Different Bases, 19 1 Definitions, 19 1 The BASE menu, 19 1 Functions HEC, DEC, OCT and BIN, 19-2 Page TOG 17 Conversion between number systems, 1 9-3 Wordsize, 19-4 Operations with binary integers, 19-4 The LOGIC menu, 1 9 5 The BIT menu, 1 9 6 The BYTE menu, 1 9 6 Hexadecimal numbers for pixel references, 1 9-7 Chapter 20 - Customizing menus and keyboard, 20-1 Customizing menus, 20-1 The PRG/MODES/MENU, 20-1 Menu numbers (RCLMENU and MENU functions), 20-2 Custom menus (MENU and TMENU functions), 20-2 Menu specification and CST variable, 20-4 Customizing the keyboard, 20-5 The PRG/MODES/KEYS sub-menu, 20-5 Recall current user-defined key list, 20-6 Assign an object to a user-defined key, 20-6 Operating user-defined keys, 20-6 Un-assigning a user-defined key, 20-7 Assigning multiple user-defined key, 20-7 Chapter 21 - Programming in User RPL language, 211 An example of programming, 21-1 Global and local variables and subprograms, 21-2 Global Variable Scope, 21-4 Local Variable Scope, 21-5 The PRG menu, 21-5 Navigating through RPN sub-menus, 21-6 Functions listed by sub-menu, 21-6 Shortcuts in the PRG menu, 21-9 Keystroke sequence for commonly used commands, 21-10 Programs for generating lists of numbers, 21-13 Examples of sequential programming, 21-15 Programs generated by defining a function, 21-15 Page TOG 18 Programs that simulate a sequence of stack operations, 21-17 Interactive input in programs, 21-19 Prompt with an input string, 21-21 A function with an input string, 21-22 Input string for two or three input values, 21-24 Input through input forms, 21-27 Creating a choose box, 21-31 Identifying output in programs, 21-33 Tagging a numerical result, 21-33 Decomposing a tagged numerical result into number and tag, 21-33 "De-tagging" a tagged quantity, 21-33 Examples of tagged output, 21-34 Using a message box, 21-37 Relational and logical operators, 21-43 Relational operators, 21-43 Logical operators, 21-44 Program branching, 2 1 -46 Branching with IF, 21-46 The CASE construct, 21-51 Program loops, 21-53 The START construct, 21-53 The FOR construct, 21-59 The DO construct, 21-61 The WHILE construct, 21-62 Errors and error trapping, 2 1 -64 DOERR, 21-64 ERRN, 21-64 ERRM, 21-65 ERRO, 21-65 LASTARG, 21-65 Sub-menu IFERR, 21-65 User RPL programming in algebraic mode, 2 1 -66 Chapter 22 - Programs for graphics manipulation, 22-1 The PLOT menu, 22-1 User-defined key for the PLOT menu, 22-1 Page TOG 19 Description of the PLOT menu, 22-2 Generating plots with programs, 22-14 Two-dimensional graphics, 22-14 Three-dimensional graphics, 22-15 The variable EQ, 22-15 Examples of interactive plots using the PLOT menu, 22-15 Examples of program-generated plots, 22-17 Drawing commands for use in programming, 22-19 PICT, 22-20 PDIM, 22-20 LINE, 22-20 TUNE, 22-20 BOX, 22-21 ARC, 22-21 PIX?, PIXON, and PIXOFF, 22-22 PVIEW, 22-22 PX^C, 22-22 C^PX, 22-22 Programming examples using drawing functions, 22-22 Pixel coordinates, 22-25 Animating graphics, 22-26 Animating a collection of graphics, 22-27 More information on the ANIMATE function, 22-29 Graphic objects (GROBs), 22 30 The GROB menu, 22-31 A program with plotting and drawing functions, 22-33 Modular programming, 22-36 Running the program, 22-36 A program to calculate principal stresses, 22-38 Ordering the variables in the sub-directory, 22-39 A second example of Mohr's circle calculations, 22-39 An input form for the Mohr's circle program, 22-40 Chapter 23 - Character strings, 23-1 String-related functions in the TYPE sub-menu, 23-1 String concatenation, 23-2 Page TOC-20 The CHARS menu, 23 2 The characters list, 23-3 Chapter 24 - Calculator objects and flags, 24-1 Description of calculator objects, 24-1 Function TYPE, 24 2 Function VTYPE, 24 2 Calculator flags, 24-3 System flags, 24-3 Functions for setting and changing flags, 24-3 User flags, 24-4 Chapter 25 - Date and Time Functions, 25-1 The TIME menu, 25-1 Setting an alarm, 25-1 Browsing alarms, 25-2 Setting time and date, 25-2 TIME Tools, 25-2 Calculations with dates, 25-3 Calculations with times, 25-4 Alarm functions, 25-4 Chapter 26 - Managing memory, 26-1 Memory Structure, 26-1 The HOME directory, 26-2 Port memory, 26-2 Checking objects in memory, 26-2 Backup objects, 26-3 Backing up objects in port memory, 26-3 Backing up and restoring HOME, 26-4 Storing, deleting, and restoring backup objects, 26-5 Using data in backup objects, 26-5 Using libraries, 26-6 Installing and attaching a library, 26-6 Library numbers, 26-7 Deleting a library, 26-7 Creating libraries, 26-7 Backup battery, 26-7 Appendices Appendix A - Using input forms, A -1 Appendix B - The calculator's keyboard, B -1 Appendix C - CAS settings, C I Appendix D - Additional character set, D -1 Appendix E - The Selection Tree in the Equation Writer, Appendix F - The Applications (APPS) menu, F -1 Appendix G - Useful shortcuts, G-l Appendix H - The CAS help facility, H I Appendix I - Command catalog list, 1-1 Appendix J - The MATHS menu, J 1 Appendix K - The MAIN menu, K -1 Appendix L - Line editor commands, L I Appendix M - Index, M l Limited Warranty - W-l Service, W-2 Regulatory information, W-4 A note about screenshots in this guide A screenshot is a representation of the calculator screen. For example, the first time the calculator is turned on you get the following screen (calculator screens are shown with a thick border in this section): :;HD KYI HEM fi= 1 K ' hLG CH0HE1 EDIT | VIEH | RCL | STOfr |PURGE|CLEflR The top two lines represent the screen header and the remaining area in the screen is used for calculator output. Most screenshots in this guide were generated using a computer-based emulator (a program that simulates the operation of the calculator in a computer), and are missing the screen header lines. Instead, they will show additional screen output area in the location of the header lines, as shown below: This additional screen output area in many screen shots in this guide will not show when you try those guide's example in your calculator. Thus, while in the guide you may see a screenshot as the following: :SIN(2.5) t =_59S472 144104 :-J5.5+LN(2.5) 2.53303982043 : 2. 3+5-1-2. 31 13. S EDIT | VIEH | RCL | STOT |PURGE|CLEflR the calculator will actually show the following screen: Page Note-1 fiAD KVI HEM f;= CH0HE1 ALG ■J5.5+LNC2.5) 2.53303982043 2.3+5-1-2.31 13. S EDIT I E H F;lL STO* PURGE CLEAR Notice that the header lines cover the top first and a half lines of output in the calculator's screen. Nevertheless, the lines of output not visible are still available for you to use. You can access those lines in your calculator by pressing the up-arrow key (^b), which will allow you to scroll down the screen contents. Also, as you perform the three operations listed in the screenshot, in the order shown, your screen will show them occupying higher levels in the display as shown next: :;HD KVI HEM f;= ' K ' ALG j RAD KVI HEK fi= ' K ' HLG < [HOME]- [HOME]- ! :SIN(2.5) ! .593472144104 :SIN(2.5) :J5.5+LHC2.5) 598472144104 2.53303932043 fa IT STO* PURGE CLEAR STO* PURGE CLEAR The keystrokes required to complete these exercises are the following: The next operation, will force the lines corresponding to the operation SIN(2.5) to move upwards and be hidden by the header lines. Many screenshots in this guide have also been modified to show only the operation of interest. For example, the screenshot for the operation SIN(2.5), shown above, may be simplified in this guide to look as: Page Note-2 :SIN(2.5) ■598472144104 These simplifications of the screenshots are aimed at economizing output space in the guide. Be aware of the differences between the guide's screenshots and the actual screen display, and you should have no problem reproducing the exercises in this guide. Page Note-3 Chapter 1 Getting started This chapter is aimed at providing basic information in the operation of your calculator. The exercises are aimed at familiarizing yourself with the basic operations and settings before actually performing a calculation. Basic Operations The following exercises are aimed at getting you acquainted with the hardware of your calculator. Batteries The calculator uses 3 AAA (LR03) batteries as main power and a CR2032 lithium battery for memory backup. Before using the calculator, please install the batteries according to the following procedure. To install the main batteries a. Make sure the calculator is off. Slide up the battery compartment cover as illustrated. b. Insert 3 new AAA (LR03) batteries into the main compartment. Make sure each battery is inserted in the indicated direction. To install the backup battery a. Make sure the calculator is off. Press down the holder. Push the plate to the shown direction and lift it. Page 1-1 Holder b. Insert a new CR2032 lithium battery. Make sure its positive (+) side is facing up. c. Replace the plate and push it to the original place. After installing the batteries, press [ON] to turn the power on. Warning: When the low battery icon is displayed, you need to replace the batteries as soon as possible. However, avoid removing the backup battery and main batteries at the same time to avoid data lost. Turning the calculator on and off The jQN J key is located at the lower left corner of the keyboard. Press it once to turn your calculator on. To turn the calculator off, press the red right-shift key IsD (first key in the second row from the bottom of the keyboard), followed by the Q^D key. Notice that the Q^D key has a red OFF label printed in the upper right corner as a reminder of the OFF command. Adjusting the display contrast You can adjust the display contrast by holding the Q^D key while pressing the L±J or CED keys. The L^J (hold) L±J key combination produces a darker display. The L^J (hold) CED key combination produces a lighter display Contents of the calculator's display Turn your calculator on once more. The display should look as indicated below. Page 1-2 At the top of the display you will have two lines of information that describe the settings of the calculator. The first line shows the characters: RFiD XYZ HEX R= 5 X 5 For details on the meaning of these specifications see Chapter 2. The second line shows the characters: { } indicating that the HOME directory is the current file directory in the calculator's memory. In Chapter 2 you will learn that you can save data in your calculator by storing them in files or variables. Variables can be organized into directories and sub-directories. Eventually, you may create a branching tree of file directories, similar to those in a computer hard drive. You can then navigate through the file directory tree to select any directory of interest. As you navigate through the file directory the second line of the display will change to reflect the proper file directory and sub-directory. At the bottom of the display you will find a number of labels, namely, associated with the six soft menu keys, Fl through F6: The six labels displayed in the lower part of the screen will change depending on which menu is displayed. But (jl) will always be associated with the first displayed label, (JL) with the second displayed label, and so on. Menus The six labels associated with the keys (JL) through (jT) form part of a menu of functions. Since the calculator has only six soft menu keys, it only display 6 labels at any point in time. However, a menu can have more than six entries. Each group of 6 entries is called a Menu page. The current menu, known as the TOOL menu (see below), has eight entries arranged in two pages. The next page, containing the next two entries of the menu is available by Page 1-3 pressing the jNxrj (NeXT menu) key. This key is the third key from the left in the third row of keys in the keyboard. Press jNxrj once more to return to the main TOOL menu, or press the [tool) key (third key in second row of keys from the top of the keyboard). The TOOL menu is described in detain in the next section. At this point we will illustrate some properties of menus that you will find useful while using your calculator. SOFT menus vs. CHOOSE boxes Menus, or SOFT menus, associate labels in the lower part of the screen with the six soft menu keys (C^O through C2D )• By pressing the appropriate soft menu key, the function shown in the associated label gets activated. For example, with the TOOL menu active, pressing the MSMB key (C™~) ) activates function CLEAR, which erases (clears up) the contents of the screen. To see this function in action, type a number, say LU L2J LiJ iitHS) , and then press the (jD key. SOFT menus are typically used to select from among a number of related functions. However, SOFT menus are not the only way to access collections of related functions in the calculator. The alternative way will be referred to as CHOOSE boxes. To see an example of a choose box, activate the TOOL menu (press [tool J ), and then press the keystroke combination (j^j_msf (associated with the LU key). This will provide the following CHOOSE box: EASE HEnU ™Ec"™ "^j 3. OCT * 1! H.&m * This CHOOSE box is labeled BASE MENU and provides a list of numbered functions, from 1 . HEX x to 6. B->R. This display will constitute the first page of this CHOOSE box menu showing six menu functions. You can navigate through the menu by using the up and down arrow keys, located in the upper right side of the keyboard, right under the C2D and CZD soft menu keys. To activate any given function, first, highlight the function name by Page 1 -4 using the up and down arrow keys, (/aS)<^? , or by pressing the number corresponding to the function in the CHOOSE box. After the function name is selected, press the soft menu key (QD )• Thus, if you wanted to use function R->B (Real to Binary), you could press • If you want to move to the top of the current menu page in a CHOOSE box, use J</^N> . To move to the bottom of the current page, use LjnJ<\3? • To move to the top of the entire menu, use Lr> . To move to the bottom of the entire menu, use IrU*^? . Selecting SOFT menus or CHOOSE boxes You can select the format in which your menus will be displayed by changing a setting in the calculator system flags (A system flag is a calculator variable that controls a certain calculator operation or mode. For more information about flags, see Chapter 24). System flag 1 17 can be set to produce either SOFT menus or CHOOSE boxes. To access this flag use: Your calculator will show the following screen, highlighting the line starting with the number 1 1 7: ^^»SVSTEH FLAGS fflfflfflim 111 SiHp non rat. t 112 i fiHplifiGd 113 Linear siHp on 11H Dif p 1+x ■+ x+1 115 SGRT fiHpUficd By default, the line will look as shown above. The highlighted line (117 CHOOSE boxes) indicates that CHOOSE boxes are the current menu display setting. If you prefer to use SOFT menu keys, press the IKSQli soft menu key (QD ), followed by llillll ((JD )• Press IB3BIII ((jD ) once more to return to normal calculator display. If you now press L r> J base , instead of the CHOOSE box that you saw earlier, the display will now show six soft menu labels as the first page of the STACK menu: Page 1-5 To navigate through the functions of this menu, press the jNxrj key to move to the next page, or Jp^v (associated with the jNxrj key) to move to the previous page. The following figures show the different pages of the BASE menu accessed by pressing the [nxtJ key twice: Pressing the jNxrj key once more will takes us back to the first menu page. Note: With the SOFT menu setting for system flag 1 1 7, the keystroke combination (j^J(hold) <<z? , will show a list of the functions in the current soft menu. For example, for the two first pages in the BASE menu, you will get: REX" !>EC OCT BIN R+B B+R LOGIC 3IT BYTE STUB RCNS To revert to the CHOOSE boxes setting, use: (Ara) flfcPfl ^C^O ^^IKEOIl Hill Ellllll!. Notes: 1. The TOOL menu, obtained by pressing [tool] , will always produce a SOFT menu. 2. Most of the examples in this user's manual are shown using both SOFT menus and CHOOSE boxes. Programming applications (Chapters 21 and 22) use exclusively SOFT menus. 3. Additional information on SOFT menus vs. CHOOSE boxes is presented in Chapter 2 o f this guide. The TOOL menu The soft menu keys for the menu currently displayed, known as the TOOL menu, are associated with operations related to manipulation of variables (see pages for more information on variables): CjD EDIT the contents of a variable (see Chapter 2 and Appendix L for more information on editing) Page 1-6 VIEW the contents of a variable 1:1: iiii j jlS JS iiii dD ReCaLl the contents of a variable I1IS33S STOre the contents of a variable ! .11!.!.!.!:!=!:!.::! C«D PURGE a variable !":"i:F"s!":"!: CLEAR the display or stack The calculator has only six soft menu keys, and can only display 6 labels at any point in time. However, a menu can have more than six entries. Each group of 6 entries is called a Menu page. The TOOL menu has eight entries arranged in two pages. The next page, containing the next two entries of the menu are available by pressing the jNxrj (NeXT menu) key. This key is the third key from the left in the third row of keys in the keyboard. In this case, only the first two soft menu keys have commands associated with them. These commands are: BxBSlI GD CASCMD: CAS CoMmanD, used to launch a command from the CAS by selecting from a list C~^Q HELP facility describing the commands available Pressing the [nxt) key will show the original TOOL menu. Another way to recover the TOOL menu is to press the [tool) key (third key from the left in the second row of keys from the top of the keyboard). Setting time and date The calculator has an internal real time clock. This clock can be continuously displayed on the screen and be used for alarms as well as running scheduled tasks. This section will show not only how to set time and date, but also the basics of using CHOOSE boxes and entering data in a dialog box. Dialog boxes on your calculator are similar to a computer dialog box. To set time and date we use the TIME choose box available as an alternative function for the l_9j key. By combining the red right-shift button, (j^J, with the L 9 j key the TIME choose box is activated. This operation can also be represented as L r> j time . The TIME choose box is shown in the figure below: Page 1-7 a. s«t ourH.. 3. Set tiH«^ date.. H. Tools.. As indicated above, the TIME menu provides four different options, numbered 1 through 4. Of interest to us as this point is option 3. Set time, dote... Using the down arrow key, <\j?, highlight this option and press the IIE3II C™~) soft menu key. The following input form (see Appendix 1-A) for adjusting time and date is shown: mm sis SET TIHE AM DATE ssssssssssssss TiH-2 : E:01:34 PM Date : 3 '30 '03 IVD^Y Enter hour Setting the time of the day Using the number keys, CD CD CD CD CD CD CD CjDCDCD, start by adjusting the hour of the day. Suppose that we change the hour to 11, by pressing CDCD as the hour field in the SET TIME AND DATE input form is highlighted. This results in the number 7 7 being entered in the lower line of the input form: mmm ijiSET TIHE AM DATE ssssssssssssss TiH-2 : B:01=34 PM Date : 3 '30 '03 IVD^Y 11 Press the 1111331 C™~) soft menu key to effect the change. The value of 1 7 is now shown in the hour field, and the minute field is automatically highlighted: TiH-2 : Date = SET TIHE HTl D DATE 11 :EH=34 PM 3 '30 '03 IVD^Y Enter Hinutc Page 1-8 Let's change the minute field to 25, by pressing: L2J UU IIE3I . The seconds field is now highlighted. Suppose that you want to change the seconds field to 45, use: GDCD MM The time format field is now highlighted. To change this field from its current setting you can either press the L +/- J key (the second key from the left in the fifth row of keys from the bottom of the keyboard), or press the Siilliiliii soft menu key ( (jD )• • If using the L +/- J key, the setting in the time format field will change to either of the following options: o AM : indicates that displayed time is AM time o PM : indicates that displayed time is PM time o 24-hr : indicates that that the time displayed uses a 24 hour format where 1 8:00, for example, represents 6pm The last selected option will become the set option for the time format by using this procedure. If using the [iilliiilill! soft menu key, the following options are available SET TIHE flnD DATE§ AH Use the up and down arrow keys,^> ^3? , to select among these three options (AM, PM, 24-hour time). Press the 111111111111:11111 C^l soft menu key to make the selection. Setting the date After setting the time format option, the SET TIME AND DATE input form will look as follows: Page 1-9 TiHG Date SET TIHE flnD DATE 11 =25 =45 B 3 '30 '03 IVD-^Y Choojg flHj FHj or ZH-hour tim To set the date, first set the date format. The default format is M/D/Y (month/day/year). To modify this format, press the down arrow key. This will highlight the date format as shown below: TiHfl : Date: SET TIHE HTl D DATE 11 =£5 =45 RM 3 '30 '03 Dfflj Se the iiJsjj:!:!:!:!::;! Choose date ■JiJpi.oM forHJt soft menu key ( B), to see the options for the date format: ""lliPSET TIHE Alb pHfET^ J Choose dat« display format Highlight your choice by using the up and down arrow keys,^^ ^3? , and press the ItEiii CZD soft menu key to make the selection. Introducing the calculator's keyboard The figure below shows a diagram of the calculator's keyboard with the numbering of its rows and columns. Page 1-10 Column: 1 ▼ Row 1 ► 2 ► 3 ► 4 ► 5 ► 6 ► 7> 8 ► 9 ► 10 ► 2 T 3 T 4 T 5 ▼ 6 T 7_j LAJ L?J L*_ CALC ALG MATRICES STAT CONVERT UNITS ( ) — ARITH_CMPLX DEF LIB # BASE {}«» 1 9 ANS-NUM ON | I 0 CANCEL Column: ▲ 3 A 5 The figure shows 1 0 rows of keys combined with 3, 5, or 6 columns. Row 1 has 6 keys, rows 2 and 3 have 3 keys each, and rows 4 through 1 0 have 5 keys each. There are 4 arrow keys located on the right-hand side of the keyboard in the space occupied by rows 2 and 3. Each key has three, four, or five functions. The main key function correspond to the most prominent label in the key. Also, the green left-shift key, key (8, 7 J, the red right-shift key, key (9, 7j, and the blue ALPHA key, key [7, 7j, can be Page 1-11 combined with some of the other keys to activate the alternative functions shown in the keyboard. For example, the [symb J key, key(4,4), has the following six functions associated with it: Main function, to activate the SYMBolic menu Left-shift function, to activate the MTH (Math) menu Right-shift function, to activate the CATalog function ALPHA function, to enter the upper-case letter P ALPHA-Left-Shift function, to enter the lower-case letter p ALPHA-Right-Shift function, to enter the symbol P Of the six functions associated with the key only the first four are shown in the keyboard itself. This is the way that the key looks in the keyboard: [alpha] (p) MTH CAT Notice that the color and the position of the labels in the key, namely, SYMB, MTH, CA T and P, indicate which is the main function (SYMB), and which of the other three functions is associated with the left-shift {JnJ(MTH), right- shift CgJ (CAT) , and [alpha] (P) keys. For detailed information on the calculator keyboard operation referee to Appendix B . Selecting calculator modes This section assumes that you are now at least partially familiar with the use of choose and dialog boxes (if you are not, please refer to Chapter 2). Press the [mode) button (second key from the left on the second row of keys from the top) to show the following CALCULATOR MODES input form: Page 1-12 §§§§§§§§§§§§§§§ CALCULATOR HOPES jjjjjjjjjjjjjjjj Operating Ho»Jg..riIEFngEB nuHbcr ForHat....Std _FMj fln^U Hcafurc... Radian* Coord Syst«H Rectangular ^B**P _K*y CUch ^Last StacR Ihooig coU uJ.ator opgr atinj HQjg Press the 113.1:11 (T^H soft menu key to return to normal display. Examples of selecting different calculator modes are shown next. Operating Mode The calculator offers two operating modes: the Algebraic mode, and the Reverse Polish Notation (RPN) mode. The default mode is the Algebraic mode (as indicated in the figure above), however, users of earlier HP calculators may be more familiar with the RPN mode. To select an operating mode, first open the CALCULATOR MODES input form by pressing the LM0P£J button. The Operating Mode field will be highlighted. Select the Algebraic or RPN operating mode by either using the L+/- J key (second from left in the fifth row from the keyboard bottom), or pressing the SID3III soft menu key ( ). If using the latter approach, use up and down arrow keys, ^3?, to select the mode, and press the KQ1I soft menu key to complete the operation. To illustrate the difference between these two operating modes we will calculate the following expression in both modes: 3. 233 To enter this expression in the calculator we will first use the equation writer, I r> j eqw . Please identify the following keys in the keyboard, besides the numeric keypad keys: Page 1-13 The equation writer is a display mode in which you can build mathematical expressions using explicit mathematical notation including fractions, derivatives, integrals, roots, etc. To use the equation writer for writing the expression shown above, use the following keystrokes: ^^^^^^^ After pressing t^jthe calculator displays the expression: V (3* (5-1/ (3*3) ) /23A3+EXP (2.5) ) Pressing [enter] again will provide the following value. Accept Approx. mode on, if asked, by pressing II-IIIS. [Note: The integer values used above, e.g., 3, 5, 1, represent exact values. The EXP(2.5), however, cannot be expressed as an exact value, therefore, a switch to Approx mode is required] You could also type the expression directly into the display without using the equation writer, as follows: to obtain the same result. Change the operating mode to RPN by first pressing the (mope) button. Select the RPN operating mode by either using the L^Jkey, or pressing the Mlmm soft menu key. Press the 1111111:111 C™~) soft menu key to complete the operation. The display, for the RPN mode looks as follows: Page 1-14 Notice that the display shows several levels of output labeled, from bottom to top, as 1, 2, 3, etc. This is referred to as the stack of the calculator. The different levels are referred to as the stack levels, i.e., stack level 1, stack level 2, etc. Basically, what RPN means is that, instead of writing an operation such as 3 + 2, in the calculator by using CZDC±DC2D^^), we write first the operands, in the proper order, and then the operator, i.e., LU l&E) LU l&E) L±J • As you enter the operands, they occupy different stack levels. Entering [ 3 )[enter) puts the number 3 in stack level 1. Next, entering L 2 )[enter) pushes the 3 upwards to occupy stack level 2. Finally, by pressing L + J, we are telling the calculator to apply the operator, or program, L±J to the objects occupying levels 1 and 2. The result, 5, is then placed in level 1. A simpler way to calculate this operation is by using: LUt^L)LUL±J • Let's try some other simple operations before trying the more complicated expression used earlier for the algebraic operating mode: Notice the position of the y and the x in the last two operations. The base in the exponential operation is y (stack level 2) while the exponent is x (stack level 1 ) before the key CZD is pressed. Similarly, in the cubic root operation, y (stack level 2) is the quantity under the root sign, and x (stack level 1) is the root. Try the following exercise involving 3 factors: (5 + 3) x 2 123/32 42 3V27 CU CX3 CXI ^ CU CTD LED LO^LUCzD [TJ(ENTER)[JJ[TJ LUCZD Calculates (5 +3) first. Completes the calculation. Let's try now the expression proposed earlier: Page 1-15 L^CZ^t^D Enter 3 in level 1 L 5 j L i J LfA/7"fflJ Enter 5 in level 1, 3 moves to y C3DCZD^^) Enter 3 in level 1, 5 moves to level 2, 3 to level 3 LiJLiJL><J Place 3 and multiply, 9 appears in level 1 L 'fx j 1/(3x3), last value in lev. 1; 5 in level 2; 3 in level 3 CED 5 - 1/(3x3) , occupies level 1 now; 3 in level 2 L><J 3x (5 - 1/(3x3)), occupies level 1 now. CX3CUCZD(^™D Enter 23 in level 1, 14.66666 moves to level 2. CBCZDCZD Enter 3, calculate 233 into level 1 . 14.666 in lev. 2. C±D (3x (5-l/(3x3)))/233 into level 1 CX3CZDCD Enter 2.5 level 1 L^lJ^ e25, goes into level 1, level 2 shows previous value. GD (3x (5 - 1 /(3x3)))/233 + e2 5 =12.1 8369, into lev. 1 . O V((3x (5 - l/(3x3)))/233 + e25) = 3.4905156, into 1. Although RPN requires a little bit more thought than the algebraic (ALG) mode, there are multiple advantages in using RPN. For example, in RPN mode you can see the equation unfolding step by step. This is extremely useful to detect a possible input error. Also, as you become more efficient in this mode and learn more of the tricks, you will be able to calculate expression faster and will much less keystrokes. Consider, for example the calculation of (4x6 - 5)/(l +4x6 - 5). In RPN mode you can write: obviously, even In RPN mode, you can enter an expression in the same order as the algebraic mode by using the Equation writer. For example, ^^^^^^^ The resulting expression is shown in stack level 1 as follows: l: EDIT | VIEH | RCL | STOfr |FUF;ijE|lLEHF; Notice how the expression is placed in stack level 1 after pressing [enter] , Pressing the EVAL key at this point will evaluate the numerical value of that expression Note: In RPN mode, pressing ENTER when there is no command Page 1-16 line will execute the DUP function which copies the contents of stack level 1 of the stack onto level 2 (and pushes all the other stack levels one level up). This is extremely useful as showed in the previous example. To select between the ALG vs. RPN operating mode, you can also set/clear system flag 95 through the following keystroke sequence: Qwx) mm ^ GT) ^ GD ^ GD ^ IKIIilil mm mm Alternatively, you can use one of the following shortcuts: • In ALG mode, CF(-95) selects RPN mode • In RPN mode, 95 C+T)(enter) SF selects ALG mode For more information on calculator's system flags see Chapter 2. Number Format and decimal dot or comma Changing the number format allows you to customize the way real numbers are displayed by the calculator. You will find this feature extremely useful in operations with powers of tens or to limit the number of decimals in a result. To select a number format, first open the CALCULATOR MODES input form by pressing the [mode) button. Then, use the down arrow key, ^3?, to select the option Number format. The default value is Std, or Sfanc/ard format. In the standard format, the calculator will show floating-point numbers with the maximum precision allowed by the calculator (12 significant digits). To learn more about reals, see Chapter 2. To illustrate this and other number formats try the following exercises: • Standard format: This mode is the most used mode as it shows numbers in the most familiar notation. Press the m3m soft menu key, with the Number format set to Std, to return to the calculator display. Enter the number 1 23.45678901 23456. Notice that this number has 1 6 significant figures. Press the [enter] key. Page 1-17 The number is rounded to the maximum 1 2 significant figures, and is displayed as follows: 123.456789012 123.456789012 laaaiBaMfflBBBiHnMHBna In the standard format of decimal display, integer numbers are shown with no decimal zeros whatsoever. Numbers with different decimal figures will be adjusted in the display so that only those decimal figures that are necessary will be shown. More examples of numbers in standard format are shown next: : 125. 125. :25.69S 25.693 : 56.254379 56.254379 EDIT | VIEH | RCL I STO* |F UF;ijE|CLEHF; Fixed format with no decimals: Press the [mode] button. Next, use the down arrow key, <s3?/ to select the option Number format. Press the SID3I1I soft menu key ( (JL) ), and select the option Fixed with the arrow down key ^3? . CALCULATOR MODE:" Operating Hodc. A Ucbrgic nuHbcr ForHat....Hfi 0 _FH.. An^U Hcafurc... Radian* Coord Syst«H RcctansuUr ^B**P _K*y CUch ^Last StacR ^00 Tl^liJf Sf _ jj/i/^-L f Qj" Hat Notice that the Number Format mode is set to Fix followed by a zero (0). This number indicates the number of decimals to be shown after the decimal point in the calculator's display. Press the IEI9I soft menu key to return to the calculator display. The number now is shown as: 123. 123. EDIT I E H RCL STOP- PURGE CLEAR This setting will force all results to be rounded to the closest integer (0 digit displayed after the comma). However, the number is still stored by the calculator with its full 1 2 significant digit precision. As we change the number of decimals to be displayed, you will see the additional digits being shown again. Page 1-18 Fixed format with decimals: This mode is mainly used when working with limited precision. For example, if you are doing financial calculation, using a FIX 2 mode is convenient as it can easily represent monetary units to a 1/1 00 precision. Press the (mode) button. Next, use the down arrow key, ^3? , to select the option Number format. Press the soft menu key ( QD )/ and select the option Fixed with the arrow down key ' j: CALCULATOR MODEL" lopcratin^ Hod*.. AUcbraic lriiJHt"2f FurHi]t....lffl 0 _FHj Any!.* Hcasurc... Radians Coord Syft«H RcctonsuLar |^B«P _K«y aicR ^Loft StacR Choose nuHb cr display ForHO t Press the right arrow key, CD, to highlight the zero in front of the option Fix. Press the !i!ii!I!!i!!!i!!§! soft menu key and, using the up and down arrow keys, (^N) ^3? , select, say, 3 decimals. Opcr nurib Hr.q 1. .FH, Coor H S tacR Choo C Press the KCE111 soft menu key to complete the selection: CALCULATOR MODE:" Operating HodcALycbraic nuHbcr ForHat....Fix 9 _FMj AnyU Hcafurc... Radian* Coord Syst«H RcctanyuUr ^B**P _K*y CUch ^Last StacR Choojg d^ci Hal places to display Press the I11ECE111 soft menu key return to the calculator display. The number now is shown as: 123.457 123.457 Notice how the number is rounded, not truncated. Thus, the number 1 23.45678901 23456, for this setting, is displayed as 1 23.457, and not as 1 23.456 because the digit after 6 is > 5 Page 1-19 Scientific format The scientific format is mainly used when solving problems in the physical sciences where numbers are usually represented as a number with limited precision multiplied by a power of ten. To set this format, start by pressing the LM0P£J button. Next, use the down arrow key, <\j?/ to select the option Number format. Press the H3SEB soft menu key ( C^~) ), and select the option Scientific with the arrow down key <\3? . Keep the number 3 in front of the Sci. (This number can be changed in the same fashion that we changed the Fixed number of decimals in the example above). S CALCULATOR MODEL" lOpcrQtxn^ Hod*.. flU-zbraic lriUHt'h!i- ForHat....EHl 3 _FMj Coord SystCH RcctonsuLar |^B**P _K*y aicR ^Last StacR Choojg nuHb ir digp_l.au Fotho t Press the II1ECE111 soft menu key return to the calculator display, number now is shown as: The 1 . 235E2 1 ■ 235E2 This result, 1 .23E2, is the calculator's version of powers-of-ten notation, i.e., 1.235 x 102. In this, so-called, scientific notation, the number 3 in front of the Sci number format (shown earlier) represents the number of significant figures after the decimal point. Scientific notation always includes one integer figure as shown above. For this case, therefore, the number of significant figures is four. • Engineering format The engineering format is very similar to the scientific format, except that the powers of ten are multiples of three. To set this format, start by pressing the LM0P£J button. Next, use the down arrow key, <\j?/ to select the option Number format. Press the llllilll! soft menu key ( C^~) ), and select the option Engineering with the arrow down key . Keep the number 3 in front of the Eng. (This number can be changed in the same fashion that we changed the Fixed number of decimals in an earlier example). Page 1-20 CALCULATOR MODEL" Opcrotins Hod*., ft Hebraic ri ij h t- hi I" ForHat....En3 9 _FH.. flnslfl M-2']?ur-2.... R']'ji-]ri? Coord SystCH RcctonsuLar ^B**P _K*y aich ^Last StocR Choojg dgci Hal pUKgj to ■3iJp'.-]M Press the KGlisoft menu key return to the calculator display, number now is shown as: The 123. SEE Because this number has three figures in the integer part, it is shown with four significative figures and a zero power of ten, while using the Engineering format. For example, the number 0.00256, will be shown as: : 123. 5E0 2.560E-3 123. 5E0 2.560E-3 H-HimillliHlHHllii'liHaHBla Decimal comma vs. decimal point Decimal points in floating-point numbers can be replaced by commas, if the user is more familiar with such notation. To replace decimal points for commas, change the FA/I option in the CALCULATOR MODES input form to commas, as follows (Notice that we have changed the Number Format to Std): Press the [mode) button. Next, use the down arrow key, ^3?, once, and the right arrow key, CD, highlighting the option FM,. To select commas, press the li^ililllllll soft menu key (i.e., the CZD key). The input form will look as follows: CALCULATOR MODEL" Opcrotins Hod*., ft Hebraic nuHbflf ForHat....Std Hfh, fln^Lc Hcafur4....Ra4i4nf Coord SystCH RcctonsuLar ^B**P _K*y aicR ^Last StacR Ifi coHHfl a j_ f ration Harh? Press the BUI soft menu key return to the calculator display, number 1 23.45678901 2, entered earlier, now is shown as: The 123,456739012 123,456739013 EDIT '.' I E H RCL £T0t PURGE CLEAR Page 1-21 Angle Measure Trigonometric functions, for example, require arguments representing plane angles. The calculator provides three different Angle Measure modes for working with angles, namely: • Degrees: There are 360 degrees (360°) in a complete circumference, or 90 degrees (90°) in a right angle. This representation is mainly used when doing basic geometry, mechanical or structural engineering, and surveying. • Radians: There are 2n radians (2;rr) in a complete circumference, or n/2 radians (n/2 r) in a right angle. This notation is mainly used when solving mathematics and physics problems. This is the default mode of the calculator. • Grades: There are 400 grades (400 9) in a complete circumference, or 700 grades (7 00 g) in a right angle. This notation is similar to the degree mode, and was introduced in order to "simplify" the degree notation but is seldom used now. The angle measure affects the trig functions like SIN, COS, TAN and associated functions. To change the angle measure mode, use the following procedure: • Press the LM0P£J button. Next, use the down arrow key, ^3? , twice. Select the Angle Measure mode by either using the L^jkey (second from left in the fifth row from the keyboard bottom), or pressing the soft menu key ( QD )• If using the latter approach, use up and down arrow keys,^} ^z? , to select the preferred mode, and press the MB f^Q soft menu key to complete the operation. For example, in the following screen, the Radians mode is selected: ^^CflLCULflTOR H0DES^^« Opcrotins Hodc. ft Hebraic nuHbcr ForHJt.... Std _FHj Coord SyftCH RcctonsuLar ^B«P _K«y aich ^Loft Stack Choose gnjl g_ mq sure Coordinate System Page 1-22 The coordinate system selection affects the way vectors and complex numbers are displayed and entered. To learn more about complex numbers and vectors, see Chapters 4 and 9, respectively. Two- and three-dimensional vector components and complex numbers can be represented in any of 3 coordinate systems: The Cartesian (2 dimensional) or Rectangular (3 dimensional), Cylindrical (3 dimensional) or Polar (2 dimensional), and Spherical (only 3 dimensional). In a Cartesian or Rectangular coordinate system a point P will have three linear coordinates (x,y,z) measured from the origin along each of three mutually perpendicular axes (in 2 d mode, z is assumed to be 0). In a Cylindrical or Polar coordinate system the coordinates of a point are given by (r,9,z), where r is a radial distance measured from the origin on the xy plane, 0 is the angle that the radial distance r forms with the positive x axis - measured as positive in a counterclockwise direction -, and z is the same as the z coordinate in a Cartesian system (in 2 d mode, z is assumed to be 0). The Rectangular and Polar systems are related by the following quantities: r = Jx2+y2 x = r- cos(#) y-r- sin(#) 6 = tan" z — z In a Spherical coordinate system the coordinates of a point are given by (p,6,4>) where p is a radial distance measured from the origin of a Cartesian system, 6 is an angle representing the angle formed by the projection of the linear distance p onto the xy axis (same as 6 in Polar coordinates), and 0 is the angle from the positive z axis to the radial distance p. The Rectangular and Spherical coordinate systems are related by the following quantities: p = Jl x = p • sin(^) • cos(#) y = p- sin(^) • sin(#) 0 = tan" z = /}-cos(^) (j) - tan" lx2 +y2 +z2 (A \x) t To change the coordinate system in your calculator, follow these steps: Page 1-23 • Press the LM0P£J button. Next, use the down arrow key, ^3?, three times. Select the Angle Measure mode by either using the L+/- J key (second from left in the fifth row from the keyboard bottom), or pressing the H3SEE9 soft menu key ( C™~) )• If using the latter approach, use up and down arrow keys,^} <\j/>, to select the preferred mode, and press the 1111111111 f^Q soft menu key to complete the operation. For example, in the following screen, the Polar coordinate mode is selected: ^^^CftLCULflTOR H0DES^^« Operating Hodc. ft Hebraic nuHb«r ForHat....Std _FHj fln^U H-zojurh!.... F;-]-Ji-]riJ Coord Syft«H QIEI^^^H ^E«flp _K«y CUch ^Laft Stack Ihi ■:■ ■:■ j £ coor dinqtg_JUJt «h Beep, Key Click, and Last Stack The last line of the CALCULATOR MODES input form include the options: _Beep _Key Click _Lost Stock By choosing the check mark next to each of these options, the corresponding option is activated. These options are described next: _Beep : When selected, , the calculator beeper is active. This operation mainly applies to error messages, but also some user functions like BEEP. _Key Click : When selected, each keystroke produces a "click" sound. _Lost Stock: Keeps the contents of the last stack entry for use with the functions UNDO and ANS (see Chapter 2). The _Beep option can be useful to advise the user about errors. You may want to deselect this option if using your calculator in a classroom or library. The _Key Click option can be useful as an audible way to check that each keystroke was entered as intended. The _Lost Stock option is very useful to recover the last operation in case we need it for a new calculation. To select, or deselect, any of these three options, first press the [mode) button. Next, Page 1-24 • Use the down arrow key, ~, four times to select the _Lost Stock option. Use the soft menu key (i.e., the CZD key) to change the selection. • Press the left arrow key (T) to select the _Key Click option. Use the 11^333 soft menu key (i.e., the (JL) key) to change the selection. • Press the left arrow key CD to select the _Beep option. Use the jKilimjl soft menu key (i.e., the (JL) key) to change the selection. Press the lllllLllllllll C™~~) soft menu key to complete the operation. CAS stands for Computer Algebraic System. This is the mathematical core of the calculator where the symbolic mathematical operations and functions are programmed and performed. The CAS offers a number of settings can be adjusted according to the type of operation of interest. These are: • The default independent variable • Numeric vs. symbolic mode • Approximate vs. Exact mode • Verbose vs. Non-verbose mode • Step-by-step mode for operations • Increasing power format for polynomials • Rigorous mode • Simplification of non-rational expressions Details on the selection of CAS settings are presented in Appendix C. Selecting Display modes The calculator display can be customized to your preference by selecting different display modes. To see the optional display settings use the following: • First, press the (km) button to activate the CALCULATOR MODES input form. Within the CALCULATOR MODES input form, press the EEB1 soft menu key ((JD ) to display the DISPLAY MODES input form. Selecting CAS settings !Font:FtS_S: SYSTEM S lEdit: g:'H-]i. i. _FuU Fas* _Ind*nt !Stach:_SHaU ^Textbook IEGH: _ShoU _ShoU Stach Difp fcdit using jhoU font? Page 1-25 • To navigate through the many options in the DISPLAY MODES input form, use the arrow keys: CD CD ^3? {A^> • • To select or deselect any of the settings shown above, that require a check mark, select the underline before the option of interest, and toggle the soft menu key until the right setting is achieved. When an option is selected, a check mark will be shown in the underline (e.g., the Textbook option in the Stock: line above). Unselected options will show no check mark in the underline preceding the option of interest (e.g., the _Smoll, _Full page, and Jndent options in the Edit: line above). • To select the Font for the display, highlight the field in front of the Font: option in the DISPLAY MODES input form, and use the H3SSB soft menu key(CZD). • After having selected and unselected all the options that you want in the DISPLAY MODES input form, press the Iliiilllllll soft menu key. This will take you back to the CALCULATOR MODES input form. To return to normal calculator display at this point, press the EH soft menu key once more. Selecting the display font Changing the font display allows you to have the calculator look and feel changed to your own liking. By using a 6-pixel font, for example, you can display up to 9 stack levels! Follow these instructions to select your display font: First, press the (mqdF) button to activate the CALCULATOR MODES input form. Within the CALCULATOR MODES input form, press the EEB1 soft menu key (GD) to display the DISPLAY MODES input form. The Font: field is highlighted, and the option Ft8_0: system 8 is selected. This is the default value of the display font. Pressing the illliiilili soft menu key (QD ), will provide a list of availab e system fonts, as shown below: S DISPLAY MODEL" Font Edit Stac Syst«H Font ? Syst«H Font 6 dent Choos« syst«H Font The options available are three standard System Fonts (sizes 8/ 7, and 6) and a Browse., option. The latter will let you browse the calculator memory for Page 1-26 additional fonts that you may have created (see Chapter 23) or downloaded into the calculator. Practice changing the display fonts to sizes 7 and 6. Press the OK soft menu key to effect the selection. When done with a font selection, press the 112111 soft menu key to go back to the CALCULATOR MODES input form. To return to normal calculator display at this point, press the IEQ5 soft menu key once more and see how the stack display change to accommodate the different font. Selecting properties of the line editor First, press the [mode] button to activate the CALCULATOR MODES input form. Within the CALCULATOR MODES input form, press the BBisoft menu key (GD ) to display the DISPLAY MODES input form. Press the down arrow key, ^▼7, once, to get to the Edit line. This line shows three properties that can be modified. When these properties are selected (checked) the following effects are activated: _Small Changes font size to small _Full page Allows to place the cursor after the end of the line Jndent Auto intend cursor when entering a carriage return Detailed instructions on the use of the line editor are presented in Chapter 2 in this guide. Selecting properties of the Stack First, press the [mode] button to activate the CALCULATOR MODES input form. Within the CALCULATOR MODES input form, press the I3S1 soft menu key (CZQ ) to display the DISPLAY MODES input form. Press the down arrow key, ^▼7, twice, to get to the Stock line. This line shows two properties that can be modified. When these properties are selected (checked) the following effects are activated: _Smoll Changes font size to small. This maximized the amount of information displayed on the screen. Note, this selection overrides the font selection for the stack display. _Textbook Display mathematical expressions in graphical mathematical notation Page 1-27 To illustrate these settings, either in algebraic or RPN mode, use the equation writer to type the following definite integral: In Algebraic mode, the following screen shows the result of these keystrokes with neither _Small nor _Textbook are selected: jagBHgSg33ME3H133MlEiaj With the _Smoll option selected only, the display looks as shown below: With the _Textbook option selected (default value), regardless of whether the _Small option is selected or not, the display shows the following result: : e"XdX Je 1 EHMHEZEgEgliaaiEig] Selecting properties of the equation writer (EQW) First, press the Qwx) button to activate the CALCULATOR MODES input form. Within the CALCULATOR MODES input form, press the I3S1 soft menu key (GQ ) to display the DISPLAY MODES input form. Press the down arrow key, <s3?/ three times, to get to the EQW (Equation Writer) line. This line shows two properties that can be modified. When these properties are selected (checked) the following effects are activated: _Smoll Changes font size to small while using the equation editor _Small Stock Disp Shows small font in the stack for textbook style display Detailed instructions on the use of the equation editor (EQW) are presented elsewhere in this manual. Page 1-28 f00 -X For the example of the integral e dX , presented above, selecting the _Small Stack Disp in the EQW line of the DISPLAY MODES input form produces the following display: *"KdK Selecting the size of the header First, press the (km) button to activate the CALCULATOR MODES input form. Within the CALCULATOR MODES input form, press the EES1 soft menu key (GD ) to display the DISPLAY MODES input form. Press the down arrow key, <s3?/ four times, to get to the Header line. The value 2 is assigned to the Header field by default. This means that the top part of the display will contain two lines, one showing the current settings of the calculator, and a second one showing the current sub directory within the calculator's memory (These lines were described earlier in the manual). The user can select to change this setting to 1 or 0 to reduce the number of header lines in the display. Selecting the clock display First, press the (mode) button to activate the CALCULATOR MODES input form. Within the CALCULATOR MODES input form, press the BSl soft menu key (GD ) to display the DISPLAY MODES input form. Press the down arrow key, ^3? , four times, to get to the Header line. The Header field will be highlighted. Use the right arrow key (CD) to select the underline in front of the options _Clock or _Analog. Toggle the jK;jjj]31i soft menu key until the desired setting is achieved. If the _Clock option is selected, the time of the day and date will be shown in the upper right corner of the display. If the _Analog option is also selected, an analog clock, rather than a digital clock, will be shown in the upper right corner of the display. If the _Clock option is not selected, or the header is not present, or too small, the date and time of day will not be shown in the display. Page 1-29 Chapter 2 Introducing the calculator In this chapter we present a number of basic operations of the calculator including the use of the Equation Writer and the manipulation of data objects in the calculator. Study the examples in this chapter to get a good grasp of the capabilities of the calculator for future applications. Calculator objects Any number, expression, character, variable, etc., that can be created and manipulated in the calculator is referred to as an object. Some of the most useful type of objects are listed below. Real. These object represents a number, positive or negative, with 12 significant digits and an exponent ranging from -499 to +499. example of reals are: 1 ., -5., 56.41 564 1 .5E45, -555.74E-95 When entering a real number, you can use the Ieex j key to enter the exponent and the L^J key to change the sign of the exponent or mantissa. Note that real must be entered with a decimal point, even if the number does not have a fractional part. Otherwise the number is taken as an integer number, which is a different calculator objects. Reals behave as you would expect a number to when used in a mathematical operation. Integers. These objects represent integer numbers (numbers without fractional part) and do not have limits (except the memory of the calculator). Example of integers are: 1, 564654112, -413165467354646765465487. Note how these numbers do not have a decimal point. Due to their storage format, integer numbers are always maintain full precision in their calculation. For example, an operation such as 30/14, with integer numbers, will return 15/7 and not 2.142.... To force a real (or floating-point) result, use function ->NUM L r> j -~num . Integers are used frequently in CAS-based functions as they are designed to keep full precision in their operation.. Page 2-1 If the approximate mode (APPROX) is selected in the CAS (see Appendix C), integers will be automatically converted to reals. If you are not planning to use the CAS, it might be a good idea to switch directly into approximate mode. Refer to Appendix C for more details. Mixing integers and reals together or mistaking an integer for a real is a common occurrence. The calculator will detect such mixing of objects and ask you if you want to switch to approximate mode. Complex numbers, are an extension of real numbers that include the unit imaginary number, / 2= -1 . A complex number, e.g., 3 + 2i, is written as (3, 2) in the calculator. Complex numbers can be displayed in either Cartesian or polar mode depending on the setting selected. Note that complex numbers are always stored in Cartesian mode and that only the display is affected. This allows the calculator to keep as much precision as possible during calculations. Most mathematics functions work on complex numbers. There is no need to use a special "complex +" function to add complex numbers, you can use the same L + J function that on reals or integers. Vector and matrix operations utilize objects of type 3, real arrays, and, if needed, type 4, complex arrays. Objects type 2, strings, are simply lines of text (enclosed between quotes) produced with the alphanumeric keyboard. A list is just a collection of objects enclosed between curly brackets and separated by spaces in RPN mode (the space key is labeled jspc J )/ or by commas in algebraic mode. Lists, objects of type 5, can be very useful when processing collections of numbers. For example, the columns of a table can be entered as lists. If preferred, a table can be entered as a matrix or array. Objects type 8 are programs in User RPL language. These are simply sets of instructions enclosed between the symbols « ». Associated with programs are objects types 6 and 7, Global and Local Names, respectively. These names, or variables, are used to store any type of objects. The concept of global or local names is related to the scope or reach of the variable in a given program. Page 2-2 An algebraic object, or simply, an algebraic (object of type 9), is a valid algebraic expression enclosed between apostrophes. Binary integers, objects of type 10, are used in some computer science applications. Graphics objects, objects of type 11, store graphics produced by the calculator. Tagged objects, objects of type 1 2, are used in the output of many programs to identify results. For example, in the tagged object: Mean: 23.2, the word Mean: is the tag used to identify the number 23.2 as the mean of a sample, for example. Unit objects, objects of type 1 3, are numerical values with a physical unit attached to them. Directories, objects of type 15, are memory locations used to organize your variables in a similar fashion as folders are used in a personal computer. Libraries, objects of type 16, are programs residing in memory ports that are accessible within any directory (or sub-directory) in your calculator. They resemble built-in functions, objects of type 18, and built-in commands, objects of type 1 9, in the way they are used. Editing expressions in the screen In this section we present examples of expression editing directly into the calculator display (algebraic history or RPN stack). Creating arithmetic expressions For this example, we select the Algebraic operating mode and select a Fix format with 3 decimals for the display. We are going to enter the arithmetic expression: i.o+M 5.0- 7-5 V3.0-2.03 To enter this expression use the following keystrokes: Page 2-3 The resulting expression is: 5.*(1 .+1 ,/7.5)/(J"3.-2.A3). Press (enter} to get the expression in the display as follows: -.904070293597 Notice that, if your CAS is set to EXACT (see Appendix C) and you enter your expression using integer numbers for integer values, the result is a symbolic quantity, e.g., Before producing a result, you will be asked to change to Approximate mode. Accept the change to get the following result (shown in Fix decimal mode with three decimal places - see Chapter 1 ): 5.000. fi 000+1-000! I1-000 7. 509 J J3. 009-2. 0003- MUHHIKgBIUIIIUBmilKMl In this case, when the expression is entered directly into the stack, as soon as you press [enter] , the calculator will attempt to calculate a value for the expression. If the expression is entered between quotes, however, the calculator will reproduce the expression as entered. In the following example, we enter the same expression as above, but using quotes. For this case we set the operating mode to Algebraic, the CAS mode to Exact (deselect _Approx), and the display setting to Textbook. The keystrokes to enter the expression are the following: Page 2-4 The result will be shown as follows: To evaluate the expression we can use the EVAL function, as follows: []W]r^lANS [enter] As in the previous example, you will be asked to approve changing the CAS setting to Approx. Once this is done, you will get the same result as before. An alternative way to evaluate the expression entered earlier between quotes is by using the option LrLJ^M^ . To recover the expression from the existing stack, use the following keystrokes: CSCSCS^^ We will now enter the expression used above when the calculator is set to the RPN operating mode. We also set the CAS to Exact and the display to Textbook. The keystrokes to enter the expression between quotes are the same used earlier, i.e., Resulting in the output Press [enter) once more to keep two copies of the expression available in the stack for evaluation. We first evaluate the expression using the function EVAL, and next using the function ->NUM. First, evaluate the expression using function EVAL. The resulting expression is semi-symbolic in the sense that there are floating-point components to the result, as well as a V3. Next, we switch stack locations and evaluate using function ->NUM: CD Exchange stack levels 1 and 2 (the SWAP command) Ij^^num Evaluate using function ->NUM Page 2-5 This latter result is purely numerical, so that the two results in the stack, although representing the same expression, seem different. To verify that they are not, we subtract the two values and evaluate this difference using function EVAL: LnJ Subtract level 1 from level 2 [eval) Evaluate using function EVAL The result is zero (0.). Note: Avoid mixing integer and real data to avoid conflicts in the calculations. For many physical science and engineering applications, including numerical solution of equation, statistics applications, etc., the APPROX mode (see Appendix C) works better. For mathematical applications, e.g., calculus, vector analysis, algebra, etc., the EXACT mode is preferred. Become acquainted with operations in both modes and learn how to switch from one to the other for different types of operations (see Appendix Q. Editing arithmetic expressions Suppose that we entered the following expression, between quotes, with the calculator in RPN mode and the CAS set to EXACT: 18 5. I1 1.75J J5-23 i™iH>ju:ir*««nc>]ai;iiiffl4Hi*ifl 1 + rather than the intended expression: 5 ■ was entered by using: 7.5 V3-23 . The incorrect expression To enter the line editor use C5D^3? . The display now looks as follows: Page 2-6 45*< 1-1/1. 75 V<-J"5-2A3 The editing cursor is shown as a blinking left arrow over the first character in the line to be edited. Since the editing in this case consists of removing some characters and replacing them with others, we will use the right and left arrow keys, (3D CD , to move the cursor to the appropriate place for editing, and the delete key, J, to eliminate characters. The following keystrokes will complete the editing for this case: • Press the right arrow key, CD , until the cursor is immediately to the right of the decimal point in the term 7.75 • Press the delete key, L4J, twice to erase the characters 7. • Press the right arrow key, CD , once, to move the cursor to the right of the 7 • Type a decimal point with Lj_J • Press the right arrow key, CD , until the cursor is immediately to the right of the V5 • Press the delete key, L4J, once to erase the character 5 • Type a 3 with LU • Press [enter) to return to the stack The edited expression is now available in the stack. 1- 7.5 43-2* EDIT VIEH RCL STO* PURGE CLEAR Editing of a line of input when the calculator is in Algebraic operating mode is exactly the same as in the RPN mode. You can repeat this example in Algebraic mode to verify this assertion. Creating algebraic expressions Algebraic expressions include not only numbers, but also variable names. As an example, we will enter the following algebraic expression: Page 2-7 R + y We set the calculator operating mode to Algebraic, the CAS to Exact, and the display to Textbook. To enter this algebraic expression we use the following keystrokes: ED (J— SSED^EDSC^EDCBCx^ Press (enter} to get the following result: Entering this expression when the calculator is set in the RPN mode is exactly the same as this Algebraic mode exercise. Editing algebraic expressions Editing of an algebraic expression with the line editor is very similar to that of an arithmetic expression (see exercise above). Suppose that we want to modify the expression entered above to read To edit this algebraic expression using the line editor use l<n j^r? . This activates the line editor, showing the expression to be edited as follows: £*L*-T < 1 +x^R > s (. R+y > +2* Page 2-8 The editing cursor is shown as a blinking left arrow over the first character in the line to be edited. As in an earlier exercise on line editing, we will use the right and left arrow keys, (3D CD , to move the cursor to the appropriate place for editing, and the delete key, L4J, to eliminate characters. The following keystrokes will complete the editing for this case: • Press the right arrow key, CD , until the cursor is to the right of the x • Type LzULU to enter the power 2 for the x • Press the right arrow key, CD / until the cursor is to the right of the y • Press the delete key, L4J, once to erase the characters y. • Type (^)CSD(3 to enter an x • Press the right arrow key, CD , 4 times to move the cursor to the right of the * • Type to enter a square root symbol • Type QD^ to enter a set of parentheses (they come in pairs) • Press the right arrow key, CD, once, and the delete key, J, once, to delete the right parenthesis of the set inserted above • Press the right arrow key, CD , 4 times to move the cursor to the right of the b • Type (JnJ^ to enter a second set of parentheses • Press the delete key, i + J, once, to delete the left parenthesis of the set inserted above. • Press [enter) to return to normal calculator display. The result is shown next: 2-L- " R- [(2-R+ 1+^ R ,2'L 1- y b 2- x3-JBH-IRI+2^ 2 2 R +x SQCb-RMR+x) i™iH'JM:iH;««-ici]ai;iii;irU[M*ifl Notice that the expression has been expanded to include terms such as | R | , the absolute value, and SQ(b-R), the square of b-R. To see if we can simplify this result, use FACTOR(ANS(l )) in ALG mode: Page 2-9 U^-K+^XJ-JD-LAKI+^-JK +X SQCb-RMR+x) FflCTORtflHSdH ^■[[Jb-R+x-Jb]-IRI+J[R2+x2-R]^ 2 2 (R+x)-b -R EaaiBaMfflMBBiianMHBna Press LjnJ*^? to activate the line editor once more. The result is now: 4* (. (. J"b*R+x*-J"b > *FlBS (. R > +JX <RA2+xA2*R)*L>*flBS (. b *FlBS (. R > * (. -J"L*flBS (. b > V<<R+x>*<bA2*RA2>> ♦skip skiph -kjel del-* del l ins i • Pressing (enter} once more to return to normal display. To see the entire expression in the screen, we can change the option _Smoll Stock Disp in the DISPLAY MODES input form (see Chapter 1 ). After effecting this change, the display will look as follows: [ta.R+a.x)-JFT.iRi+a-jR3*x3.R.L.ibi].ib> SGtb-RMR+x) :FACTOR(AnS(iH (3'-Jb-R+3-x--Jb)-C-IH-R3+3--jR3+x3-R-L EDIT | '.'IEH | RCL | S TO* |PURGE|CLERR Note: To use Greek letters and other characters in algebraic expressions use the CHARS menu. This menu is activated by the keystroke combination L j chars . Details are presented in Appendix D. Using the Equation Writer (EQW) to create expressions The equation writer is an extremely powerful tool that not only let you enter or see an equation, but also allows you to modify and work/apply functions on all or part of the equation. The equation writer (EQW), therefore, allows you to perform complex mathematical operations, directly, or in a step-by-step mode, as you would do on paper when solving, for example, calculus problems. Page 2-10 The Equation Writer is launched by pressing the keystroke combination Lr> J lr>j eqw (the third key in the fourth row from the top in the keyboard). The resulting screen is the following: EDIT | CURS | BIG ■! E ■■■ M L |FflCT0| SIHF The six soft menu keys for the Equation Writer activate the following functions: illlilllil: lets the user edit an entry in the line editor (see examples above) illlllil: highlights expression and adds a graphics cursor to it iiliili: if selected (selection shown by the character in the label) the font used in the writer is the system font 8 (the largest font available) fSEB: lets you evaluate, symbolically or numerically, an expression highlighted in the equation writer screen (similar to Lr> JL^O) IIIiSQ: lets you factor an expression highlighted in the equation writer screen (if factoring is possible) ililill: lets you simplify an expression highlighted in the equation writer screen (as much as it can be simplified according to the algebraic rules of the CAS) If you press the [nxt) key, two more soft menu options show up as shown below: The six soft menu keys for the Equation Writer activate the following functions: illlllil: allows access to the collection of CAS commands listed in alphabetical order. This is useful to insert CAS commands in an expression available in the Equation Writer. illllSIII: activates the calculator's CAS help facility to provide information and examples of CAS commands. Some examples for the use of the Equation Writer are shown below. Creating arithmetic expressions Entering arithmetic expressions in the Equation Writer is very similar to entering an arithmetic expression in the stack enclosed in quotes. The main difference is that in the Equation Writer the expressions produced are written Page 2-1 1 in "textbook" style instead of a line-entry style. Thus, when a division sign (i.e., GED) is entered in the Equation Writer, a fraction is generated and the cursor placed in the numerator. To move to the denominator you must use the down arrow key. For example, try the following keystrokes in the Equation Writer screen: CTDGDCSGDCD The result is the expression 5+24 kianEnaBglHEMBiBHBini The cursor is shown as a left-facing key. The cursor indicates the current edition location. Typing a character, function name, or operation will enter the corresponding character or characters in the cursor location. For example, for the cursor in the location indicated above, type now: The edited expression looks as follows: 5 |j.>41HII:MI:WrPI^J;TIJ;T4f.]i.^j:iJ Suppose that you want to replace the quantity between parentheses in the denominator (i.e., 5+1/3) with (5+7i2/2). First, we use the delete key (L4J) delete the current 1/3 expression, and then we replace that fraction with 7i2/2, as follows: CrDCD When we hit this point the screen looks as follows: 5+2 iaaaEnaBgiBaiiMHiHEBini In order to insert the denominator 2 in the expression, we need to highlight the entire n2 expression. We do this by pressing the right arrow key (CD ) once. At that point, we enter the following keystrokes: L+- JL 2 J Page 2-12 The expression now looks as follows: EffllEnaBglHEBBiBHBini Suppose that now you want to add the fraction 1/3 to this entire expression, i.e., you want to enter the expression: 5 1 7T2 3 5 + 2.(5 + — ) 2 First, we need to highlight the entire first term by using either the right arrow (CD) or the upper arrow (^N> ) keys, repeatedly, until the entire expression is highlighted, i.e., seven times, producing: NOTE: Alternatively, from the original position of the cursor (to the right of the 2 in the denominator of n2/2), we can use the keystroke combination C r> J(/^N) , interpreted as (LcD x ). Once the expression is highlighted as shown above, type CD CD CD CD to add the fraction 1/3. Resulting in: * 2 J '34 5+2 Showing the expression in smaller-size To show the expression in a smaller-size font (which could be useful if the expression is long and convoluted), simply press the liliiiiQD soft menu key. For this case, the screen looks as follows: Page 2-13 To recover the larger-font display, press the IIIiiiQD soft menu key once more. Evaluating the expression To evaluate the expression (or parts of the expression) within the Equation Writer, highlight the part that you want to evaluate and press the EEEOI fTP) soft menu key. For example, to evaluate the entire expression in this exercise, first, highlight the entire expression, by pressing CTQ ^ . Then, press the IlllJlillll C^~) soft menu key. If your calculator is set to Exact CAS mode (i.e., the _Approx CAS mode is not checked), then you will get the following symbolic result: If you want to recover the unevaluated expression at this time, use the function UNDO, i.e., CEtD JJndo (the first key in the third row of keys from the top of the keyboard). The recovered expression is shown highlighted as before: 5+2- 5+V If you want a floating-point (numerical) evaluation, use the ->NUM function (i.e., CS^SJ). The result is as follows: S1967616 Page 2-14 Use the function UNDO ( [j^Jundo ) once more to recover the original expression: Evaluating a sub-expression Suppose that you want to evaluate only the expression in parentheses in the denominator of the first fraction in the expression above. You have to use the arrow keys to select that particular sub-expression. Here is a way to do it: ^▼7 Highlights only the first fraction ^▼7 Highlights the numerator of the first fraction CD Highlights denominator of the first fraction ^▼7 Highlights first term in denominator of first fraction CD Highlights second term in denominator of first fraction <^3? Highlights first factor in second term in denominator of first fraction CD Highlights expression in parentheses in denominator of first fraction Since this is the sub-expression we want evaluated, we can now press the OEEfl (jl. soft menu key, resulting in: EaaEnaBgiBaiiMHiHEBini A symbolic evaluation once more. Suppose that, at this point, we want to evaluate the left-hand side fraction only. Press the upper arrow key (<^g^ ) three times to select that fraction, resulting in: Page 2-15 iaaaEnaBgiBaiiMHiHEBina Then, press the B!!I;I!!I C^) soft menu key to obtain: 5 4 2 TT +15 EaaEnaBgiBaiiMHiHEBini Let's try a numerical evaluation of this term at this point. Use L j *NUMs to obtain: HflllWIMIfrfrCl^llflHfflBHl Let's highlight the fraction to the right, and obtain a numerical evaluation of that term too, and show the sum of these two decimal values in small-font format by using:(T) (j^J ^num [IT) f we get: ^aaBnaBaBEaBiBEBini To highlight and evaluate the expression in the Equation Writer we use: ^> (jD / resulting in: Editing arithmetic expressions We will show some of the editing features in the Equation Writer as an exercise. We start by entering the following expression used in the previous exercises: 5 -a f £1 5+2- 5+^°- , 2 , H44iHN£ll4*EI4riai*HHfeH:il Page 2-16 And will use the editing features of the Equation Editor to transform it into the following expression: EaaEnaBgiBaiiMHiHEBini In the previous exercises we used the arrow keys to highlight sub-expressions for evaluation. In this case, we will use them to trigger a special editing cursor. After you have finished entering the original expression, the typing cursor (a left-pointing arrow) will be located to the right of the 3 in the denominator of the second fraction as shown here: 5 . 1 5+2- f 21 5 2 EanEnaBglHEBBiBHBini Press the down arrow key ) to trigger the clear editing cursor. The screen now looks like this: EffllEnaBglHEBBiBHBini By using the left arrow key (CD) you can move the cursor in the general left direction, but stopping at each individual component of the expression. For example, suppose that we will first will transform the expression n2/2 into the expression LNl^/S) . With the clear cursor active, as shown above, press the left-arrow key (CD) twice to highlight the 2 in the denominator of n2/2. Next, press the delete key (HU) once to change the cursor into the insertion cursor. Press L + J once more to delete the 2, and then L 3 j to enter a 3. At this point, the screen looks as follows: -4 5+2> 5+^ 34 J EBnBnaeaiiffliiMfliHHBHi Page 2-17 Next, press the down arrow key ) to trigger the clear editing cursor highlighting the 3 in the denominator of n2/3. Press the left arrow key ((3D) once to highlight the exponent 2 in the expression n2/3. Next, press the delete key (L4J) once to change the cursor into the insertion cursor. Press J once more to delete the 2, and then L 5 J to enter a 5. Press the upper arrow key three times to highlight the expression n5/3. Then, type L r> J m to apply the LN function to this expression. The screen now looks like this: 5 5+2- -* H4tiHII«l4frEII4rifll*MM£H:il ) within th e parentheses to a V2 by using these keystrokes : CT) CS CD CD CD Next, we highlight the entire expression in parentheses an insert the square root symbol by using: S+>^ fA^jix j Next, well convert the 2 in front of the parentheses in the denominator into a 2/3 by using: (S(3D^3^3^3(J3 At this point the expression looks as follows: EaaBnaBgnfflnMBiBEBini The final step is to remove the 1/3 in the right-hand side of the expression. This is accomplished by using: ^^^^^CDCSCSCSCSCS The final version will be: In summary, to edit an expression in the Equation Writer you should use the arrow keys (GO CD <^g^ ^7? ) to highlight expression to which functions will be applied (e.g., the LN and square root cases in the expression above). Use the Page 2-18 down arrow key (<\3?) in any location, repeatedly, to trigger the clear editing cursor. In this mode, use the left or right arrow keys (CD CD ) to move from term to term in an expression. When you reach a point that you need to edit, use the delete key (L4J) to trigger the insertion cursor and proceed with the edition of the expression. Creating algebraic expressions An algebraic expression is very similar to an arithmetic expression, except that English and Greek letters may be included. The process of creating an algebraic expression, therefore, follows the same idea as that of creating an arithmetic expression, except that use of the alphabetic keyboard is included. To illustrate the use of the Equation Writer to enter an algebraic equation we will use the following example. Suppose that we want to enter the expression: Use the following keystrokes: CZD C±D SO] CDCD CB (^)CS(S1C±D QD^_CB ^)CB(S CDCD CKD O— ^ (^GD(3 GD CD (^CB® CX3 C^CB© (^ED(3 CB (^CB<3 CZDCDC±DCZD This results in the output: EanEnaBglHEBBiBHBini In this example we used several lower-case English letters, e.g., x ((ALPHA}[^)(x})f several Greek letters, e.g., X (S™)CS(S1), and even a combination of Greek and English letters, namely, Ay ({alpha) [ r> J (c\ [alpha) l <n )(?) ). Keep in mind that to enter a lower-case English letter, you need to use the combination: [alpha)[j^J followed by the letter you want to enter. Also, you can always copy special characters by using the CHARS menu (I r> j chars ) if you don't want to memorize the keystroke combination that produces it. A listing of commonly used (alpha) jr> ) keystroke combinations was listed in an earlier section. Page 2-19 The expression tree The expression tree is a diagram showing how the Equation Writer interprets an expression. See Appendix E for a detailed example. The CURS function The CURS function (ililillllii!) in the Equation Writer menu (the CZD key) converts the display into a graphical display and produces a graphical cursor that can be controlled with the arrow keys (GO QD <\7? ) for selecting sub- expressions. The sub-expression selected with illEil! will be shown framed in the graphics display. After selecting a sub-expression you can press [enter] to show the selected sub-expression highlighted in the Equation writer. The following figures show different sub-expressions selected with and the ((y-3>x+5>(x2+4) fa-3>x+5)(x2+4) |SIHC4-x-2)| 5IHi:4.x-2:iBMWl EDIT | CURS SIN(4'X-2) >(,2+4) SIHC4-X-2) C(ij-3>x+5)(Bh) SIHC4-X-2) ((y-3>x+5)M+4) SIHC4-X-2) EDIT CURS RIG - E'.'HL FACTO SIHP Editing algebraic expressions The editing of algebraic equations follows the same rules as the editing of algebraic equations. Namely: • Use the arrow keys (CT) CD <^> ^3? ) to highlight expressions • Use the down arrow key (*\3? ), repeatedly, to trigger the clear editing cursor . In this mode, use the left or right arrow keys (ODCD ) to move from term to term in an expression. Page 2-20 • At an editing point, use the delete key (L4J) to trigger the insertion cursor and proceed with the edition of the expression. To see the clear editing cursor in action, let's start with the algebraic expression that we entered in the exercise above: 8 3* BaaEnaBgaBEaHiHEBini Press the down arrow key, ^3?, at its current location to trigger the clear editing cursor. The 3 in the exponent of 6^ will be highlighted. Use the left arrow key, (3D , to move from element to element in the expression. The order of selection of the clear editing cursor in this example is the following (press the left arrow key, CD, repeatedly): 1 . The 1 in the 1/3 exponent e Ay 2. 3. 4. 5. 6. 7. jli in the exponential function X 9. 3 in the V3 term 10. the 2 in the 2/V3 fraction At any point we can change the clear editing cursor into the insertion cursor by pressing the delete key (L4 J). Let's use these two cursors (the clear editing cursor and the insertion cursor) to change the current expression into the following: EaaEnaBgiBaiiMHiHEBini If you followed the exercise immediately above, you should have the clear editing cursor on the number 2 in the first factor in the expression. Follow these keystrokes to edit the expression: Page 2-21 CD l^^)LrLJL2j Enters the factorial for the 3 in the square root (entering the factorial changes the cursor to the selection cursor) ^3?*^? CD CD Selects the ju in the exponential function L±JLiJL2lJ^™JLilJ(3 Modifies exponential function argument CD CD CD CD Selects Ay l^LJ Places a square root symbol on Ay (this operation also changes the cursor to the selection cursor) ^P^PCD^^ (JnJ Select e1/3 and enter the SIN function The resulting screen is the following: SIH r r nTiinTEairmranirawraH™ Evaluating a sub-expression Since we already have the sub-expression SIN(0l/3^ highlighted, let's press IsiNtsje1)! mnnimmDnnnixniOBini Some algebraic expressions cannot be simplified anymore. Try the following keystrokes: <^>(2D • You will notice that nothing happens, other than the highlighting of the entire argument of the LN function. This is because this expression cannot be evaluated (or simplified) any more according to the CAS rules. Trying the keystrokes: {±^>CjD again does not produce any changes on the expression. Another sequence of ^A^fTT] keystrokes, however, modifies the expression as follows: BIG "| EYALlFflCToT^^ One more application of the (j^>(jD keystrokes produces more changes: Page 2-22 ■LH _i±_ - 3-P 1 This expression does not fit in the Equation Writer screen. We can see the entire expression by using a smaller-size font. Press the ElE C~^~~] soft menu key to get: ?>i_n M. EaaEnaBaBEaHiHEBini Even with the larger-size font, it is possible to navigate through the entire expression by using the clear editing cursor. Try the following keystroke sequence: QD ^3? ^3? ^3? ^3? , to set the clear editing cursor atop the factor 3 in the first term of the numerator. Then, press the right arrow key, CD , to navigate through the expression. Simplifying an expression Press the E33(jlD soft menu key to get the screen to look as in the previous figure (see above). Now, press the lliiillll (jD soft menu key, to see if it is possible to simplify this expression as it is shown in the Equation Writer. The result is the following screen: EffllBIiaMHMHBMlgBHHini This screen shows the argument of the SIN function, namely, \J~6 , LN{6) transformed into e 3 . This may not seem like a simplification, but it is in the sense that the cubic root function has been replaced by the inverse functions exp-LN. Page 2-23 Factoring an expression In this exercise we will try factoring a polynomial expression. To continue the previous exercise, press the (enter} key. Then, launch the Equation Writer again by pressing the IsD_eqw key. Type the equation: resulting in I 2 2 2 2 X +2-X-Y+Y -* +p Let's select the first 3 terms in the expression and attempt a factoring of this sub-expression: G^t^^s^CBCDCBCE) • This produces: baaEnaBgiBaiiMHiHEEina Now, press the EEBB soft menu key, to get ■^*iMiiMia<yci4irTi^mafcn:id Press Ij^Jundo to recover the original expression. Next, enter the following keystrokes: ^^^CD(J^CDCD(J^(J^C^ to select the last two terms in the expression, i.e., ^aaBnaBgiEEaaiBEBini press the llljllim soft menu key, to get x2+2-Y-x+v2Hffl=kljHia EanEnaBguaaHfliHHBini Press [JfJuNDo to recover the original expression. Now, let's select the entire expression by pressing the upper arrow key (<^g^ ) once. And press the !IIi!IIS!l soft menu key, to get Page 2-24 ;+y- Press L r> j UNDOs to recover the original expression. Note: Pressing the IDEE!! or the soft menu keys, while the entire original expression is selected, produces the following simplification of the expression: iron nn^iOTE iron mHHBna Using the CMDS menu key With the original polynomial expression used in the previous exercise still selected, press the [nxtJ key to show the illiliii and lEIHIIII soft menu keys. These two commands belong to the second part of the soft menu available with the Equation Writer. Let's try this example as an application of the iulill ABCUY HDDTHuD hDDTOREhL HL'jE: Next, select the command DERVX (the derivative with respect to the variable X, the current CAS independent variable) by using: ^™J(§]^3?^?^7 . Command DERVX will now be selected: DEF [ DEGREE i DEF; I'.' DESOLVE DIhGMhF- [ Press the IIE33II soft menu key (C^Q ), to get J, roget. Page 2-25 Next, press the jNxrj key to recover the original Equation Writer menu, and press the IIISE!!!!! soft menu key ((JL) ) to evaluate this derivative. The result is: Using the HELP menu Press the (W) key to show the BUS and lOHIill soft menu keys. Press the CUD soft menu key to get the list of CAS commands. Then, press {alpha} @ ^v? ^v? <\j? to select the command DERVX. Press the !!!!!:![!:!!!!! soft menu key (QD ), to get information on the command DERVX: Returns the deriuatiue with respect to the current variable dervx<ln<<x+i>/<x-i>>> See: DERIV IHTVX Detailed explanation on the use of the help facility for the CAS is presented in Chapter 1 . To return to the Equation Writer, press the IIES! soft menu key. Press the (enter} key to exit the Equation Writer. Using the editing functions BEGIN, END, COPY, CUT and PASTE To facilitate editing, whether with the Equation Writer or on the stack, the calculator provides five editing functions, BEGIN, END, COPY, CUT and PASTE, activated by combining the right-shift key (CB) with keys (2,1), (2,2), (3,1), (3,2), and (3,3), respectively. These keys are located in the leftmost part of rows 2 and 3. The action of these editing functions are as follows: BEGIN: marks the beginning of a string of characters for editing END: marks the ending of a string of characters for editing COPY: copies the string of characters selected by BEGIN and END CUT: cuts the string of characters selected by BEGIN and END PASTE: pastes a string of characters, previously copied or cut, into the current cursor position To see and example, lets start the Equation Writer and enter the following expression (used in an earlier exercise): Page 2-26 CD CD CDCD CD CD CD (^CED® CD OfL- CD SC3(§ CDCD CD CO— « (^™)CtD(3 CD CD CD C^CrD® CD C^)CD(3 CDCDS CD C™)CD(3 CDCDCOCD The original expression is the following: 8 3* BaaEnaBgaBEiMHiHEBini We want to remove the sub-expression x+2-X-Ay from the argument of the LN function, and move it to the right of the A in the first term. Here is one possibility: ^CDCSCS^^^CB^CDCSD^CXDCB^ The modified expression looks as follows: EanEnaBglHEBBiBHBini Next, we'll copy the fraction 2/ V3 from the leftmost factor in the expression, and place it in the numerator of the argument for the LN function. Try the following keystrokes: The resulting screen is as follows: The functions BEGIN and END are not necessary when operating in the Equation Writer, since we can select strings of characters by using the arrow keys. Functions BEGIN and END are more useful when editing an expression with the line editor. For example, let's select the expression x+2-A-Ay from this expression, but using the line editor within the Equation Writer, as follows: The line editor screen will look like this (quotes shown only if calculator in RPN mode): Page 2-27 EXP<-ui>*LN<2^J"3^eA<l^ aiHiHIHCC'Hll'Hgi'HlUjjU To select the sub-expression of interest, use: CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CDO^S The screen shows the required sub-expression highlighted: EXP < -pl > *bl VTTT^ T: < I We can now copy this expression and place it in the denominator of the LN argument, as follows:C?L}_^: CD CD ••• (27 times) ... CD C5DCS... (9 times) ... The line editor now looks like this: Pressing [flvraJ shows the expression in the Equation Writer (in small-font format, press the ISBQlD soft menu key): Press (enter} to exit the Equation Writer. Creating and editing summations, derivatives, and integrals Summations, derivatives, and integrals are commonly used for calculus, probability and statistics applications. In this section we show some examples of such operations created with the equation writer. Use ALG mode. Summations We will use the Equation Writer to enter the following summation: Page 2-28 Press C r> j eqw to activate the Equation Writer. Then press L r> J 5 to enter the summation sign. Notice that the sign, when entered into the Equation Writer screen, provides input locations for the index of the summation as well as for the quantity being summed. To fill these input locations, use the following keystrokes: ^pha] (k\ CD CD CD CD °°_ CD CD CD CD CD (3 CD CD The resultinq screen is: i * — ; 1 k=lk ^aaBnaBgiEEaaiBEBini To see the corresponding expression in the line editor, press C J</^N> and the CD soft menu key, to show: 2t!k = l?o> cimi™i™nra3 This expression shows the general form of a summation typed directly in the stack or line editor: H(index = starting_value, ending_value, summation expression) Press [enter) to return to the Equation Writer. The resulting screen shows the value of the summation, EanEnaBgiHEBBiBHBini To recover the unevaluated summation use [j^Jundo . To evaluate the summation again, you can use the CD soft menu key. This shows again that V — You can use the Equation Writer to prove that 00 = +CO . k=\ k This summation (representing an infinite series) is said to diverge. Double summations are also possible, for example: Page 2-29 1 n m j=lk=lJ ^■>41HII:MI:WrPI^J;TIJ;T4f.]i.^j:iJ Derivatives We will use the Equation Writer to enter the following derivative: — (a>t2+/3>t + S) dt Press L r> j eqw to activate the Equation Writer. Then press L r> J § to enter the (partial) derivative sign. Notice that the sign, when entered into the Equation Writer screen, provides input locations for the expression being differentiated and the variable of differentiation. To fill these input locations, use the following keystrokes: The resulting screen is the following: 6t laanEnaBgiHEBBiBHBini To see the corresponding expression in the line editor, press CB^} and the CjD soft menu key, to show: This indicates that the general expression for a derivative in the line editor or in the stack is: dvariable(function of variables) Press [enter] to return to the Equation Writer. The resulting screen is not the derivative we entered, however, but its symbolic value, namely, ffl-2-t+P EaaBnaBgnfflnMBiBEBini To recover the derivative expression use L r> J UNDOs . To evaluate the derivative again, you can use the (JL) soft menu key. This shows again that Page 2-30 — (a-t2 -j3-t + S) = 2a-t + J3 dt Second order derivatives are possible, for example: 4^) which evaluates to: EffllEnaBglHEnBiBHBini d Note: The notation — ( ) is proper of partial derivatives. The proper dx notation for total derivatives (i.e., derivatives of one variable) is — ( ). The dx calculator, however, does not distinguish between partial and total derivatives. Definite integrals We will use the Equation Writer to enter the following definite integral: j t • sin(7) • dt . Press (JfJ_EQw to activate the Equation Writer. Then press IsD { to enter the integral sign. Notice that the sign, when entered into the Equation Writer screen, provides input locations for the limits of integration, the integrand, and the variable of integration. To fill these input locations, use the following keystrokes:CECK)(d^CB(SlCD(^^ C3D t-SIN(t)dt 0 To see the corresponding expression in the line editor, press <^^<^^ and the (jD soft menu key, to show: Page 2-31 JX0,T,t*SIN<t>,t> This indicates that the general expression for a derivative in the line editor or in the stack is: l(lower_limit, upper Jimit/integrand,variable_of_integration) Press [enter] to return to the Equation Writer. The resulting screen is not the definite integral we entered, however, but its symbolic value, namely, EaaEnaBgiBaiiMHiHEBini To recover the derivative expression use L r> J UNDOs . To evaluate the derivative again, you can use the GD soft menu key. This shows again that Jo t • sin(7) • dt = sin(r) - r • cos(r) Double integrals are also possible. For example, (x+y)dy dx4 -3 -x laaaBnaBgiEEaaiBEBini which evaluates to 36. Partial evaluation is possible, for example: (x+y)dy ^3 Hdx -3 H44iHN£ll4*EI4riai*HHfeH:il This integral evaluates to 36. Organizing data in the calculator You can organize data in your calculator by storing variables in a directory tree. To understand the calculator's memory, we first take a look at the file directory. Press the keystroke combination [j^Jfiles_ (fjrst key in second row of keys from the top of the keyboard) to get the calculator's File Manager screen: Page 2-32 This screen gives a snapshot of the calculator's memory and of the directory tree. The screen shows that the calculator has three memory ports (or memory partitions), port 0:IRAM, port 1 :ERAM, and port 2:FLASH . Memory ports are used to store third party application or libraries, as well as for backups. The size of the three different ports is also indicated. The fourth and subsequent lines in this screen show the calculator's directory tree. The top directory (currently highlighted) is the Home directory, and it has predefined into it a sub-directory called CASDIR. The File Manager screen has three functions associated with the soft-menu keys: HEH3 (GD )• Change to selected directory BBSS (CZD )' Cancel action MM (CjD V- Approve a selection For example, to change directory to the CASDIR, press the down-arrow key, ^▼7 , and press EEEH3 (CZD )• This action closes the File Manager window and returns us to normal calculator display. You will notice that the second line from the top in the display now starts with the characters { HOME CASDIR } indicating that the current directory is CASDIR within the HOME directory. Functions for manipulation of variables This screen includes 20 commands associated with the soft menu keys that can be used to create, edit, and manipulate variables. The first six functions are the following: To edit a highlighted variable To copy a highlighted variable To move a highlighted variable To recall the contents of a highlighted variable To evaluate a highlighted variable To see the directory tree where the variable is contained If you press the [nxt) key, the next set of functions is made available: To purge, or delete, a variable Page 2-33 SIi!!!i!!Ii To rename a variable To create a new variable To order a set of variables in the directory To send a variable to another calculator or computer To receive a variable from another calculator or computer If you press the jNxrj key, the third set of functions is made available: To return to the stack temporarily To see contents of a variable GjEEO To edit contents of a binary variable (similar to llillii) 11113333 To show the directory containing the variable in the header Provides a list of variable names and description To sort variables according to a sorting criteria If you press the [nxt) key, the last set of functions is made available: To send variable with X-modem protocol 1311111:1 To change directory To move between the different soft menu commands, you can use not only the NEXT key (® ), but also the PREV key (C5D^ ). The user is invited to try these functions on his or her own. Their applications are straightforward. The HOME directory The HOME directory, as pointed out earlier, is the base directory for memory operation for the calculator. To get to the HOME directory, you can press the UPDIR function (f Jnj upm ) -- repeat as needed -- until the i HOME:} spec is shown in the second line of the display header. Alternatively, you can use C3D(hold) t™_ , press (enter} if in the algebraic mode. For this example, the HOME directory contains nothing but the CASDIR. Pressing Q^D will show the variables in the soft menu keys: Subdirectories To store your data in a well organized directory tree you may want to create subdirectories under the HOME directory, and more subdirectories within Page 2-34 subdirectories, in a hierarchy of directories similar to folders in modern computers. The subdirectories will be given names that may reflect the contents of each subdirectory, or any arbitrary name that you can think of. The CASDIR sub-directory The CASDIR sub-directory contains a number of variables needed by the proper operation of the CAS (Computer Algebraic System, see appendix C). To see the contents of the directory, we can use the keystroke combination: (jT]fl££5_ which opens the File Manager once more: This time the CASDIR is highlighted in the screen. To see the contents of the directory press the IIIEOII (f^O ) soft menu key or (enter), to get the following screen : mm \R HODULO inTG E { ]F;EhLhl"l"UME LIST 2? EffPERIOD RLG 12 naHYK GlmHE H \R EPS REAL 10 The screen shows a table describing the variables contained in the CASDIR directory. These are variables pre-defined in the calculator memory that establish certain parameters for CAS operation (see appendix C). The table above contains 4 columns: • The first column indicate the type of variable (e.g., 'EG)' means an equation-type variable, | R indicates a real-value variable, { } means a list, nam means 'a global name', and the symbol represents a graphic variable. • The second column represents the name of the variables, i.e., PRIMIT, CASINFO, MODULO, REALASSUME, PERIOD, VX, and EPS. • Column number 3 shows another specification for the variable type, e.g., ALG means an algebraic expression, GROB stands for graphics object, INTG means an integer numeric variable, LIST means a list of data, Page 2-35 GNAME means a global name, and REAL means a real (or floating-point) numeric variable. • The fourth and last column represents the size, in bytes, of the variable truncated, without decimals (i.e., nibbles). Thus, for example, variable PERIOD takes 12.5 bytes, while variable REALASSUME takes 27.5 bytes (1 byte = 8 bits, 1 bit is the smallest unit of memory in computers and calculators). CASDIR Variables in the stack Pressing the jQN J key closes the previous screen and returns us to normal calculator display. By default, we get back the TOOL menu: We can see the variables contained in the current directory, CASDIR, by pressing the G^D key (first key in the second row from the top of the keyboard). This produces the following screen: Pressing the jNxrj key shows one more variable stored in this directory: • To see the contents of the variable EPS, for example, use LiUB33l. This shows the value of EPS to be . 0000000001 • To see the value of a numerical variable, we need to press only the soft menu key for the variable. For example, pressing 93 followed by [enter] f shows the same value of the variable in the stack, if the calculator is set to Algebraic. If the calculator is set to RPN mode, you need only press the soft menu key for (enter) . • To see the full name of a variable, press the apostrophe first L 1 J, and then the soft menu key corresponding to the variable. For example, for the variable listed in the stack as PERIO, we use: Ljjlilililli, which produces as output the string: 5 PERIOD 5 . This procedure applies to both the Algebraic and RPN calculator operating modes. Variables in CASDIR The default variables contained in the CASDIR directory are the following: PRIMIT Latest primitive (anti-derivative) calculated, not a default Page 2-36 variable, but one created by a previous exercise CASINFO a graph that provides CAS information MODULO Modulo for modular arithmetic (default = 1 3) REALASSUME List of variable names assumed as real values PERIOD Period for trigonometric functions (default = 2n) VX Name of default independent variable (default = X) EPS Value of small increment (epsilon), (default = 10"10) These variables are used for the operation of the CAS. Typing directory and variable names To name subdirectories, and sometimes, variables, you will have to type strings of letters at once, which may or may not be combined with numbers. Rather than pressing the {alpha} f [alpha}[j^J/ or [alpha)[j^J key combinations to type each letter, you can hold down the {alpha} key and enter the various letter. You can also lock the alphabetic keyboard temporarily and enter a full name before unlocking it again. The following combinations of keystrokes will lock the alphabetic keyboard: [alpha} [alpha} locks the alphabetic keyboard in upper case. When locked in this fashion, pressing the LjnJ before a letter key produces a lower case letter, while pressing the LjU key before a letter key produces a special character. If the alphabetic keyboard is already locked in upper case, to lock it in lower case, type, {^J(alpha) [alpha] [alpha] I <i } (alpha) locks the alphabetic keyboard in lower case. When locked in this fashion, pressing the LjnJ before a letter key produces an upper case letter. To unlock lower case, press {^J(alpha) To unlock the upper-case locked keyboard, press [alpha] Let's try some exercises typing directory/ variable names in the stack. Assuming that the calculator is in the Algebraic mode of operation (although the instructions work as well in RPN mode), try the following keystroke sequences. With these commands we will be typing the words 'MATH', 'Math', and 'MatH' Page 2-37 [ ■ )[alpha][alpha](m\(a] (fj (h\ [enter] The calculator display will show the following (left-hand side is Algebraic mode, right-hand side is RPN mode): 'MATH1 'Math' 'MatH' £: MATH 5= 4: MatH 3: MatH 1 MATH 1 'Math' 'MatH' Note: if system flag 60 is set, you can lock the alphabetical keyboard by just pressing {alpha}. See Chapter 1 for more information on system flags. Creating subdirectories Subdirectories can be created by using the FILES environment or by using the command CRDIR. The two approaches for creating sub-directories are presented next. Using the FILES menu Regardless of the mode of operation of the calculator (Algebraic or RPN), we can create a directory tree, based on the HOME directory, by using the functions activated in the FILES menu. Press [j^Jfiles_ to activate the FILES menu. If the HOME directory is not already highlighted in the screen, i.e., 1:IF;hM L : ERflH 3 : FLASH 5 File Hanger 3 LCflSDIR use the up and down arrow keys ((^aN)<^7 ) to highlight it. Then, press the EDI! (C™~) ) soft menu key. The screen may look like this: HiHOfj: 3HHH53 I gg^oH" EDIT | COPY | HOVE | RCL | E'.'HL | TREE Page 2-38 showing that only one object exists currently in the HOME directory, namely, the CASDIR sub-directory. Let's create another sub-directory called MANS (for MANualS) where we will store variables developed as exercises in this manual. To create this sub-directory first enter: [nxtJ ((""^H ) . This will produce the following input form: [■bject = "MH-Z: _ Directory Enter \\m Object The Object input field, the first input field in the form, is highlighted by default. This input field can hold the contents of a new variable that is being created. Since we have no contents for the new sub-directory at this point, we simply skip this input field by pressing the down-arrow key, <s3?/ once. The Name input field is now highlighted: ^ VfifilfiELE §§§§§§§§§§§§§§§§§§§ Object = _ Directory Enter variable naHe This is where we enter the name of the new sub-directory (or variable, as the case may be), as follows: {^m\{^m\(^\®^\(s}{m^ The cursor moves to the _Directory check field. Press the iKSIOl ((JL) ) soft menu key to specify that you are creating a directory, and press I31III to exit the input form. The variable listing for the HOME directory will be shown in the screen as follows: -ffeHory: 3HH5ii I Select: The screen indicates that there is a new directory (MANS) within the HOME directory. Page 2-39 Next, we will create a sub-directory named INTRO (for INTROduction), within MANS, to hold variables created as exercise in subsequent sections of this chapter. Press the (jwj key to return to normal calculator display (the TOOLS menu will be shown). Then, press L^iJ to show the HOME directory contents in the soft menu key labels. The display may look like this (if you have created other variables in the HOME directory they will show in the soft menu key labels too): To move into the MANS directory, press the corresponding soft menu key (C2lD m this case), and [enter] if in algebraic mode. The directory tree will be shown in the second line of the display as i MflHS} . However, there will be no labels associated with the soft menu keys, as shown below, because there are no variables defined within this directory. Let's create the sub-directory INTRO by using: CjT] FILE^_ Mm {wo) 101 ^T? {ALPHA} {ALPHA} Q(n\(t](r\(o\ (ENTER) ; ] Tjjjjj MM Press the (jwj key, followed by the IjwJ key, to see the contents of the MANS directory as follows: Press the EEEEH soft menu key to move into the INTRO sub-directory. This will show an empty sub-directory. Later on, we will do some exercises in creating variables. Using the command CRDIR The command CRDIR can be used to create directories. This command is available through the command catalog key (the CgJ_c^ key, second key in fourth row of keys from the top of the keyboard), through the programming menus (the C5D^— key, same key as the Lr±J_^z; key), or by simply typing it. • Through the catalog key Press C3_cAr {Aumj© . Use the up and down arrow keys (fA^^r?) to locate the CRDIR command. Press the IIIEII1 soft menu key to activate the command. • Through the programming menus Press CSD5?G_ . This will produce the following pull-down menu for programming: Page 2-40 PROG HERU a . HEHOR v.. |! 3 . BRRRCH.. H . TEST.. 5. TYPE.. 6. LIST.. 1 Use the down arrow key (<\3?) to select the option 2. MEMORY... , or just press L2J • Then, press I!!!!! !!!!!. This will produce thef menu: HEHORY HERD 2. HEH * { 3 . BYTES H.REHOE 1 5. DIRECTORY.. e.RRITHHETIC. Use the down arrow key (<\3?) to select the 5. DIRECTORY option, or just press l_5J • Then, press 131!!!. This will produce the following pull-down menu: DIRECTORY HERU 2 . RCL I 3.ST0 H.PRTH S . CRDIR C.PGDIR l Use the down arrow key (<^3?) to select the 5. CRDIR option, and press Command CRDIR in Algebraic mode Once you have selected the CRDIR through one of the means shown above, the command will be available in your stack as follows: CRDIRO At this point, you need to type a directory name, say chop! : [alpha] [alpha] I <i j [alpha) g) (h\ (3 (pjj I ) {alpha) [enter] The name of the new directory will be shown in the soft menu keys, e.g., p LKUlKL'chapl'J 1 HOVflL Page 2-41 Command CRDIR in RPN mode To use the CRDIR in RPN mode you need to have the name of the directory already available in the stack before accessing the command. For example: [alpha) [alpha) [ <i j [alpha) g) (Rj (a] (p) I 2 ) [alpha) [enter) Then access the CRDIR command by either of the means shown above, e.g., through the Lr>J cat key: 7: &: 5: 4: 3: £: l: CATALOG : F63 COHHftnDS C R OS " fc^-^-OTT! CSHP CURL CVCLOTOHIC CVLin p2' Press the IliEII soft menu key to activate the command, to create the sub- directory: Moving among subdirectories To move down the directory tree, you need to press the soft menu key corresponding to the sub-directory you want to move to. The list of variables in a sub-directory can be produced by pressing the G^D (VARiables) key. To move up in the directory tree, use the function UPDIR, i.e., enter LjnJ^™- • Alternatively, you can use the FILES menu, i.e., press l<n j files m Use the up and down arrow keys (^^^7 ) to select the sub-directory you want to move to, and then press the I3II1I:! (CHange DIRectory) orCZD soft menu key. This will show the contents of the sub-directory you moved to in the soft menu key labels. Deleting subdirectories To delete a sub-directory, use one of the following procedures: Using the FILES menu Press the l<n )F,ILES key to trigger the FILES menu. Select the directory containing the sub-directory you want to delete, and press the Elllllli!! if needed. This will close the FILES menu and display the contents of the directory you selected. In this case you will need to press [enter) . Press the I31III soft menu Page 2-42 key to list the contents of the directory in the screen. Select the sub-directory (or variable) that you want to delete. Press (j^IQMSI. A screen similar to the following will be shown: ■S2" Are You Sure? The 'S2' string in this form is the name of the sub-directory that is being deleted. The soft menu keys provide the following options: (CjD ) Proceed with deleting the sub-directory (or variable) (GD ) Proceed with deleting all sub-directories (or variables) EEI333 (CZD ) Do not delete sub-directory (or variable) from a list (CfL) ) Do not delete sub-directory (or variable) After selecting one of these four commands, you will be returned to the screen listing the contents of the sub-directory. The \SMM command, however, will show an error message: A Interrupted and you will have to press lillli, before returning to the variable listing. Using the command PGDIR The command PGDIR can be used to purge directories. Like the command CRDIR, the PGDIR command is available through the (j^J_cat or through the L*i )P,RG key, or it can simply be typed in. • Through the catalog key Press CgJ_^i; (alpha} {alpha} (p](gJ . This should highlight the PGDIR command. Press the liill!!! soft menu key to activate the command. • Through the programming menus Press (jnJPRG_ • This will produce the following pull-down menu for programming: Page 2-43 PROG HERU 3.HEH0RY.. ! ?■ . BRRRCH.. H . TEST.. 5 . TYPE.. 6. LIST.. L Use the down arrow key ) to select the option 2. MEMORY... Then, press 139 . This will produce the following pull-down menu: HEHORY HERU 2. MEM 3. BYTES H.REHOP- 5. DIRECTORY.. e.ARITHHETIC. Use the down arrow key to select the 5. DIRECTORY option. Then, press 199. This will produce the following pull-down menu: DIRECTORY HERU a.RCL 3.ST0 H.PRTH 5 . CRDIR 6. PGDIR Use the down arrow key (<\3?) to select the 6. PGDIR option, and press Command PGDIR in Algebraic mode Once you have selected the PGDIR through one of the means shown above, the command will be available in your stack as follows: :,GDIRO ^ At this point, you need to type the name of an existing directory, say S4 : [alpha} {s} C4~3 [enter] As a result, sub-directory llllll is deleted: PGDIRCS41) HOVflL Instead of typing the name of the directory, you can simply press the corresponding soft menu key at the listing of the PGDIR( ) command, e.g., Page 2-44 CATALOG : F63 COHHflnDS PERH PEVflL PICK PICKS PICT Vfll Press iiiiiliEliiiiii, to get: PGDIRCS4') PGDIRO HOVflL Then, press lil! to enter 'S3' as the argument to PGP :PGDIRCS4') HOVflL PGDIRCS34 R. Press Icnter) to delete the sub-directory: :PGDIRC'S4') HOVflL :PGDIRC'S3') HOVflL Command PGDIR in RPN mode To use the PGDIR in RPN mode you need to have the name of the directory, between quotes, already available in the stack before accessing the command. For example: CZDS^tHCZDQw^ Then access the PGDIR command by either of the means shown above, e.g., directory: &: 5: CATALOG : F63 COHHflnDS PERH PEVflL 4: 3: £: l: PICK PICKS PICT R? 1 <ey to activate the command c Page 2-45 Using the PURGE command from the TOOL menu The TOOL menu is available by pressing the Itqql J key (Algebraic and RPN modes shown): EDIT VIEH Il'ThlKI RCL PURGE CLEAR EDIT VIEH STACK RCL PURGE CLEAR The PURGE command is available by pressing the DQ333 soft menu key In the following examples we want to delete sub-directory SI: • Algebraic mode: Enter 03333 [W^mM^m) • RPN mode: Enter CWT nniliilll (enter) M n^ff^rW) :czd). Variables Variables are like files on a computer hard drive. One variable can store one object (numerical values, algebraic expressions, lists, vectors, matrices, programs, etc). Even sub-directories can be through of as variables (in fact, in the calculator, a subdirectory is also a type of calculator object). Variables are referred to by their names, which can be any combination of alphabetic and numerical characters, starting with a letter (either English or Greek). Some non-alphabetic characters, such as the arrow (-^) can be used in a variable name, if combined with an alphabetical character. Thus, '-»A' is a valid variable name, but '— »' is not. Valid examples of variable names are: 'A', 'B', 'a', 'b', 'a', 'p', 'AT, 'AB12', '->A1 2,/Vel,/Z0,,,zl,/ etc. A variable can not have the same name than a function of the calculator. You can not have a SIN variable for example as there is a SIN command in the calculator. The reserved calculator variable names are the following: ALRMDAT, CST, EQ, EXPR, I ERR, IOPAR, MAXR, MINR, PICT, PPAR, PRTPAR, VPAR, ZPAR, der_, e, i, nl ,n2, si , s2, ZDAT, ZPAR, n, oo Variables can be organized into sub-directories. Creating variables To create a variable, we can use the FILES menu, along the lines of the examples shown above for creating a sub-directory. For example, within the Page 2-46 sub-directory i HOME MM MS INTRO}, created in an earlier example, we want to store the following variables with the values shown: Name Contents Type A 12.5 real a -0.25 real A12 3xl05 real Q V(m+r)' algebraic R [3,2,1] vector zl 3+5i complex Pi « -> r '7i*rA2' » program Using the FILES menu We will use the FILES menu to enter the variable A. We assume that we are in the sub-directory { HOME MANS INTRO} . To get to this sub-directory, use the following: [j^Jfiles_ and select the INTRO sub-directory as shown in this screen: 1:IF;hM L : ERliM 355KB 2: FLASH hHflnS L!iiltli|] krtSDIR Press 113111 to enter the directory. You will get a files listing with no entries (the INTRO sub-directory is empty at this point) [UgHory: 3HH653 I S«Uct: fl rio Entries EDIT COPY HOVE RCL E'.'HL TREE Press the [nxtJ key to move to the next set of soft menu keys, and press the I0III soft menu key. This will produce the NEW VARIABLE input form: _ Directory Enter ncu Object Page 2-47 To enter variable A (see table above), we first enter its contents, namely, the number 1 2.5, and then its name, A, as follows: U_JLlJLiJL5j mm (ALP^)(A]mm. Resultinginjjie following screen HEW YftRIftELE»W«^ &bj«t: 12.5 "l']Hs:: fl Directory Create a ncH directory? Press Iliiilonce more to create the variable. The new variable is shown in the following variable listing: The listing indicates a real variable (|R), whose name is A, and that occupies 1 0.5 bytes of memory. To see the contents of the variable in this screen, press (WlBEHI. • Press the Ellilll! (CjQ ) soft menu key to see the contents in a graphical format. 1275 • Press the ESED (CjD ) soft menu key to see the contents in text format. • Press 199 to return to the variable list • Press tjwj once more to return to normal display. Variable A should now be featured in the soft menu key labels: Using the STO ► command A simpler way to create a variable is by using the STO command (i.e., the [sto>) key). We provide examples in both the Algebraic and RPN modes, by creating the remaining of the variables suggested above, namely: Page 2-48 Name Contents Type a -0.25 real A12 3xl05 real Q V(m+r)' algebraic R [3,2,1] vector zl 3+5i complex pl « -> r '7i*rA2' » program • Algebraic mode Use the following keystrokes to store the value of -0.25 into variable a: CBCUCBCSC^ C^3 (^CrDffl . AT this point, the screen will look as follows: This expression means that the value -0.25 is being stored into a (the symbol ► suggests the operation). Press [enter) to create the variable. The variable is now shown in the soft menu key labels: The following are the keystrokes required to enter the remaining variables: A12: CEC^CSC^SSCTJCE^ Q: CDeosSOlL- 5^QD(SCSS^QI)(3CE)CD S^t^Dg] (enter} R: QD{Z CTDCB 'CDCB 'CDCD (^{^(S (enter) zl: CBCBCSCKDCS; (^{^(^(S(jJ(ente^ (if needed, accept change to Complex mode) pl: CB^CS^SEDSCZDED^S The screen, at this point, will look as follows: m+r :[3 2 1»R C3 2 1] :3+5-ifrzl 3+5- i : # ■+ r 1 TT*r^2' 3>Pl Page 2-49 You will see six of the seven variables listed at the bottom of the screen: p7, zl, R, Q, A12, a. • RPNmode Use the following keystrokes to store the value of -0.25 into variable a: QDCZ^CBCSCDt^ (^CBSQwra). At this point, the screen will look as follows: £: -.25 l: 1 o: 1 This expression means that the value -0.25 is ready to be stored into a. Press jsroy J to create the variable. The variable is now shown in the soft menu key labels: To enter the value 3x1 05 into Al 2, we can use a shorter version of the procedure: CBC^CSCZJt^fflCDCII]^) Here is a way to enter the contents of Q: Q: CDeOSSSlL- To enter the value of R, we can use an even shorter version of the procedure: Notice that to separate the elements of a vector in RPN mode we can use the space key (jspc J ), rather than the comma (LiU » ) used above in Algebraic mode. zl:CDQD(SCXD(SCSD^— CD^JEDSCD SI (if needed, accept change to Complex mode) pi: CS^CS^SCTSCZDED^CxD The screen, at this point, will look as follows: You will see six of the seven variables listed at the bottom of the screen: p7, z7, R, Q, A12, a. Page 2-50 Checking variables contents As an exercise on peeking into the contents of variables we will use the seven variables entered in the exercise above. We showed how to use the FILES menu to view the contents of a variable in an earlier exercise when we created the variable A. In this section we will show a simple way to look into the contents of a variable. Pressing the soft menu key label for the variable This procedure will show the contents of a variable as long as the variable contains a numerical value or an algebraic value, or an array. For example, for the variables listed above, press the following keys to see the contents of the variables: Algebraic mode Type these keystrokes: [^rJMM(enter) jjjjjj m [enter) (enter) . At this point, the screen looks as follows: = Z1 3+5- i :R C3 2 1] :Q r m+r Next, type these keystrokes: ElE3I(^) ^M(enter) [nxtJ mm (enter) . At this point, the screen looks as follows: A. m+r :fll2 300000. -.25 12.5 Pressing the soft menu key corresponding to pi will provide an error message (try (nxt] lllllll [enter) ) ; :fl 300000. A ■* Error: Too Few Arguments .25 2.5 = pl "Too Few Argument s" Page 2-51 Note: By pressing (enter) we are trying to activate (run) the pi program. However, this program expects a numerical input. Try the following exercise: ®B!E][i ^JJ(enter) . The result is: :plC5) TT-25 The program has the following structure: « r '7i*rA2' » The ■£ & symbols indicate a program in User RPL language (the original programming language of the HP 28/48 calculators, and available in the HP 49G series). The characters -> r indicate that an input, to be referred to as r, is to be provided to the program. The action from the program is to take that value of r and evaluate the algebraic '7i*rA2'. In the example shown above, r took the value of 5, and thus the value of 7ir2 = 7i-25 is returned. This program, therefore, calculates the area of a circle given its radius r. RPNmode In RPN mode, you only need to press the corresponding soft menu key label to get the contents of a numerical or algebraic variable. For the case under consideration, we can try peeking into the variables z7, /?, Q, A 7 2, a, and A, created above, as follows: L m J BUI BUS 311 11815- §111 IKIES 11111 At this point, the screen ooks like this: b = 5: 3+5- i 4: C3 2 1] 3: r m+r £: 300000. l: -.25 To see the contents of A, use: jNxrj j To run program pi with r = 5, use: Ij^JLiJ P^ri b = Id ^ 1J 5: r m+r 4: 300000. 3: -.25 2: 12.5 l: TT-25 Notice that to run the program in RPN mode, you only need to enter the input (5) and press the corresponding soft menu key. (In algebraic mode, you need to place parentheses to enter the argument). Page 2-52 Using the right-shift key C3 followed by soft menu key labels This approach for viewing the contents of a variable works the same in both Algebraic and RPN modes. Try the following examples in either mode: [j^J [j-M ill!! CxD !!!!!::!!.!!!!!! Lr^J llill ( rMlllffl (xLJ llIEJEli This produces the following screen (Algebraic mode in the left, RPN in the right) b = * ■* r ,TT*r^2' s- 5: * + r ,TT*r^2' » 3+5- i 4: 3+5- i C3 2 1] 3: C3 2 1] r 2- r m+r m+r 30080S. l: 300000. Notice that this time the contents of program pi are listed in the screen. To see the remaining variables in this directory, use: IIS (W) C3 111 Listing the contents of all variables in the screen Use the keystroke combination L r> J^or? to list the contents of all variables in the screen. For example: * + r 'TT*r^2. zl: <3.i5-> R: [3.?2.?1.] R12: 300000. ot ■ -.25 Press jQN J to return to normal calculator display. Replacing the contents of variables Replacing the contents of a variable can be thought of as storing a different value in the same variable name. Thus, the examples for creating variables shown above can be used to illustrate the replacement of a variable's content. Using the STO^ command Using as illustration the six variables, pi, zl, R, Q, Al 2, a, and A, created earlier, we will proceed to change the contents of variable A12 (currently a numerical variable) with the algebraic expression 'p/2', using the STO^ command. First, using the Algebraic operating mode: CDt^CS^GDCDCE) d™D mEm [enter] Page 2-53 Check the new contents of variable A 72 by using L r> J II Using the RPN operating mode: CD^^CS(SC±JCID(^} CD^Sm (enter) (sW) or, in a simplified way, Using the left-shift C3D key followed by the variable's soft menu key (RPN) This is a very simple way to change the contents of a variable, but it only works in the RPN mode. The procedure consists in typing the new contents of the variable and entering them into the stack, and then pressing the left-shift key followed by the variable's soft menu key. For example, in RPN, if we want to change the contents of variable z7 to 'a+b-\ ', use: This will place the algebraic expression 'a+b-'i ' in level 7: in the stack. To enter this result into variable z7, use: L m J L 5 J IBll To check the new contents of z 7, use: L r> J IIIIIIIB An equivalent way to do this in Algebraic mode is the following: [jT] ® C+J GD CXD C5D ; (^D CZ^t) (^D To check the new contents of z7, use: L r> J llllllllllllllllll Using the ANS(l) variable (Algebraic mode) In Algebraic mode one can use the ANS(1 ) variable to replace the contents of a variable. For example, the procedure for changing the contents of z7 to 'a+b\' is the following: {^Jans_ fjroT) 111 [enter] . To check the new contents of z7, use: Ll?J IE™ Copying variables The following exercises show different ways of copying variables from one sub-directory to another. Using the FILES menu To copy a variable from one directory to another you can use the FILES menu. For example, within the sub-directory {HOME MANS INTRO}, we have Page 2-54 variables p7, zl , R, Q, AT 2, a, and A. Suppose that we want to copy variable A and place a copy in sub-directory {HOME MANS}. Also, we will copy variable R and place a copy in the HOME directory. Here is how to do it: Press CZD5^_ JEM to produce the following list of variables: rffgHorn: 31533 I Select: fl I Use the down-arrow key ^3? to select variable A (the last in the list), then press The calculator will respond with a screen labeled PICK DESTINATION: MRhH L : ERflH 2: FLASH \nnws L!iltii!] kflSDIR PICK DESTinATIOn 2 5 5 HE: 31GKG Use the up arrow key to select the sub-directory MANS and press BIS. If you now press l<n jf™ , the screen will show the contents of sub-directory MANS (notice that variable A is shown in this list, as expected): Press C^D Hlllffl (^(Algebraic mode), or Q^D IliMilli (RPN mode) to return to the INTRO directory. Press CZD^L_ BIB to produce the list of variables in {HOME MANS INTRO}. Use the down arrow key (^7 ) to select variable R, then press Eillillilll. Use the up arrow key (<^aN> ) to select the HOME directory, and press BIB. If you now press LjnJ^™- , twice, the screen will show the contents of the HOME directory, including a copy of variable R: □CflSDIR DIR 3H5 EDIT COPY HOVE RCL E'.'HL TREE Page 2-55 Using the history in Algebraic mode Here is a way to use the history (stack) to copy a variable from one directory to another with the calculator set to the Algebraic mode. Suppose that we are within the sub-directory {HOME MANS INTRO}, and want to copy the contents of variable zl to sub-directory {HOME MANS}. Use the following procedure: LrLJ BKiro^J B3It^?J This simply stores the contents of z? into itself (no change effected on zl). Next, use {j^Jupdr_ [enter) to move to the a+i-b :flNS(l)*zl a+i-b :UPDIR HOVflL Next, use the delete key three times, to remove the last three lines in the display: (3D L*J L*J • At this point, the stack is ready to execute the command ANS(1 )^zl . Press (enter) to execute this command. Then, use L r> j El, to verify the contents of the variable. Using the stack in RPN mode To demonstrate the use of the stack in RPN mode to copy a variable from one sub-directory to another, we assume you are within sub-directory {HOME MANS INTRO}, and that we will copy the contents of variable zl into the HOME directory. Use the following procedure:CfQi3 This procedure lists the contents and the name of the variable in the stack. The calculator screen will look like this: 2: a+i-b l: 'zl' Now, use (jT]l™_ (jT]l™_ to move to the HOME directory, and press C^T) to complete the operation. Use LrLJ E!I, to verify the contents of the variable. Copying two or more variables using the stack in Algebraic mode The following is an exercise to demonstrate how to copy two or more variables using the stack when the calculator is in Algebraic mode. Suppose, once more, that we are within sub-directory {HOME MANS INTRO} and that we want to copy the variables R and Q into sub-directory {HOME MANS}. The keystrokes necessary to complete this operation are shown following: Page 2-56 ( s \ see; ===:====== rr^r\ =======1====== t rk ,Trn^ Lr^ J iiii If^J KS [ENTER) QD™ (flVTER) 3D SH3D(^ 3D (3D (3D (3D To verify the contents of the variables, use U^JIIIII and LxDlB. This procedure can be generalized to the copying of three or more variables. Copying two or more variables using the stack in RPN mode The following is an exercise to demonstrate how to copy two or more variables using the stack when the calculator is in RPN mode. We assume, again, that we are within sub-directory {HOME MANS INTRO} and that we want to copy the variables R and Q into sub-directory {HOME MANS}. The keystrokes necessary to complete this operation are shown following: C3 1 HIS CLD ■IS f v 1 :::: iiviiiii I \ :::E:EvE:E:E ( rklTrn\ Lj^J iiii iiviiiii L_LJ iiiiii=I=iiiii l^^J To verify the contents of the variables, use L r» JIEI and LiUlE. This procedure can be generalized to the copying of three or more variables. Reordering variables in a directory In this section we illustrate the use of the ORDER command to reorder the variables in a directory. We assume we start within the sub-directory {HOME MANS} containing the variables, A 7 2, R, Q, z7, A, and the sub-directory INTRO, as shown below (Copy A1 2 from INTRO into MANS). Algebraic mode In this case, we have the calculator set to Algebraic mode. Suppose that we want to change the order of the variables to INTRO, A, z7, Q, R, A12. Proceed as follows to activate the ORDER function: UiJ prg_ <^r?IEI]jIli Select MEMORY from the programming menu ^P^P^P^P ill!! Select DIRECTORY from the MEMORY menu MM Select ORDER from the DIRECTORY menu The screen will show the following input line: Page 2-57 Next, well list the new order of the variables by using their names typed between quotes: C5D {j CD HUES CD CB ? CD CDC3 ! CZJEB(T) CB ? CZJIillllCE) GD ! CZCiSiSiillSI CD GD j CZDEa S The screen now shows the new ordering of the variables: ORDERS INTRO' 'FT 'zl' 'Q' ► HOVRL RPN mode In RPN mode, the list of re-ordered variables is listed in the stack before applying the command ORDER. Suppose that we start from the same situation as above, but in RPN mode, i.e., The reordered list is created by using: CfDU ........... . liLliliiii IIILL1II i Then, enter the command ORDER, as done before, i.e., Ijnj^— <s3?E3i Select MEMORY from the programming menu ^P^P^P^P mM Select DIRECTORY from the MEMORY menu MM Select ORDER from the DIRECTORY menu The result is the following screen: Moving variables using the FILES menu To move a variable from one directory to another you can use the FILES menu. For example, within the sub-directory {HOME MANS INTRO}, we have variables p7, zl , /?, Q, A 12, a, and A. Suppose that we want to move variable A 72 to sub-directory {HOME MANS}. Here is how to do it: Press Ij^Jfiles_ to show a variable list. Use the down-arrow key ^3? to select variable A 72, then press EEZ9. The calculator will respond with a PICK DESTINATION screen. Use the up arrow key <^> to select the sub-directory MANS and press lliilllli. The screen will now show the contents of sub- directory {HOME MANS INTRO}: Page 2-58 [[]]R IR A hLG HflTRK hLG REAL 1? 23 23 ID Notice that variable Al 2 is no longer there. If you now press L<i J{™_ , the HLG 1H [[]]R HflTRK 12 HLG 23 Eff 2i HLG 21 IR fl REAL 10 Note: You can use the stack to move a variable by combining copying with deleting a variable. Procedures for deleting variables are demonstrated in the next section. Deleting variables Variables can be deleted using function PURGE. This function can be accessed directly by using the TOOLS menu (\joolJ), or by using the FILES menu {^Jfiles_ MM. Using the FILES command The FILES command can be used to purge one variable at a time. To delete a variable from a given directory you can use the FILES menu. For example, within the sub-directory {HOME MANS INTRO}, we have variables pi, zl, /?, Q, a, and A left. Suppose that we delete variable A. Here is how to do it: Press ( jnj files to produce the variable list. Use the down-arrow key <\j? to select variable A (the last in the list), then press C^lHIEEai 1EEEIII. The screen will now show the contents of sub-directory IN ^Hor^: 31735 I Select: Q [[]]R IR « HflTRK flLG REAL RO without variable A. EanmaMEmMfflMHEiMiEa Page 2-59 Using function PURGE in the stack in Algebraic mode We start again at subdirectory {HOME MANS INTRO} containing now only variables p7, z7 , Q, /?, and a. We will use command PURGE to delete variable pi . Press {tool) illllilElI (j^IRIII [enter] . The screen will now show variable pi removed: :PURGE('pn HOVRL You can use the PURGE command to erase more than one variable by placing their names in a list in the argument of PURGE. For example, if now we wanted to purge variables R and Q, simultaneously, we can try the following exercise. Press : [tool) wmm GTJi^CD Chilli CD CB : CD C^iilili At this point, the screen will show the following command ready to be executed: HOVflL iPURGECpl') To finish deleting the variables, press (enter} . The screen will now show the remaining variables: :PURGE('pn HOVflL :PURGEC{'R' 'Q'H HOVflL Using function PURGE in the stack in RPN mode We start again at subdirectory {HOME MANS INTRO} containing variables p7, z7 , Q, /?, and a. We will use command PURGE to delete variable pi . Press Lj_JIH [enter) [tool) iil!31i:ili. The screen will now show variable pi removed: EDIT | '.' I E H |:"ThlK| F;lL |PURGE|CLEAR To delete two variables simultaneously, say variables R and Q, first create a list (in RPN mode, the elements of the list need not be separated by commas as in Algebraic mode): (j^T) CSDU CZD 1111 CD CZD i^i (enter). Then, press [roajllinili use to purge the variables. Page 2-60 UNDO and CMD functions Functions UNDO and CMD are useful for recovering recent commands, or to revert an operation if a mistake was made. These functions are associated with the HIST key: UNDO results from the keystroke sequence (j^J f while CMD results from the keystroke sequence l<n ~]om . To illustrate the use of UNDO, try the following exercise in algebraic (ALG) mode: CZDCZDCEGDCBt^ • The UNDO command (CS mo) will simply erase the result. The same exercise in RPN mode, will follow these keystrokes: CS^^CO^^CKDCZIl^^CS • Using C3_wo at this point will undo the most recent operation (20/3), leaving the original terms back in the stack: 2: 20 l: 3 AECUY|CHinR|CYCLO| DIY3 EGCD IFftCTO To illustrate the use of CMD, let's enter the following entries in ALG mode. Press [enter) after each entry. Next, use the CMD function (Q ~]om ) to show the four most recent commands entered by the user, i.e., :TF :SI :3J27 You can use the up and down arrow keys (^><\3?) to navigate through these commands and highlight any of them that you want to entry anew. Once you have selected the command to enter, press III31IBL The CMD function operates in the same fashion when the calculator is in RPN mode, except that the list of commands only shows numbers or algebraics. It does not show functions entered. For example, try the following exercise in RPN mode: Page 2-61 Pressing ~]om produces the following selection box: 4: 3: £: l: SIHC5-21 As you can see, the numbers 3, 2, and 5, used in the first calculation above, are listed in the selection box, as well as the algebraic /SIN(5x2)/, but not the SIN function entered previous to the algebraic. Flags A flag is a Boolean value, that can be set or cleared (true or false), that specifies a given setting of the calculator or an option in a program. Flags in the calculator are identified by numbers. There are 256 flags, numbered from -128 to 128. Positive flags are called user flags and are available for programming purposes by the user. Flags represented by negative numbers are called system flags and affect the way the calculator operates. To see the current system flag setting press the LM0P£J button, and then the DEQ1 soft menu key (i.e., Fl). You will get a screen labeled SYSTEM FLAGS listing flag numbers and the corresponding setting. MMMSSYSTEH FLAGS 02 Constant ■+ f yHb 03 Function ■+ jyHb iH Payticnt at end 15 ■+ vector 20 Uridyl- h i. oh -i- o (Note: In this screen, as only system flags are present, only the absolute value of the flag number Is displayed). A flag is said to be set if you see a check mark (^) in front of the flag number. Otherwise, the flag is not set or cleared. To change the status of a system flag press the Tjjj ! soft menu key while the flag you want to change is highlighted, or use the L^J key. You can use the up and down arrow keys (^><\3?) to move about the list of system flags. Although there are 1 28 system flags, not all of them are used, and some of them are used for internal system control. System flags that are not accessible to the user are not visible in this screen. A complete list of flags is presented in Chapter 24. Page 2-62 Example of flag setting: general solutions vs. principal value For example, the default value for system flag 01 is General solutions. What this means is that, if an equation has multiple solutions, all the solutions will be returned by the calculator, most likely in a list. By pressing the soft menu key you can change system flag 01 to Principal value. This setting will force the calculator to provide a single value known as the principal value of the solution. To see this at work, first set system flag 01 (i.e., select Principal Value). Press EH! twice to return to normal calculator display. We will try solving a quadratic equation solution, say, t2+5t+6 = 0, with command QUAD. Algebraic mode Use the following keystroke sequence: L r> J cat [alpha} (q} (use the up and down arrow keys, S+^^r? , to select command QUAD) , press E9I . To enter the equation as the first argument of function QUAD, use the following keystrokes: CgJ l {alpha} CB(3(^D The result is: QUflD(t2+5-t+6=0,t) t=-3 Now, change the setting of flag 1 to General solutions: [mode) MSSSm I^SX] E9 EH . And try the solution again: ^^(^Qwra) . The solution now includes two values: :QUflD(t£+5-t+6=0,t) QUflD(t£+5-t+6=0,t) t=-3 it =-2 t=-3> RPNmode First set system flag 01 (i.e., Principal Value). Press EH twice to return to normal calculator display. Then, type the quadratic equation as follows: Page 2-63 (enter} (keeping a second copy in the RPN stack) 3: l: t +5-t+6=0 t2+5-t+6=0 't Use the following keystroke sequence to enter the QUAD command: L r> J cat [alpha}@ (use the up and down arrow keys, </aN><\t>? f to select command QUAD) , press ll!:!!!!! . The screen shows the principal solution: 3: 2: t +5-t+6=0 t=-3 Now, change the setting of flag 01 to General solutions: [mode) E3!33i ISHaMSMMBM. And try the solution again: CSCZD S QDS^ (j^J_ar [alpha} @ (use the up and down arrow keys, ^^^3? , to select command QUAD) , press lilll!!! . The screen now shows the two solutions: Other flags of interest Bring up once more the current flag setting by pressing the (mode) button, and then the HUE! soft menu key. Make sure to clear system flag 01 , which was left set from the previous exercise. Use the up and down arrow keys (^^^P) to move about the system flag list. Some flags of interest and their preferred value for the purpose of the exercises that follow in this manual are: 02 Constant -> symb: Constant values (e.g., n) are kept as symbols 03 Function —> symb: Functions are not automatically evaluated, instead they are loaded as symbolic expressions. 27 'X+Y*i' —> (X,Y): Complex numbers are represented as ordered pairs 60 [a] [a] locks: The sequence [ai^{alpha} locks the alphabetic keyboard Press EH twice to return to normal calculator display. Page 2-64 CHOOSE boxes vs. Soft MENU In some of the exercises presented in this chapter we have seen menu lists of commands displayed in the screen. This menu lists are referred to as CHOOSE boxes. For example, to use the ORDER command to reorder variables in a directory, we used: GT3^_ ^P Show PROG menu list and select MEMORY &: 5: PROG HEHU i. STACK.. | 4: 3: £: l: 3 . BRftnCH.. 1 H . TEST.. 1 5. TYPE.. I 6. LIST.. EH ^P^P^P^P Show the MEMORY menu list and select DIRECTORY &: 5: 4: 3: MEMORY HEnU 1 . PURGE I a. MEM 3 . BYTES A H.nEHOE 1 £: l: 6 . ARITHMETIC. Show the DIRECTORY menu 7'. &: 5: 4: 3: DIRECTORY MEHU S . CRDIR | C.PGDIR 7.YARS y £: l: ±0 . HEHORY $ ist and select ORDER activate the ORDER command There is an alternative way to access these menus as soft MENU keys, by setting flag 7 77. To set this flag try the following: :: ;•: III \ : : :::!:: The screen shows flag 1 1 7 not set (CHOOSE boxes), as shown here: 115 Rigorous on ±20 Silent Hod* oFF 133 riUou SHitch Hod* 135 Recur. Sisn-SturH 13G rreF us (.ast col. / 12S Varj are reals Press the soft menu key to set flag 1 1 7 to soft MENU. The screen will reflect that change: Page 2-65 113 Rigorous on 120 Silent HOd« off 133 hI.i.oh S Hitch Hod* 135 flccur. Sijn-SturH 136 rr*F H--" (.aft col. Press twice to return to normal calculator display. Now, well try to find the ORDER command using similar keystrokes to those used above, i.e., we start with l<n J^g . Notice that instead of a menu list, we get soft menu labels with the different options in the PROG menu, i.e., Press CZD to select the MEMORY soft menu (IICIEIII). The display now shows: Press CZD to select the DIRECTORY soft menu (63) The ORDER command is not shown in this screen. To find it we use the LnxtJ key to find it: To activate the ORDER command we press the QD (1333333) soft menu key. Although not applied to a specific example, this exercise shows the two options for menus in the calculator (CHOOSE boxes and soft MENUs). Selected CHOOSE boxes Some menus will only produce CHOOSE boxes, e.g., • The APPS (APPlicationS menu), activated with the [apps) key, first key in 3. 1-^0 Functions.. 3. Constants Vib.. H.nuHcric fol.u«r.. j S.TiHC & date.. 6. Equation writer F.Fil.* Hanger | The CAT (CATalog menu), activated with the L r> j cat key, second key in the fourth row of keys from the top of the keyboard: Page 2-66 CATALOG : F63 COHHflnDS V. The HELP menu, activated with {tool} {mj jjljlll CflS h«l.p on = fi&CUY flDDTHOD HDDTOREHL HEL HL'jE: • The CMDS (CoMmanDS) menu, activated within the Equation Writer, i.e., cs-^r (nxl) mm fi&CUY flDDTHOD HDDTnREHL HL'jE: Page 2-67 Chapter 3 Calculation with real numbers This chapter demonstrates the use of the calculator for operations and functions related to real numbers. Operations along these lines are useful for most common calculations in the physical sciences and engineering. The user should be acquainted with the keyboard to identify certain functions available in the keyboard (e.g., SIN, COS, TAN, etc.). Also, it is assumed that the reader knows how to adjust the calculator's operation, i.e., select operating mode (see Chapter 1), use menus and choose boxes (see Chapter 1), and operate with variables (see Chapter 2). Checking calculators settings To check the current calculator and CAS settings you need to just look at the top line in the calculator display in normal operation. For example, you may see the following setting: RAD XYZ DEC R = 'X' This stands for RADians for angular measurements, XYZ for Rectangular (Cartesian) coordinates, DECimal number base, Real numbers preferred, = means "exact" results, and 'X' is the value of the default independent variable. Another possible listing of options could be DEG RZZ HEX C ~ Y This stands for DEGrees as angular measurements, RZZ for Polar coordinates, HEXagesimal number base, Complex numbers allowed, ~ stands for "approximate" results, and Y as the default independent variable. In general, this part of the display contains seven elements. Each element is identified next under numbers 1 through 7. The possible values for each element are shown between parentheses following the element description. The explanation of each of those values is also shown: 1 . Angle measure specification (DEG, RAD, GRD) DEG: degrees, 360 degrees in a complete circle RAD: radians, 2n radians in a complete circle GRD: grades, 400 grades in a complete circle Page 3-1 2. Coordinate system specification (XYZ, RZZ, RZZ). The symbol Z stands for an angular coordinate. XYZ: Cartesian or rectangular (x,y,z) RZZ: cylindrical Polar coordinates (r,0,z) RZZ: Spherical coordinates (p,0,(|)) 3. Number base specification (HEX, DEC, OCT, BIN) HEX: hexadecimal numbers (base 16) DEC: decimal numbers (base 10) OCT: octal numbers (base 8) BIN: binary numbers (base 2) 4. Real or complex mode specification (R, C) R: real numbers C: complex numbers 5. Exact or approximate mode specification (=, ~) = exact (symbolic) mode approximate (numerical) mode 6. Default CAS independent variable (e.g., 'X', Y, etc.) Checking calculator mode When in RPN mode the different levels of the stack are listed in the left-hand side of the screen. When the ALGEBRAIC mode is selected there are no numbered stack levels, and the word ALG is listed in the top line of the display towards the right-hand side. The difference between these operating modes was described in detail in Chapter 1 . Real number calculations To perform real number calculations it is preferred to have the CAS set to Real (as opposite to Complex) mode. In some cases, a complex result may show up, and a request to change the mode to Complex will be made by the calculator. Exact mode is the default mode for most operations. Therefore, you may want to start your calculations in this mode. Any change to Approx mode required to complete an operation will be requested by the calculator. There is no preferred selection for the angle measure or for the number base specification. Real number calculations will be demonstrated in both the Algebraic (ALG) and Reverse Polish Notation (RPN) modes. Page 3-2 Changing sign of a number, variable, or expression Use the L^J key. In ALG mode, you can press L^J before entering the number, e.g., CD CD CD CD (^) . Result = -2.5. In RPN mode, you need to enter at least part of the number first, and then use the L+/- J key, e.g., L2JCDCDCD • Result = -2.5. If you use the L^J function while there is no command line, the calculator will apply the NEG function (inverse of sign) to the object on the first level of the stack. The inverse function Use the L ?* J key. In ALG mode, press L ?* J first, followed by a number or algebraic expression, e.g., UDLU • Result = Vi or 0.5. In RPN mode, enter the number first, then use the key, e.g., 14 J[enter)1 h J . Result = % or 0.25. Addition, subtraction, multiplication, division Use the proper operation key, namely, L±J CD L><J L±J • In ALG mode, press an operand, then an operator, then an operand, followed by an {enter} to obtain a result. Examples: CXJCD3CD} C±D CD CD CD ^ (XJCD3CTD (CD CSCDGD ^ CDJCDJCE CX3 CD CD CD (^) CD3CD3CD) GD CD CD CD (*?D : 3. 7+5. 2 8.9 ■ & ■ 3— S ■ 5 -2-2 :4.2-2.5 10.5 In RPN mode, enter the operands one after the other, separated by an [svraj , then press the operator key. Examples: □DHSe CDCZDCX) 33 3J333)(™™) 333)33 33 CZDCZDCX)^ 3D (3 3D (X) 333333(^) 3D3D3D (3 Alternatively, in RPN mode, you can separate the operands with a space (Lfrcj) before pressing the operator key. Examples: (3 3D 3) 3) 33 3D 3D (33 3D 3D 3D 33 (DID 3D 3D 33 Page 3-3 Using parentheses Parentheses can be used to group operations, as well as to enclose arguments of functions. The parentheses are available through the keystroke combination Cjjp^ • Parentheses are always entered in pairs. For example, to calculate (5+3.2)/(7-2.2): In ALG mode: In RPN mode, you do not need the parenthesis, calculation is done directly on the stack: In RPN mode, typing the expression between quotes will allow you to enter the expression like in algebraic mode: For both, ALG and RPN modes, using the Equation Writer: The expression can be evaluated within the Equation writer, by using: & & & & heu or, C3 & iiini Absolute value function The absolute value function, ABS, is available through the keystroke combination: [j^Jabs_ . When calculating in the stack in ALG mode, enter the function before the argument, e.g., C5D^— CX3 CZD CD CD (^3) In RPN mode, enter the number first, then the function, e.g., (XJraCXJCXJCDED^ Squares and square roots The square function, SQ, is available through the keystroke combination: L*i )XJ- . When calculating in the stack in ALG mode, enter the function before the argument, e.g., GT3£ CDCDCDCD(^D Page 3-4 In RPN mode, enter the number first, then the function, e.g., rorarocDE}^ The square root function, V, is available through the R key. When calculating in the stack in ALG mode, enter the function before the argument, e.g., In RPN mode, enter the number first, then the function, e.g., Powers and roots The power function, A, is available through the L yx J key. When calculating in the stack in ALG mode, enter the base (y) followed by the CD key, and then the exponent (x), e.g., CD CD CD CD CD CD CD CD In RPN mode, enter the number first, then the function, e.g., cscD^^roracxJcxj^ra The root function, XROOT(y,x), is available through the keystroke combination CD^S • When calculating in the stack in ALG mode, enter the function XROOT followed by the arguments (y,x), separated by commas, e.g., In RPN mode, enter the argument y, first, then, x, and finally the function call, e.g., CDCDC^CD^GD^? Base- 10 logarithms and powers of 10 Logarithms of base 10 are calculated by the keystroke combination CD— ^5 (function LOG) while its inverse function (ALOG, or antilogarithm) is calculated by using )[QX . In ALG mode, the function is entered before the argument: GD-^CDCDCDCDC§D ED^CDCXJraCX}^ In RPN mode, the argument is entered before the function CDCDCDCDC^ CD-^S CD CD CD CD (^™D C5D£— Using powers of 1 0 in entering data Powers of ten, i.e., numbers of the form -4.5x1 0"2, etc., are entered by using the CD key. For example, in ALG mode: CDCXJSSD^JCDCXJ^ Page 3-5 Or, in RPN mode: (^(dj^cdcd^jcdcd Natural logarithms and exponential function Natural logarithms (i.e., logarithms of base e = 2.71 8281 8282) are calculated by the keystroke combination L r> J m (function LN) while its inverse function, the exponential function (function EXP) is calculated by using L*i . In ALG mode, the function is entered before the argument: C3 -JH CZD CD GD CD (£5) ED £L_ GE) CD CD CD CD In RPN mode, the argument is entered before the function CDCDGDCD^™) CB— ^ {JJCDtJJCDCD GD^— Trigonometric functions Three trigonometric functions are readily available in the keyboard: sine (CD), cosine (CD), and tangent (L^J). The arguments of these functions are angles, therefore, they can be entered in any system of angular measure (degrees, radians, grades). For example, with the DEG option selected, we can calculate the following trigonometric functions: In ALG mode: CDCDUDCD CDCDCDCD CDCDCDCDCD In RPN mode: CX3CD(^™DGD CX3CDC^GD CDCDCDCDCD Inverse trigonometric functions The inverse trigonometric functions available in the keyboard are the arcsine (ASIN), arccosine (ACOS), and arctangent (ATAN), available through the keystroke combinations C5J^sw_ f [J^Jacos_ f and [j^J^an_ t respectively. Since the inverse trigonometric functions represent angles, the answer from these functions will be given in the selected angular measure (DEG, RAD, GRD). Some examples are shown next: In ALG mode: CD^CDCDCDCDC(™D {^jAcgs_ UDCDCDCDCD Page 3-6 {^r)AjAN_ cmcmcmcm^ In RPN mode: □D Cm CTD CTD (^™D C3D □D Cm dD CD Qmzk) cm £os_ CD CZD CD CD (^TER) *[AN_ All the functions described above, namely, ABS, SQ, V, A, XROOT, LOG, ALOG, LN, EXP, SIN, COS, TAN, ASIN, ACOS, ATAN, can be combined with the fundamental operations (C±J CD C><J C±J ) to form more complex expressions. The Equation Writer, whose operations is described in Chapter 2, is ideal for building such expressions, regardless of the calculator operation mode. Differences between functions and operators Functions like ABS, SQ, V, LOG, ALOG, LN, EXP, SIN, COS, TAN, ASIN, ACOS, ATAN require a single argument. Thus, their application is ALG mode is straightforward, e.g., ABS(x). Some functions like XROOT require two arguments, e.g., XROOT(x,y). This function has the equivalent keystroke sequence (13—5 • Operators, on the other hand, are placed after a single argument or between two arguments. The factorial operator (!), for example, is placed after a number, e.g., CmC™)CmCm^^- Since this operator requires a single argument it is referred to as a unary operator. Operators that require two arguments, such as L±J Cm CD C±J L yX J, are binary operators, e.g., cm cm cm, orcmcmcm. Real number functions in the MTH menu The MTH (MaTHematics) menu include a number of mathematical functions mostly applicable to real numbers. To access the MTH menu, use the keystroke combination (jT}miw_ . With the default setting of CHOOSE boxes for system flag 1 1 7 (see Chapter 2), the MTH menu is shown as the following menu list: Page 3-7 HATH METlU 3.HATRIK.. 3. LIST.. H. HYPERBOLIC. f 5 . REAL.. 6. BASE.. HATH HEHU 6. BASE.. ? . PROBABILITY.. S.FFT.. 3.C0HPLEK.. iD.COnSTAnTS.. ii . special FuncTions.. As they are a great number of mathematic functions available in the calculator, the MTH menu is sorted by the type of object the functions apply on. For example, options 1 . VECTOR.., 2. MATRIX., and 3. LIST., apply to those data types (i.e., vectors, matrices, and lists) and will discussed in more detail in subsequent chapters. Options 4. HYPERBOLIC, and 5. REAL., apply to real numbers and will be discussed in detailed herein. Option 6. BASE., is used for conversion of numbers in different bases, and is also to be discussed in a separate chapter. Option 7. PROBABILITY., is used for probability applications and will be discussed in an upcoming chapter. Option 8. FFT.. (Fast Fourier Transform) is an application of signal processing and will be discussed in a different chapter. Option 9. COMPLEX., contains functions appropriate for complex numbers, which will be discussed in the next chapter. Option 70. CONSTANTS provides access to the constants in the calculator. This option will be presented later in this section. Finally, option 7 7. SPECIAL FUNCTIONS., includes functions of advanced mathematics that will be discussed in this section also. In general, to apply any of these functions you need to be aware of the number and order of the arguments required, and keep in mind that, in ALG mode you should select first the function and then enter the argument, while in RPN mode, you should enter the argument in the stack first, and then select the function. Using calculator menus: 1 . Since the operation of MTH functions (and of many other calculator menus) is very similar, we will describe in detail the use of the 4. HYPERBOLIC, menu in this section, with the intention of describing the general operation of calculator menus. Pay close attention to the process for selecting different options. 2. To quickly select one of the numbered options in a menu list (or CHOOSE box), simply press the number for the option in the keyboard. For Page 3-8 example, to select option 4. HYPERBOLIC in the MTH menu, simply press LU . Hyperbolic functions and their inverses Selecting Option 4. HYPERBOLIC. , in the MTH menu, and pressing EH, produces the hyperbolic function menu: HYPERBOLIC HEHU 3. COSH H.flCOSH F.TrtriH 6 . HTHriH HYPERBOLIC HEHU H.RCOSH F.TrtriH C . hThTiH 7.EHFH g.LnPi The hyperbolic functions are: Hyperbolic sine, SINH, and its inverse, ASINH or sinh"1 Hyperbolic cosine, COSH, and its inverse, ACOSH or cosh"1 Hyperbolic tangent, TANH, and its inverse, ATANH or tanh"1 This menu contains also the functions: EXPM(x) = exp(x) - 1, LNPl(x) = ln(x+l). Finally, option 9. MATH, returns the user to the MTH menu. For example, in ALG mode, the keystroke sequence to calculate, say, tanh(2.5), is the following: ^Jmjh_ Select MTH menu CTD EH Select the 4. HYPERBOLIC menu CD IliOI Select the 5. TANH function CZDCZDCX]^ Evaluate tanh(2.5) The screen shows the following output: :TFINH(2.5) .986614298151 In the RPN mode, the keystrokes to perform this calculation are the following: CX3CZI)CTD(^D Enter the argument in the stack GT]m™_ Select MTH menu GD MM Select the 4. HYPERBOLIC menu CD EH Select the 5. TANH function Page 3-9 Th e result is: ,986614298151 The operations shown above assume that you are using the default setting for system flag 1 1 7 (CHOOSE boxes). If you have changed the setting of this flag (see Chapter 2) to SOFT menu, the MTH menu will show as labels of the soft menu keys, as follows (left-hand side in ALG mode, right -hand side in RPN mode): VECTR HhTRX LIST HYP REAL ERSE Pressing jNxrj shows the remaining options: l: nflaaftiaffimum 1 1 im 1 1 hflaaftiaffimum 1 1 im 1 1 Note: Pressing LjnJ^_ will return to the first set of MTH options. Also, using the combination C3<\3? will list all menu functions in the screen, e.g. FREE rFT CMPLX CONST SPECIAL FUNCTIONS Thus, to select, for example, the hyperbolic functions menu, with this menu format press EMM , to produce: l: ^j.iiirm.iiiw.^iirw.Miiin.iiirWii.i!! ^j.iiinm.iiiw.Hiirw.Hiiin.iiirWii.i!! Finally, in order to select, for example, the hyperbolic tangent (tanh) function, simply press Note: To see additional options in these soft menus, press the jNxrj key or the y,REV keystroke sequence. Page 3-10 For example, to calculate tanh(2.5), in the ALG mode, when using SOFT menus over CHOOSE boxes, follow this procedure: jjjjj.jj : Select MTH menu Select the HYPERBOLIC menu Select the TANH function Evaluate tanh(2.5) In RPN mode, the same value is calculated using: CBCZDCS(^D Enter argument in the stack ^Jmjh_ Select MTH menu Select the HYPERBOLIC, menu EEDCI Select the TANH function As an exercise of applications of hyperbolic functions, verify the following values: SINH (2.5) = 6.05020.. COSH (2.5) = 6.1 3228.. TANH(2.5) = 0.98661.. EXPM(2.0) = 6.38905.... ASINH(2.0)= 1.4436... ACOSH(2.0)= 1.3169. ATANH(0.2) = 0.2027.. LNPl(l.O) = 0.69314.... Once again, the general procedure shown in this section can be applied for selecting options in any calculator menu. Real number functions Selecting option 5. REAL., in the MTH menu, with system flag 1 1 7 set to REAL HEHU 3. V.J H.Min 5. HHK 6. HOD 'I REAL HEnU 7. RES n s.sian I ii.lP | Page 3-1 1 REAL HERU 13.RnD f IH.TRnC 15. FLOOR 16. CEIL 1F.D-* j REAL HERU IH.TRnC 15. FLOOR 16. CEIL 17. D-* 1S.R-* f Option 7 9. MATH., returns the user to the MTH menu. The remaining functions are grouped into six different groups described below. If system flag 1 1 7 is set to SOFT menus, the REAL functions menu will look like this (ALG mode used, the same soft menu keys will be available in RPN mode): ElMliaiaHMaEBMMffiMlffil The very last option, Iljilll, returns the user to the MTH menu. Percentage functions These functions are used to calculate percentages and related values as follows: % (y,x) : calculates the x percentage of y %CH(y,x) : calculates 100(y-x)/x, i.e., the percentage change, the difference between two numbers. %T(y,x) : calculates 100 x/y, i.e., the percentage total, the portion that one number (x) is of another (y). These functions require two arguments, we illustrate the calculation of %T(15,45), i.e., calculation 15% of 45, next. We assume that the calculator is set to ALG mode, and that system flag 1 1 7 is set to CHOOSE boxes. The procedure is as follows: GT]m™_ Select MTH menu CD EB Select the 5. REAL, menu CD EB Select the 5. %T function LUL5J Enter first argument L r> J \ Enter a comma to separate arguments 14 JL5 J Enter second argument Page 3-12 [enter] Calculate function The result is shown next: :*T(15,45) 300 In RPN mode, recall that argument y is located in the second level of the stack, while argument x is located in the first level of the stack. This means, you should enter x first, and then, y, just as in ALG mode. Thus, the calculation of %T(15,45), in RPN mode, and with system flag 1 17 set to CHOOSE boxes, we proceed as follows: CDCD(^D Enter first argument 14 JL5 J[enter) Enter second argument CT}mth_ Select A/177-/ menu CD DB Select the 5. REAL, menu CD Select the 5. %T function Note: The exercises in this section illustrate the general use of calculator functions having 2 arguments. The operation of functions having 3 or more arguments can be generalized from these examples. As an exercise for percentage-related functions, verify the following values: 70(5,20) = I %CH(22,25) = 13.6363.., %T(500,20) = 4 Minimum and maximum Use these functions to determine the minimum or maximum value of two arguments. MIN(x,y) : minimum value of x and y MAX(x,y) : maximum value of x and y As an exercise, verify that MIN(-2,2) = -2, MAX(-2,2) = 2 Modulo MOD: y mod x = residual of y/x, i.e., if x and y are integer numbers, y/x d + r/x, where d = quotient, r = residual. In this case, r = y mod x. Page 3-13 Please notice that MOD is not a function, but rather an operator, i.e., in ALG mode, MOD should be used as y x, and not as MODCy x ) . Thus, the operation of MOD is similar to that of L±J , / L><J , L±J • As an exercise, verify that 15 MOD 4=15 mod 4 = residual of 15/4 = 3 Absolute value, sign, mantissa, exponent, integer and fractional parts ABS(x) : calculates the absolute value, |x| SIGN(x) : determines the sign of x, i.e., -1 , 0, or 1 . MANT(x): determines the mantissa of a number based on log10. XPON(x): determines the power of 10 in the number IP(x) : determines the integer part of a real number FP(x) : determines the fractional part of a real number As an exercise, verify that ABS(-3) = \-3\ = 3, SIGN(-5) = -1, MANT(2540) = 2.540, XPON(2540) = 3, IP(2.35) = 2, FP(2.35) = 0.35. Rounding, truncating, floor, and ceiling functions RND(x,y) : rounds up y to x decimal places TRNC(x,y) : truncate y to x decimal places FLOOR(x) : closest integer that is less than or equal to x CEIL(x) : closest integer that is greater than or equal to x As an exercise, verify that RND(1 .4567,2) = 1.46, TRNQ1 .4567,2) = 1.45, FLOOR(2.3) = 2, CEIL(2,3) = 3 Radians-to-degrees and degrees-to-radians functions D->R (x) : converts degrees to radians R^D (x) : converts radians to degrees. As an exercise, verify that D^R(45) = 0.78539 (i.e., 45° = 0.78539rad), R^D(1.5) = 85.943669.. (i.e., 1 .5rad = 85.943669..°). Special functions Option 1 1 . Special functions... in the MTH menu includes the following functions: Page 3-14 SPECIAL FUnCTIOnS METlU a. psi 3. Psi H . HATH.. GAMMA: The Gamma function r(a) PSI: N-th derivative of the digamma function Psi: Digamma function, derivative of the In(Gamma) The Gamma function is defined by T(a) = xa~le~xdx . This function has applications in applied mathematics for science and engineering, as well as in probability and statistics. Factorial of a number The factorial of a positive integer number n is defined as n!=n-(n-l)-(n- 2) ... 3-2-1 , with 0! = 7. The factorial function is available in the calculator by using ld™Jlr?JL2J . In both ALG and RPN modes, enter the number first, followed by the sequence (^)CBCX3. Example: CZD {alpha} (TQ £jJ (enter) . The Gamma function, defined above, has the property that r(a) = (a-1) r(a-l), for a > 1 . Therefore, it can be related to the factorial of a number, i.e., r(a) = (a-l)\, when a is a positive integer. We can also use the factorial function to calculate the Gamma function, and vice versa. For example, r(5) = 4! or, QZ3S^CBCTD(^]. The factorial function is available in the MTH menu, through the 7. PROBABILITY., menu. The PSI function, ^(x.y), represents the y-th derivative of the digamma function, dn i.e., ^{n.x) = y(x)f where y/(x) is known as the digamma function, or dx11 Psi function. For this function, y must be a positive integer. The Psi function, y/(x), or digamma function, is defined as y/{x) = ln[T(x)] . Page 3-15 Examples of these special functions are shown here using both the ALG and RPN modes. As an exercise, verify that GAMMA(2.3) = 1.16671 1..., PSI(1.5,3) = 1.40909.., and Psi(l. 5)= 3.64899739. .E-2. These calculations are shown in the following screen shot: GRMMRC2- 33 1. 1667119052 PSICl.5,3) 1-409091034 :Psi(1.5) 3.64899739786E-2 Calculator constants The following are the mathematical constants used by your calculator: • e: the base of natural logarithms. • /: the imaginary unit, P 2 = -1 . • TV. the ratio of the length of the circle to its diameter. • MINR: the minimum real number available to the calculator. • MAXR: the maximum real number available to the calculator. To have access to these constants, select option 1 1 . CONSTANTS., in the MTH menu, HATH HEnU 6. BASE.. F. PROBABILITY.. S.FFT.. . 3.C0HPLEK.. t ii. special Funaions.. | The constants are listed as follows: consTAnTS hehu a.a.FiSaSiSaSHG H . ui . .i i . !' e.3.iHi55aes355 consTAnTS mehu e.3.iHi55aes355 f F.HinR 3.1.E-H55 3 HA MR I Selecting any of these entries will place the value selected, whether a symbol (e.g., e, /, n, MINR, or MAXR) or a value (2.77.., (0,1), 3. 14.., 1E-499, 9.99. .E499) in the stack. Page 3-16 Please notice that e is available from the keyboard as exp(l), i.e., C5D^CD(^), in ALG mode, or CD(§nter) C5D^ , in RPN mode. Also, 71 is available directly from the keyboard as • Finally, / is available by using LjnJ ; • Operations with units Numbers in the calculator can have units associated with them. Thus, it is possible to calculate results involving a consistent system of units and produce a result with the appropriate combination of units. The UNITS menu The units menu is launched by the keystroke combination (j^JJMJ (associated with the LU key). With system flag 1 1 7 set to CHOOSE boxes, the result is the following menu: UniTS HETlU 2. Length.. 3. Area. . S.Tim.. e.speed.. UniTS HEMJ 7.H055.. jj E. Force.. | 5. Energy.. | lD.Pouer.. | ii. Pressure.. jj UniTl" METlU 12. TeHperature.. 13. E^ctric Current.. iH.An^e.. 15. Lisht.. 16. Radiation.. Option 7. Tools., contains functions used to operate on units (discussed later). Options 3. Length., through 7 7. Viscosity., contain menus with a number of units for each of the quantities described. For example, selecting option 8. Force., shows the following units menu: FORCE HEnU IjKII H.hip 5. LbF FORCE HEHU 2.'jyn 3-3F H.hip SAbf C.pdl The user will recognize most of these units (some, e.g., dyne, are not used very often nowadays) from his or her physics classes: N = newtons, dyn = dynes, gf = grams - force (to distinguish from gram-mass, or plainly gram, a Page 3-17 unit of mass), kip = kilo-poundal (1000 pounds), Ibf = pound-force (to distinguish from pound-mass), pdl = poundal. To attach a unit object to a number, the number must be followed by an underscore. Thus, a force of 5 N will be entered as 5_N. For extensive operations with units SOFT menus provide a more convenient way of attaching units. Change system flag 1 1 7 to SOFT menus (see Chapter 1 ), and use the keystroke combination (j^JJMJ to get the following menus. Press [nxtJ to move to the next menu page. nffr;i?ifti¥fifHiiJ Pressing on the appropriate soft menu key will open the sub-menu of units for that particular selection. For example, for the iEilllllii sub-menu, the following units are available: Pressing the soft menu key will take you back to the UNITS menu. Recall that you can always list the full menu labels in the screen by using LeD<s3? / e.g., for the llllllllll set of units the following labels will be listed: erg Kcal cal Btu ft*lbf EgMEMBEMflHE therm MeV eV UNITS Note: Use the jNxrj key or the l<n J?REV keystroke sequence to navigate through the menus. Available units The following is a list of the units available in the UNITS menu. The unit symbol is shown first followed by the unit name in parentheses: Page 3-18 LENGTH m (meter), cm (centimeter), mm (millimeter), yd (yard), ft (feet), in (inch), Mpc (Mega parsec), pc (parsec), lyr (light-year), au (astronomical unit), km (kilometer), mi (international mile), nmi (nautical mile), miUS (US statute mile), chain (chain), rd (rod), fath (fathom), ftUS (survey foot), Mil (Mil), u. (micron), A (Angstrom), fermi (fermi) AREA mA2 (square meter), cmA2 (square centimeter), b (barn), ydA2 (square yard), ftA2 (square feet), inA2 (square inch), kmA2 (square kilometer), ha (hectare), a (are), miA2 (square mile), miUSA2 (square statute mile), acre (acre) VOLUME mA3 (cubic meter), st (stere), cmA3 (cubic centimeter), ydA3 (cubic yard), ftA3 (cubic feet), inA3 (cubic inch), I (liter), galUK (UK gallon), galC (Canadian gallon), gal (US gallon), qt (quart), pt (pint), ml (mililiter), cu (US cup), ozfl (US fluid ounce), ozUK (UK fluid ounce), tbsp (tablespoon), tsp (teaspoon), bbl (barrel), bu (bushel), pk (peck), fbm (board foot) TIME yr (year), d (day), h (hour), min (minute), s (second), Hz (hertz) SPEED m/s (meter per second), cm/s (centimeter per second), ft/s (feet per second), kph (kilometer per hour), mph (mile per hour), knot (nautical miles per hour), c (speed of light), ga (acceleration of gravity ) MASS kg (kilogram), g (gram), Lb (avoirdupois pound), oz (ounce), slug (slug), Ibt (Troy pound), ton (short ton), tonUK (long ton), t (metric ton), ozt (Troy ounce), ct (carat), grain (grain), u (unified atomic mass), mol (mole) FORCE N (newton), dyn (dyne), gf (gram-force), kip (kilopound-force), Ibf (pound- force), pdl (poundal) Page 3-19 ENERGY J (joule), erg (erg), Kcal (kilocalorie), Cal (calorie), Btu (International table btu), ftxlbf (foot-pound), therm (EEC therm), MeV (mega electron-volt), eV (electron- volt) POWER W (watt), hp (horse power), PRESSURE Pa (pascal), atm (atmosphere), bar (bar), psi (pounds per square inch), torr (torr), mmHg (millimeters of mercury), inHg (inches of mercury), inH20 (inches of water), TEMPERATURE °C (degree Celsius), °F (degree Fahrenheit), K (Kelvin), °R (degree Rankine), ELECTRIC CURRENT (Electric measurements) V (volt), A (ampere), C (coulomb), Q (ohm), F (farad), W (watt), Fdy (faraday), H (henry), mho (mho), S (siemens), T (tesla), Wb (weber ) ANGLE (planar and solid angle measurements) ° (sexagesimal degree), r (radian), grad (grade), arcmin (minute of arc), arcs (second of arc), sr (steradian) LIGHT (Illumination measurements) fc (footcandle), flam (footlambert), Ix (lux), ph (phot), sb (stilb), Im (lumem), cd (candela), lam (lambert) RADIATION Gy (gray), rad (rad), rem (rem), Sv (sievert), Bq (becquerel), Ci (curie), R (roentgen) VISCOSITY P (poise), St (stokes) Page 3-20 Units not listed Units not listed in the Units menu, but available in the calculator include: gmol (gram-mole), Ibmol (pound-mole), rpm (revolutions per minute), dB (decibels). These units are accessible through menu 1 1 7.02, triggered by using MENU(1 1 7.02) in ALG mode, or 1 1 7.02 [enter} MENU in RPN mode. The menu will show in the screen as follows (use LrU^3?to show labels in display): TNu rnol bmol dB EQLIB rpH | 41 |Eul_IE: These units are also accessible through the catalog, for example: gmol: Ir^J— ^ ^™j(jnj(3 Ibmol: CS_cat (S^CfDS rpm: Q^J _w [alph^I^^^ dB: CS_c^(^(jT3© Converting to base units To convert any of these units to the default units in the SI system, use the function UBASE. For example, to find out what is the value of 7 poise (unit of viscosity) in the SI units, use the following: In ALG mode, system flag 1 1 7 set to CHOOSE boxes: [Jfjmrs Select the UNITS menu 1SIB Select the TOOLS menu <\3? liilllll Select the UBASE function LU LcD - Enter 1 and underline [Jfjmrs Select the UNITS menu ^ MM Select the VISCOSITY option Select the UNITS menu Convert the units Page 3-21 This results in the following screen (i.e., 7 poise = 0. 7 kg/(m-s)) UBflSE(M_P) 1 ^ In RPN mode, system flag 1 1 7 set to CHOOSE boxes: LU Enter 1 (no underline) [Jfjmrs Select the UNITS menu ^ D9 Select the VISCOSITY option 111! Select the unit P (poise) {J^jjnijs Select the UNITS menu Select the TOOLS menu ^r? EB Select the UBASE function In ALG mode, system flag 1 1 7 set to SOFT menus: {J^jjnijs Select the UNITS menu Select the TOOLS menu Select the UBASE function L / J L r> J - Enter 1 and underline [Jfjmrs Select the UNITS menu tK)PREv_ mm Select the VISCOSITY option Select the unit P (poise) Convert the units In RPN mode, system flag 1 1 7 set to SOFT menus: LU Enter 1 (no underline) {J^jjnijs Select the UNITS menu ^prev_ mm Select the VISCOSITY option 1IE1I! Select the unit P (poise) {Jf^mi Select the UNITS menu D39B Select the TOOLS menu IfllH:!! Select the UBASE function Attaching units to numbers To attach a unit object to a number, the number must be followed by an underscore (LrU - , key(8,5)). Thus, a force of 5 N will be entered as 5_N. Page 3-22 Here is the sequence of steps to enter this number in ALG mode, system flag 1 1 7 set to CHOOSE boxes: UJlxLJ - Enter number and underscore [^Jmrs Access the UNITS menu Select units of force (8. Force..) MM Select Newtons (N) (enter} Enter quantity with units in the stack The screen will look like the Allowing: :5-l_H Note: If you forget the underscore, the result is the expression 5*N, where N here represents a possible variable name and not Newtons. To enter this same quantity, with the calculator in RPN mode, use the following keystrokes: L 5 J Enter number (do not enter underscore) [^Jmrs Access the UNITS menu CSIIIISil Select units of force (8. Force..) Select Newtons (N) Notice that the underscore is entered automatically when the RPN mode is active. The result is the following screen: As indicated earlier, if system flag 1 1 7 is set to SOFT menus, then the UNITS menu will show up as labels for the soft menu keys. This set up is very convenient for extensive operations with units. The keystroke sequences to enter units when the SOFT menu option is selected, in both ALG and RPN modes, are illustrated next. For example, in ALG mode, to enter the quantity 5_N use: L 5 JL r> J - Enter number and underscore Page 3-23 CSJM? Access the UNITS menu (nxt) WS333i Select units of force Select Newtons (N) Enter quantity with units in the stack The same quantity, entered in RPN mode uses the following keystrokes: L 5 J Enter number (no underscore) □3 JM* Access the UNITS menu ® tSSESi Select units of force iltil! Select Newtons (N) Note: You can enter a quantity with units by typing the underline and units with the {alpha} keyboard, e.g., CZDCB ~(alpha}(n} will produce the entry: 5.....N Unit prefixes You can enter prefixes for units according to the following table of prefixes from the SI system. The prefix abbreviation is shown first, followed by its name, and by the exponent x in the factor 1 0X corresponding to each prefix: Prefix Name X Prefix Name X Y yotta +24 d deci -1 Z zetta +21 c centi -2 E exa + 18 m milli -3 P peta + 15 micro -6 T tera + 12 n nano -9 G g'ga +9 P pico -12 M mega +6 f femto -15 k,K kilo +3 a atto -18 h,H hecto +2 z zepto -21 D(*) deka + 1 y yocto -24 (*) In the SI system, this prefix is da rather than D. Use D for deka in the calculator, however. Page 3-24 To enter these prefixes, simply type the prefix using the {alpha} keyboard. For example, to enter 123 pm (1 picometer), use: Using UBASE to convert to the default unit (1 m) results in: 123-l_pm 123_ppi UBflSE(flNS(lH . 000000000 123_m COnYE UEASE UYrtL UFhCT -HJnIT UnIT: Operations with units Once a quantity accompanied with units is entered into the stack, it can be used in operations similar to plain numbers, except that quantities with units cannot be used as arguments of functions (say, SQ or SIN). Thus, attempting to calculate LN(10_m) will produce an error message: Error: Bad Argument Type. Here are some calculation examples using the ALG operating mode. Be warned that, when multiplying or dividing quantities with units, you must enclosed each quantity with its units between parentheses. Thus, to enter, for example, the product 1 2.5m x 5.2_yd, type it to read (1 2.5_m)*(5.2_yd) : 12.5_m-5.2_yd a]flAJJIIi™j|ILAn«IIIJ^JEIIrt*J(TTft*a which shows as 65_(m-yd). To convert to units of the SI system, use function UBASE: : 12.5_m-5.2_yd UBflSEtflHSdH 2 59.436_m COnVE UEflSE UYHL UFflCT -KJniT UniT: Note: Recall that the ANS(1 ) variable is available through the keystroke combination CjjD^_ (associated with the (enter} key). Page 3-25 To calculate a division, say, 3250 mi / 50 h, enter it as (3250_mi)/(50_h) [enter}: 3250-1-pu 50-l_h which transformed to SI units, with function UBASE, produces: b~_- :UBflSE(flHS(lH 29.0576_^ COnVE UEflSE UYrtL UFhCT -HJnIT UnIT: Addition and subtraction can be performed, in ALG mode, without using parentheses, e.g., 5 m + 3200 mm, can be entered simply as 5_m + 3200_mm (enter}: UBflSE(flNS(lH 5-l_m+3200-l_mm S200._mrn More complicated expression require the use of parentheses, e.g., (12_mm)*(l_cmA2)/(2_s)(^ 12'1-mm'l'l-cm 2-l_s Stack calculations in the RPN mode, do not require you to enclose the different terms in parentheses, e.g., 1 2_m [enter} 1 .5_yd [enter} QT] 3250_mi [enter} 50_h [enter} C±J These operations produce the following output: Page 3-26 l: lS_Cm-yd) Also, try the following operations: 5_m [enter) 3200_mm [enter} [TJ ] 2_rr\rr\ [enter) l_cmA2 [enter)[^J 2_s [enter) These last two operations produce the following output: 3: lo-invyaj 2 ^ roro'cro Note: Units are not allowed in expressions entered in the equation writer. Units manipulation tools The UNITS menu contains a TOOLS sub-menu, which provides the following functions: CONVERT(x,y): convert unit object x to units of object y UBASE(x): convert unit object x to SI units UVAL(x): extract the value from unit object x UFACT(x,y): factors a unit y from unit object x ->UNIT(x,y): combines value of x with units of y The UBASE function was discussed in detail in an earlier section in this chapter. To access any of these functions follow the examples provided earlier for UBASE. Notice that, while function UVAL requires only one argument, functions CONVERT, UFACT, and ->UNIT require two arguments. Try the following exercises, in your favorite calculator settings. The output shown below was developed in ALG mode with system flat 1 1 7 set to SOFT menu: Examples of CONVERT Page 3-27 These examples produce the same result, i.e., to convert 33 watts to btu's CONVERT(33_W,l_hp) [enter} CONVERT(33_W,l l_hp) (enter) These operations are shown in the screen as: Examples of UVAL: CON VERTC33- 1 _N, 1 ■ 1 _hj=0 4. 42537289566E-2_hp C0NVERT£33-1-1_N,1 4.42537289566E-2_hp UVAL(25_ft/s) (ENTER} UVAL(0.021_cmA3)(^ UVflLlSS-l-^r1 UVfll_(.021_cm3] 25. .021 Examples of UFACT UFACT(l_ha,18_kmA2)(^) UFACT(1_mm,15.1_cm) (enter} UFRCTl (l-l_ha, lS-l-km' 2) .01_km :UFfiCT(l-l_mm,15-l_cm) . l_cm Examples of ^UNIT ^UNIT(25,l_m)(^) ^UNIT(11.3,1_mph)(^ -HJNIT(25,M_mi 25_m -^UHITC11.3,12-l-l_mph3 1 1 . 3_mph COnVE UEflSE UVHL UFhCT -KJnIT UnlT: Page 3-28 Physical constants in the calculator Following along the treatment of units, we discuss the use of physical constants that are available in the calculator's memory. These physical constants are contained in a constants library activated with the command CONLIB. To launch this command you could simply type it in the stack: [alpha] [alpha) (Q (g\ (n)(l)(T) (b) [alpha) (enter) or, you can select the command CONLIB from the command catalog, as follows: First, launch the catalog by using: L r> J cat [alpha)® . Next, use the up and down arrow keys (j^^z? to select CONLIB. Finally, press the (JL) (iii£i=Ll:iiiM) soft menu key. Press [enter) t if needed. The constants library screen will look like the following (use the down arrow key to navigate through the library): olTzmann Vm: molar volume R: universal gas StdT: std temperature StdP: std pressure 1 SI -| EH GL | U Ti I T - 1 '.■ H L U E | -+5TK | GUIT h: Planck's f hbar: Dirac's q: electronic charge me: electron mass consTflms library (j: Stef an-Boltzmann c: speed of light e0: permittivity ul0 : permeability q_5 accel of gravity : gravitation :i -| ETmjL |UniT"|VHLUE| -+5TK | CUIT nonsTftriTS library ^^^^^ mpme= mp^me ratio fine structure 0~ mag flux quantum F: Faraday R«s RudberQ consTflms library ijlB = Bohr magneton f ijlH = nuclear magneton ^0: photon wavelength f0: photon frequency Compton uavelen 1 radian VALUE -+:"TH GUIT consTRms library § twoir: 2tt radians angl: ^ in trig mode c3: Mien's kq: k^c qe0 ESI consTAms library k^q e0^"q q*£0 dielectric const Page 3-29 The soft menu keys corresponding to this CONSTANTS LIBRARY screen include the following functions: SI when selected, constants values are shown in SI units ENGL when selected, constants values are shown in English units (*) UNIT when selected, constants are shown with units attached (*) VALUE when selected, constants are shown without units ->STK copies value (with or without units) to the stack QUIT exit constants library (*) Active only if the function VALUE is active. This is the way the top of the CONSTANTS LIBRARY screen looks when the option VALUE is selected (units in the SI system): Ub58E-23_J.-1 Vm: 22.4141_l/gmol R: S.31451_J^C9mol*K> StdT: £73.15_K StdP: 101.3£5_kPa 4 SI ■ EriuL uniT- UhLU- -+5TK quit To see the values of the constants in the English (or Imperial) system, press the ESm option: 0063E-27_Btu/„ Vm: 359.0394_ftA3^1b„ R: 18.73164_psi*ftA3„ StdT: 491.67_nR StdP: 14.6959_psi SI I E Tl ij L ■ I U Tl I T ■ I '.' H L U ■ I -+STK QUIT If we de-select the UNITS option (press [QMiS ) only the values are shown (English units selected in this case): S063E-27 Vm: 359.0394 R: 10-73164 StdT: 491.67 StdP: 14.6959 i Page 3-30 To copy the value of Vm to the stack, select the variable name, and press then, press EIIIEEil. For the calculator set to the ALG, the screen will look like this: COHLIB Vm: 359. 0394^ The display shows what is called a togged value, Vm« 8394. In here, Vm, is the tag of this result. Any arithmetic operation with this number will ignore the tag. Try, for example: CgJ ^ CTD QD QD i™— , which produces: : COHLIB Vm: 359. 0394 :|_N(2-flNSm) 57657931233 The same operation in RPN mode will require the following keystrokes (after the value of Vm was extracted from the constants library): ClI33^CZDC3 LN Special physical functions Menu 1 1 7, triggered by using MENU(1 1 7) in ALG mode, or 1 1 7 [enter} MENU in RPN mode, produces the following menu (labels listed in the display by using C3^3? ): ZFhuTuR I FANNING DflRCY F0^. SI DENS TDELTfl Z F H H T | F H Ti fi 1 1 D H F; H 'i' | F Li ;-. I L" I [i E Ti I T [i E L T The functions include: ZFACTOR: gas compressibility Z factor function FANNING: Fanning friction factor for fluid flow DARCY: Darcy-Weisbach friction factor for fluid flow FOX: Black body emissive power function SIDENS: Silicon intrinsic density TDELTA: Temperature delta function Page 3-31 In the second page of this menu (press Lnxt J ) we find the following items: I^.UB:l!r.M[rTTCTITTT»M.|:Jl7.J^:j In this menu page, there is one function (TINC) and a number of units described in an earlier section on units (see above). The function of interest is: TINC: temperature increment command Out of all the functions available in this MENU (UTILITY menu), namely, Z FACTOR, FANNING, DARCY, FOA, SIDENS, TDELTA, and TINC, functions FANNING and DARCY are described in Chapter 6 in the context of solving equations for pipeline flow. The remaining functions are described following. Function ZFACTOR Function ZFACTOR calculates the gas compressibility correction factor for nonideal behavior of hydrocarbon gas. The function is called by using ZFACTOR(xT, yP), where xT is the reduced temperature, i.e., the ratio of actual temperature to pseudo-critical temperature, and yP is the reduced pressure, i.e., the ratio of the actual pressure to the pseudo-critical pressure. The value of xT must be between 1 .05 and 3.0, while the value of yP must be between 0 and 30. Example, in ALG mode: :ZFflCT0RE2.5,12.5) 1 . 25980762398 Z F M H T | F M Ti Ti 1 1 Ci H F; H 'i' | FlU-. |£IDEn|TDELT Function fOX Function FOA, (T, X) calculates the fraction (dimensionless) of total black-body emissive power at temperature T between wavelengths 0 and X. If no units are attached to T and X, it is implied that T is in K and X in m. Example, in ALG mode: :F0^(452.,. 000013 . 567343728392 Z F M H T | F M Ti Ti 1 1 Ci H F; H 'i' | FlU-. |£IDEn|TDELT Page 3-32 Function SIDENS Function SIDENS(T) calculates the intrinsic density of silicon (in units of 1/cm3) as a function of temperature T (T in K), for T between 0 and 1 685 K. For example, :SIDENS(450.) 6.07995618238E13 Function TDELTA Function TDELTA(T0,Tf) yields the temperature increment Tf - T0. The result is returned with the same units as T0/ if any. Otherwise, it returns simply the difference in numbers. For example, :TDELTFl(25_nF,52_nC) -100.6_nF Z F H H T | F H Ti fi 1 1 D H F; H 'i' | F Li ;-. I L" I [i E Ti I T [i E L T The purpose of this function is to facilitate the calculation of temperature differences given temperatures in different units. Otherwise, it's simply calculates a subtraction, e.g., :TDELTffl250.,520.) -270. ^JMilfflflfHIffl^lWilFtifliilliJiU Function TINC Function TINC(T0,AT) calculates T0+DT. The operation of this function is similar to that of function TDELTA in the sense that it returns a result in the units of T0. Otherwise, it returns a simple addition of values, e.g., TINC(125_nF,-25_fO S0_nF TIHCC256..25J 2S1 . iHiHtlitHMttfflWTlWmSaiJ Page 3-33 Defining and using functions Users can define their own functions by using the DEF command available thought the keystroke sequence l<n JPEF (associated with the L 2 j key). The function must be entered in the following format: Function_name(arguments) = expression_contoining_orguments For example, we could define a simple functionH(x] = ln(x+l) + exp(-x). Suppose that you have a need to evaluate this function for a number of discrete values and, therefore, you want to be able to press a single button and get the result you want without having to type the expression in the right- hand side for each separate value. In the following example, we assume you have set your calculator to ALG mode. Enter the following sequence of keystrokes: The screen will look like this: : DEFIHEt HCx)=LHCx+l)+e ) HOVflL Press the Cjjg j key, and you will notice that there is a new variable in your soft menu key (1111). To see the contents of this variable press Lr^ JO. The screen will show now: : DEFIHE('HCx3=LHCx+13+eX') HOVflL * ■* x 'LhKx+l>+EXP<x>' ■MHfflJIflilflgTMiaiia Thus, the variable H contains a program defined by: «^x'LN(x+l) + EXP(x)' » This is a simple program in the default programming language of the HP 48 G series, and also incorporated in the HP 49 G series. This programming language is called UserRPL. The program shown above is relatively simple and consists of two parts, contained between the program containers << >> : Page 3-34 • Input: -> x -> x • Process: 'LN(x+l) + EXP(x) ' This is to be interpreted as saying: enter a value that is temporarily assigned to the name x (referred to as a local variable), evaluate the expression between quotes that contain that local variable, and show the evaluated expression. To activate the function in ALG mode, type the name of the function followed by the argument between parentheses, e.g., IIEBQD^ L2jt™L) • Some examples are shown below: HC2) HC1.2) LN(3)+e 4. 1085742831 FFhF; EGHn LH[|+l|+e MMBannsniiEMMMCina In the RPN mode, to activate the function enter the argument first, then press the soft menu key corresponding to the variable name IIIII . For example, you could try: L2J [enter) ESI . The other examples shown above can be entered by usi ng : CD CD CD MM , CD CD CD G^ra) ill . Functions can have more than 2 arguments. For example, the screen below shows the definition of the function K(a,p) = a+fi, and its evaluation with the arguments K(^2fn), and K(] .2,2.3): iDEFINECKtocF^ffl+F1) : K(J2 ,tt) :K(1.2,2.3) HOVRL J2+TT 3.5 The contents of the variable K are: « -> a p 7a+p' ». Functions defined by more than one expression In this section we discuss the treatment of functions that are defined by two or more expressions. An example of such functions would be f 2 • x - 1, x < 0] jc — 1 , x > 0 I Page 3-35 The calculator provides the function IFTE (IF-Then-Else) to describe such functions. The IFTE function The IFTE function is written as IFTE(cond/f/on, operationjfjrue, operation_if_false) If condition is true then operotion_if_true is performed, else operotion_if_folse is performed. For example, we can write 'f(x) = IFTE(x>0, xA2-l, 2*x-l)/, to describe the function listed above. Function IFTE is accessible from the function catalog (L J cat ). The symbol '>' (greater than) is available as (associated with the L ?* J key). To define this function in ALG mode use the command: DEF(f(x) = IFTE(x>0, xA2-l , 2*x-l )) then, press [enter] . In RPN mode, type the function definition between apostrophes: 'f(x) = IFTE(x>0, xA2-l, 2*x-l)' then press C3D?^- . Press jvAR j to recover your variable menu. The function llllllli should be available in your soft key menu. Press LiU ■III! to see the resulting program: « ^ x /IFTE(x>0, xA2-l , 2*x-l )' » To evaluate the function in ALG mode, type the function name, f, followed by the number at which you want to evaluate the function, e.g., f(2), then press [enter] . In RPN mode, enter a number and press llllllli. Check, for example, that f(2) = 3, while f(-2) = -5. Combined IFTE functions To program a more complicated function such as - x, x < -2 x + 1, -2<x<0 x-1, 0<x<2 x2, x>2 you can combine several levels of the IFTE function, i.e., 'g(x) = IFTE(x<-2, -x, IFTE(x<0, x+1, IFTE(x<2, x-1, xA2))),/ g(x) = < Page 3-36 Define this function by any of the means presented above, and check that g(-3) = 3,g(-l) = 0,g(l) = 0,g(3) = 9. Page 3-37 Chapter 4 Calculations with complex numbers This chapter shows examples of calculations and application of functions to complex numbers. Definitions A complex number z is a number written as z = x + iy, where x and y are real numbers, and / is the imaginary unit defined by i2 = -1 . The complex number x+iy has a real part, x = Re(z), and an imaginary par\, y = lm(z). We can think of a complex number as a point P(x,y) in the x-y plane, with the x-axis referred to as the real axis, and the y-axis referred to as the imaginary axis. Thus, a complex number represented in the form x+iy is said to be in its Cartesian representation. An alternative Cartesian representation is the ordered pair z = (x,y). A complex number can also be represented in polar coordinates (polar representation) as z = re 10 = r-cos6 + i r-sinO, where r = jz I = tJx2 + y2 is the magnitude of the complex number z, and 6= Arg(z) = arctan(y/x) is the argument of the complex number z. The relationship between the Cartesian and polar representation of complex numbers is given by the Euler formula: e'e= cos 6+ i sin 0. The complex conjugate of a complex number z = x + iy = re 10 , is z = x - iy = re 'l0 . The complex conjugate of / can be thought of as the reflection of z about the real (x) axis. Similarly, the negative of z, -z = -x-iy = - re 10 , can be thought of as the reflection of z about the origin. Setting the calculator to COMPLEX mode When working with complex numbers it is a good idea to set the calculator to complex mode, use the following keystrokes: (w*|)fiSH CZD^^^^CDl^HIO The COMPLEX mode will be selected if the CAS MODES screen shows the option _Complex checked off, i.e., CAS MODEL" Iri'j-zp uar:K HoduU: 13 _nuH«ric _flpprox QtOHpLcx ^ Verbose _St«p'St«p _Incr Poh ^Risorous _SiHp non-Rational. ftUoH coHpUx nuHbcrs? Page 4-1 Press IliEIII, twice, to return to the stack. Entering complex numbers Complex numbers in the calculator can be entered in either of the two Cartesian representations, namely, x+iy, or (x,y). The results in the calculator will be shown in the ordered-pair format, i.e., (x,y). For example, with the calculator in ALG mode, the complex number (3.5,-1 .2), is entered as: A complex number can also be entered in the form x+iy. For example, in ALG mode, 3.5-7.2/ is entered as: The following screen results after entering these complex numbers: (3-5,-1.23 3.5-1.2-i (3.5,-1.2) (3.5,-1.2) EDIT YIEH F;HL £Tqp- PURGE CLEAR In RPN mode, these numbers will be entered using the following keystrokes: (Notice that the change-sign keystroke is entered after the number 1 .2 has been entered, in the opposite order as the ALG mode exercise), and (Notice the need to enter an apostrophe before typing the number 3.5-1 .2i in RPN mode). The resulting RPN screen will be: -:: 2: (3.5,-1.2) l: 3.5-1.2-i EDIT | VIEH | RCL | £TDt |PURGE|CLERR Notice that the last entry shows a complex number in the form x+iy. This is so because the number was entered between apostrophes, which represents an algebraic expression. To evaluate this number use the EVAL key( [eval)). ::: £: (3.5,-1.2) l: (3.5,-1.2) EDIT | VIEH | RCL | STOHPURGEICLEflR Once the algebraic expression is evaluated, you recover the complex number (3.5,1.2). Page 4-2 Polar representation of a complex number The result shown above represents a Cartesian (rectangular) representation of the complex number 3.5-1 .2i. A polar representation is possible if we change the coordinate system to cylindrical or polar, by using function CYLIN. You can find this function in the catalog (L J cat ). Changing to polar shows the result: |l: t3.7^.33S297354329l| EDIT | '.' I E H |:"ThlK| F;lL |PURGE|CLEflR For this result the angular measure is set to radians (you can always change to radians by using function RAD). The result shown above represents a magnitude, 3.7, and an angle 0.33029.... The angle symbol (Z) is shown in front of the angle measure. Return to Cartesian or rectangular coordinates by using function RECT (available in the catalog, Lr>J cat ). A complex number in polar representation is written as z = r-e'e. You can enter this complex number into the calculator by using an ordered pair of the form (r, Z0). The angle symbol (Z) can be entered as ^™)Lr^JLU • For example, the complex number z = 5.2e] 5l, can be entered as follows (the figures show the stack, before and after entering the number): l: (3.5,1.2) <5.2Pil.5> 2: (3.5,1.2) l: C. 367333443672, 5. 18> HatilUH!lHiraMIHHlllftHUI*H Because the coordinate system is set to rectangular (or Cartesian), the calculator automatically converts the number entered to Cartesian coordinates, i.e., x = r cos 0, y = r sin 0, resulting, for this case, in (0.3678..., 5.18...). On the other hand, if the coordinate system is set to cylindrical coordinates (use CYLIN), entering a complex number (x,y), where x and y are real numbers, will produce a polar representation. For example, in cylindrical coordinates, enter the number (3. ,2.). The figure below shows the RPN stack, before and after entering this number: Page 4-3 Simple operations with complex numbers Complex numbers can be combined using the four fundamental operations (L + JL — JL x JL-*- J). The results follow the rules of algebra with the caveat that i2= -7. Operations with complex numbers are similar to those with real numbers. For example, with the calculator in ALG mode and the CAS set to Complex, well attempt the following sum: (3+5i) + (6-3i): :3.+5.-i+6.-3.-i (9. ,2J EDIT | '.'IEH | RCL | £T0t |FUF;ijE|CLEHF; Notice that the real parts (3+6) and imaginary parts (5-3) are combined together and the result given as an ordered pair with real part 9 and imaginary part 2. Try the following operations on your own: (5-2i) - (3+4i) = (2,-6) (3-i)-(2-4i) = (2,-14) (5-2i)/(3+4i) = (0.28,-1 .04) l/(3+4i) = (0.12, -0.16) Notes: The product of two numbers is represented by: (x1+iy1)(x2+iy2) = (x^ - yiy2) + i (x!y2 + x2yi). The division of two complex numbers is accomplished by multiplying both numerator and denominator by the complex conjugate of the denominator, i.e., xx + iyx = xx + iyx x2 -iy2 = xxx2 + yxy2 | x2yx -xxy2 x2 + iy2 x2 + iy2 x2 - iy2 x\ + y\ x2 + y\ Thus, the inverse function INV (activated with the L '/* J key) is defined as 1 1 x-iy x y — r- — 1- / x + iy x + iy x-iy x2 + y2 x2 + y2 Changing sign of a complex number Changing the sign of a complex number can be accomplished by using the C^D key, e.g., -(5-3i) = -5 + 3i Page 4-4 i-(5.-3.-i) (-5. ,3.) EDIT I '.'IEH I RCL STOfr PURGE CLEAR Entering the unit imaginary number To enter the unit imaginary number type : ), (0. , 1.) i Notice that the number / is entered as the ordered pair [0, 1) if the CAS is set to APPROX mode. In EXACT mode, the unit imaginary number is entered as /. Other operations Operations such as magnitude, argument, real and imaginary parts, and complex conjugate are available through the CMPLX menus detailed later. The CMPLX menus There are two CMPLX (CoMPLeX numbers) menus available in the calculator. One is available through the MTH menu (introduced in Chapter 3) and one directly into the keyboard (Lr* Jcmplx ), The two CMPLX menus are presented next. CMPLX menu through the MTH menu Assuming that system flag 1 1 7 is set to CHOOSE boxes (see Chapter 2), the CMPLX sub-menu within the MTH menu is accessed by using: (jT]/ww_ L_9j . The following sequence of screen shots illustrates these steps: HATH HE TlLI H. HYPERBOLIC. I 5 . REAL.. CEASE.. F. PROBABILITY.. S . FFT.. | i ■ 1 1 1 ii i ^^^^m\ COHPLEK HEAU iTi'h™ " " "~[ 3.C-* H.R-K 5. AGS C.ARG 1 The first menu (options 1 through 6) shows the following functions: Page 4-5 RE(z) : Real part of a complex number IM(z) : Imaginary part of a complex number C^R(z) : Takes a complex number (x,y) and separates it into its real and imaginary parts R^C(x,y): Forms the complex number (x,y) out of real numbers x and y ABS(z) : Calculates the magnitude of a complex number or the absolute value of a real number. ARG(z): Calculates the argument of a complex number. >ptions 7 through 10) are the LUMFLEM HEMJ 6.ARG S.nEG 5. con j J ollowmg: SIGN(z) : Calculates a complex number of unit magnitude as z/ 1 z | . NEG : Changes the sign of z CONJ(z): Produces the complex conjugate of z Examples of applications of these functions are shown next. Recall that, for ALG mode, the function must precede the argument, while in RPN mode, you enter the argument first, and then select the function. Also, recall that you can get these functions as soft menus by changing the setting of system flag 1 1 7 (See Chapter 3). This first screen shows functions RE, IM, and C->R. Notice that the last function returns a list {3. 5.} representing the real and imaginary components of the complex number: :RE(3.-2.-i) : IIK3.-2.-i) :OR(3.+5.-i) 3. -2. <3. 5.) The following screen shows functions R->C, ABS, and ARG. Notice that the ABS function gets translated to | 3.+5.-i | , the notation of the absolute value. Page 4-6 Also, the result of function ARG, which represents an angle, will be given in the units of angle measure currently selected. In this example, ARG(3.+5.-i) 1 .0303... is given in radians. <3. 5 (5. ?2.) R+C(5.,2.:i l3.+5.-il 5.83095189483 FlRG(3.+5.-i) 1 . 03037632652 In the next screen we present examples of functions SIGN, NEG (which shows up as the negative sign - ), and CONJ. 1 . 03037682652) :SIGN(-2.+3.-i) -.554700196225, . S320=> :-C-2.+3.-i) C2. ,-3.) :C0HJC-2.+3.-i) C-2. 3-3.) CMPLX menu in keyboard A second CMPLX menu is accessible by using the right-shift option associated with the CD key, i.e., ^Jcmx . With system flag 117 set to CHOOSE COHPLEK METlU a. flES 3. con J H.i 5.IH e.nEG COHPLEK METlU 3. con j H.i S.IH C.nEG F.P.E The resulting menu include some of the functions already introduced in the previous section, namely, ARG, ABS, CONJ, IM, NEG, RE, and SIGN. It also includes function / which serves the same purpose as the keystroke combination l<n ~)j , i.e., to enter the unit imaginary number / in an expression. The keyboard-base CMPLX menu is an alternative to the MTH-based CMPLX menu containing the basic complex number functions. Try the examples shown earlier using the keyboard-based CMPLX menu for practice. Page 4-7 Functions applied to complex numbers Many of the keyboard-based functions defined in Chapter 3 for real numbers, e.g., SQ, ,LN, ex, LOG, 10x, SIN, COS, TAN, ASIN, ACOS, ATAN, can be applied to complex numbers. The result is another complex number, as illustrated in the following examples. To apply this functions use the same :SQ(3.+4.-i) -7. ,24.) :J3.+4.-i (2. , 1.) :RL0G(2.-i) [-66.32S151B19, ■ -74.39E* SIN(4.-3.-i) [-7. 61923172032, 6. 543 1> :C0SC-5.+7.-i) [155. 536303519, -525. 7^ :TRN(3.+3.-i) [-1.4340S15S162E-3, 1 . £► L0G(5.+3.-i) [. 765739453521 , . 23470 1* . 5.-4.-i [-e97. 0093146996, 1 12. 31> LN(5.-6.-i) !2 . 05543693209, -■ 3760^ „ R3IN(7.+3.-i) .71663915401, 3. 057141* , RC0S(8.+3.-i) [. 361040042712, -2. 3357^ :RTRN(-l.+2.-i) [-1.33397252229,-4023 Note: When using trigonometric functions and their inverses with complex numbers the arguments are no longer angles. Therefore, the angular measure selected for the calculator has no bearing in the calculation of these functions with complex arguments. To understand the way that trigonometric functions, and other functions, are defined for complex numbers consult a book on complex variables. Functions from the MTH menu The hyperbolic functions and their inverses, as well as the Gamma, PSI, and Psi functions (special functions) were introduced and applied to real numbers in Chapter 3. These functions can also be applied to complex numbers by following the procedures presented in Chapter 3. Some examples are shown below: :SIHHC4.-6.-i3 [26. 2029676173, 7. 6303^ :C0SHCl.-i3 [. 333730025131 ,-. 9333^ :TflNH(-l.+i) [- 1 . 03392332734, .27 1 7=> RSINH(7.-9.-i) |[3. 12644592412, -. 9073E* RC0SHC3.-i) 1.31344645923, 1.5707^ :RTRNH(l.-6.-i) C2. 634012S9145E-2, -1 . 4* b*<n:ir:^<n:iM.H;ir:Tro;iBfnn;ir:ifnn; Page 4-8 The following screen shows that functions EXPM and LNP1 do not apply to complex numbers. However, functions GAMMA, PSI, and Psi accept complex numbers: :GAMMA(4.+5.-i) : LKKru^. -D. -1J "Bad Argument Type" :LNPl(-9.-i) "Bad _Argument Type" [. 149655327961, ■314603* :PSI(l.-i,3.:i [-1 . 52237444395, . 3172E* :Psi(5.+9.-i) [2.30854964207, !■ 10681* Function DROITE: equation of a straight line Function DROITE takes as argument two complex numbers, say, x^iy! and x2+iy2/ and returns the equation of the straight line, say, y = a+bx, that contains the points (x^yj and (x2,y2). For example, the line between points A(5,-3) and B(6,2) can be found as follows (example in Algebraic mode): :DR0ITEC5-3-i,6+2-i) Y=5-(X-5)+-3 Function DROITE is found in the command catalog (Lr>J cat ). Using EVAL(ANS(1)) simplifies the result to: :DR0ITE(5-3-i,6+2-i) Y=5-(X-5)+-3 :EVfiL(fiNS(D) Y=5-X-28 Page 4-9 Chapter 5 Algebraic and arithmetic operations An algebraic object, or simply, algebraic, is any number, variable name or algebraic expression that can be operated upon, manipulated, and combined according to the rules of algebra. Examples of algebraic objects are the following: • A number: 1 2.3, 1 5.2_m, V, V, "\ • A variable name: 'a', 'ux', 'width', etc. • An expression: V°A2/4Vf WD)*(VA2/(2*g))' • An equation: /Q=(Cu/n)*A(y)*R(y)A(2/3)*SoA0.5, Entering algebraic objects Algebraic objects can be created by typing the object between single quotes directly into stack level 1 or by using the equation writer L r> j eqw . For example, to enter the algebraic object /7i*DA2/4/ directly into stack level 1 use:CZI3C5D5 CKD5^@CZDCII]C±I)C£l)^^) • The resulting screen is shown next for both the ALG mode (left-hand side) and the RPN mode (right- hand side): l: TT-D EaaBBnaMBBianMHBna An algebraic object can also be built in the Equation Writer and then sent to the stack. The operation of the Equation Writer was described in Chapter 2. As an exercise, build the following algebraic object in the Equation Writer: After building the object, press to show it in the stack (ALG and RPN modes shown below): a A l_ 1 D 2-9 2 f-V -L 3- l: 2 f-V -L 2-9-D 2-9-D Page 5-1 Simple operations with algebraic objects Algebraic objects can be added, subtracted, multiplied, divided (except by zero), raised to a power, used as arguments for a variety of standard functions (exponential, logarithmic, trigonometry, hyperbolic, etc.), as you would any real or complex number. To demonstrate basic operations with algebraic objects, let's create a couple of objects, say /7i*RA2/ and 'g*tA2/4', and store them in variables Al and A2 (See Chapter 2 to learn how to create variables and store values in them). Here are the keystrokes for storing variables Al in ALG mode:CDC3D5 CZD(^f3CZDCDCD Hz^t) ^™J(3L/J (^ter}, resulting in: The keystrokes corresponding to RPN mode are: CZDGDS [j^[alpha}(r} After storing the variable A2 and pressing the key, the screen will show the variables as follows: 2' >Fl2 4 In ALG mode, the following keystrokes will show a number of operations with the algebraics contained in variables EI3III and IE5II (press (j^J to recover variable menu): iiii-s-if-fMiii L+J iUi:::lllll [ENTER} :fll+fl2 2 2 4'R 'TT+t '9 IKIQIl [3D iEEII [enter) 2 2 4'R ■TT+t '9 :ni-n2 4 2 2 4-R -TT-t -9 4 Page 5-2 Ill QD iiii.:.!:::!i|n [ENTER] 2 2 4-R -TT-t -9 :fll-fl2 4 2 2 t -9-R -TT 4 :::::;:::*:::::: !;!!.:.!:.:!!!!! 1 : LHCRli 2 4-R -TT Lh(r£-tt. Sill GD A. . m 4 "H2 4-R -TT t£.9 L ^ J f jjjj. FI2 LnIr^-tt , 2 The same results are obtained in RPN mode if using the following keystrokes: liThiij [enter) iljiliilil [_ -|- j lITFlil {Jnter] liTPIl I — ] ilifiii f fa/7-0? i lliTilll f v i IElIIS [fly7»jj ISEOiil! GlD lEIDljj [enter] q=>j Functions in the ALG menu The ALG (Algebraic) menu is available by using the keystroke sequence LrU^S (associated with the LiU key). With system flag 1 1 7 set to ALG HEnU 2 . EMFHTlD 3. FACTOR H.LnCOLLECT 5. Lin G.PHRTFRHC RLG HEnU H.LnCOLLECT 0 5. Lin G.PARTFRRC I ? . SOLVE 1 3.SUEST 1 ™ ^^^^"1 Rather than listing the description of each function in this manual, the user is invited to look up the description using the calculator's help facility: [tool] [nxt] SIE1III [enter) . To locate a particular function, type the first letter of the function. For example, for function COLLECT, we type [alpha)® , then use the up and down arrow keys, <^>^3? , to locate COLLECT within the help window. To complete the operation press 139. Here is the help screen for function COLLECT: Page 5-3 COLLECT: Recursive f actoriza- tion of a polynomial oyer integers COLLECT t:X*2-4> See : EXFAHD FACTOR We notice that, at the bottom of the screen, the line See: EXPAND FACTOR suggests links to other help facility entries, the functions EXPAND and FACTOR. To move directly to those entries, press the soft menu key for EXPAND, and BIS for FACTOR. Pressing EMM, for example, shows the following information for EXPAND: EXPAND: I Expands and simplifies an algebraic expr- EXPflND<<X+2>*<X-2>> X--2-4 See : COLLECT SIMPLIFY The help facility provides not only information on each command, but also provides an example of its application. This example can be copied onto your stack by pressing the B333 soft menu key. For example, for the EXPAND entry shown above, press the soft menu key to get the following example copied to the stack (press [enter] to execute the command): :HELP : EXPANDECX+2MX-2H Thus, we leave for the user to explore the applications of the functions in the ALG (or ALGB) menu. This is a list o HP] HEHU 2 . e::fhnd 3. FACTOR H.mCOLLECT 5. Lin G.PHRTFRhC f the commands: hLG HEnu H . LRCOLLECT p 5. Lin 6 . PftRTFRflC I 7. SOLVE 1 Page 5-4 The help facility will show the following information on the commands: COLLECT: COLLECT: Recurs i u e f act or i za- tion of a polynomial oyer integers COLLECT <X*2-4> <X+2>*<X-2> See: EXPAND FACTOR EXPAND: EXPAND: expands and simplifies an algebraic expr- :XPAHD((X+2>*t:X-2>> X--2-4] See: COLLECT SIMPLIFY :ACTOR: FACTOR: Factorizes an integer □r a polynomial FACTOR <X*2-2> <X+J"2XX-J"2> See: EXPAND COLLECT i^i^imiMH^im^mtiLiiUji NCOLLECT: LNCOLLECT: Col lects logarithms LNCOLLECT < LN t X > +LN < Y > > LN(X*Y> See: TEXPAND UN: Linearization of exponent ials LIN<EXP<X>A2> EXP(2*X> See: TEXPAND TLIH PARTFRAC: WTFRAC: Performs partial frac- ■ ion decomposition on fraction sflRTFRflC<2XA2AXA2-l > > 2+l^<X-l>-l^<X+l> iee: PROPFRAC SOLVE: SOLVE: Solves a (.or a set of) o 1 y nom i a 1 equat i on 0LVE<XA4-l=3iX> £X=T2 X=--J"2 } See: LINSOLVE SOLVEVX SUBST: SUBST: Substitutes a ualue for a variable in an expression SUBST CA^2+1?A=2> 2^2+1 See: TEXPAND: TEXPAND: Expands transcendental f unct ions TEXPAND < EXP (X+Y>> EXP<X>*EXP(Y> See: LIN TLIN Page 5-5 Note: Recall that, to use these, or any other functions in the RPN mode, you must enter the argument first, and then the function. For example, the example for TEXPAND, in RPN mode will be set up as: CD C5D GD S™) (3 GD S™) (9 G^r) At this point, select function TEXPAND from menu ALG (or directly from the catalog L J cat ), to complete the operation. Other forms of substitution in algebraic expressions Functions SUBST, shown above, is used to substitute a variable in an expression. A second form of substitution can be accomplished by using the L r> J ^ (associated with the I key). For example, in ALG mode, the following entry will substitute the value x = 2 in the expression x+x2. The figure to the left shows the way to enter the expression (the substituted value, x=2, must be enclosed in parentheses) before pressing [enter) . After the (enter) key is pressed, the result is shown in the right-hand figure: :x+x^ x=2 2 2+2 In RPN mode, this can be accomplished by entering first the expression where the substitution will be performed (x+x2), followed by a list (see Chapter 8) containing the substitution variable, an space, and the value to be substituted, i.e., {x 2}. The final step is to press the keystroke combination: LxU I . T ■ 3: 2: X+X l: <x 2> CftSCMl HELP | | I 1 T ■ 3: 2: l: 2 2+2 The required keystrokes are the following: □J (ALPHA) [JT] (X) [TJ [ALPHA) [jT] (xj £YJ (^TER) C5D{j (^[^(^(j^(^(enter) ^(enter) Page 5-6 In ALG mode, substitution of more than one variable is possible as illustrated in the fo lowing example (shown before and after pressing [enter}) WEICfl=2,B=3) fl+JBI <fl=2,B=3> 2+J3 In RPN mode, it is also possible to substitute more than one variable at a time, as illustrated in the example below. Recall that RPN mode uses a list of variable names and values for substitution. 4: 3: 2: n+JE l: {R 2 E 3) CflSCHl HELP III! 4: 3: 2: l: 2+J3 A different approach to substitution consists in defining the substitution expressions in calculator variables and placing the name of the variables in the original expression. For example, in ALG mode, store the following variables: a+b :'tt+1'K TT+1 Then, enter the expression A+B: a+b :'tt+1>E TT+1 :fl+B Tr+a+b+1 The last expression entered is automatically evaluated after pressing the [enter} key, producing the result shown above. Operations with transcendental functions The calculator offers a number of functions that can be used to replace expressions containing logarithmic, exponential, trigonometric, and Page 5-7 hyperbolic functions in terms of trigonometric identities or in terms of exponential functions. The menus containing functions to replace trigonometric functions can be obtained directly from the keyboard by pressing the right-shift key followed by the 8 key, i.e., LHJ_™^ . The combination of this key with the left-shift key, i.e., L r> J exp&ln r produces a menu that lets you replace expressions in terms of exponential or natural logarithm functions. In the next sections we cover those menus in more detail. Expansion and factoring using log-exp functions The Cji Jexp&ln produces the following menu: EKFEin HERU 2 . E!!FM 3. Lin H.LRCOLLECT s.lrpi g.tekprrd EKFSJ.R HERU 2 . E!!FM 3. Lin H.LRCOLLECT s.lrfi g.tekfrrd Information and examples on these commands are available in the help facility of the calculator. Some of the command listed in the EXP&LN menu, i.e., LIN, LNCOLLECT, and TEXPAND are also contained in the ALG menu presented earlier. Functions LNP1 and EXPM were introduced in menu HYPERBOLIC, under the MTH menu (See Chapter 2). The only remaining function is EXPLN. Its description is shown in the left-hand side, the example from the help facility is shown to the EXPLN: Rewrites transcendent functions in terns of EXP and LH EXPLH(COS(X>> (EXPCi*X>+l^EXP(i*X>> See: SI NCOS EXP2HYP :HELP : EXPLHCC0SCX3) ei,X+ 1 e i-X e 2 Expansion and factoring using trigonometric functions TRIG HEMJ H.flsinaT S . H T H Tl 2 L" e.HftLFTfln L TRIG HERU | 7.SIRC0S S.TRRaSC s.THRasca 10.TC0LLECT ii.TEKPRRD |i2.TLin |l| Page 5-8 TRIG HERU 12 TLin f 13 TRIG 1H TRIGCOS 15 TRiGsin y 1G TRIGTfln 1 17.TSIHF 11 These functions allow to simplify expressions by replacing some category of trigonometric functions for another one. For example, the function ACOS2S allows to replace the function arccosine (acos(x)) with its expression in terms of orcsine (asin(x)). Description of these commands and examples of their applications are available in the calculator's help facility ((j^(j^CHD). The user is invited to explore this facility to find information on the commands in the TRIG menu. Notice that the first command in the TRIG menu is the HYPERBOLIC menu, whose functions were introduced in Chapter 2. Functions in the ARITHMETIC menu The ARITHMETIC menu contains a number of sub-menus for specific applications in number theory (integers, polynomials, etc.), as well as a number of functions that apply to general arithmetic operations. The ARITHMETIC menu is triggered through the keystroke combination l<n J^rith (associated with the CD key). With system flag 1 1 7 set to CHOOSE HRITH HERU 1 . IRTEGER.. 1 i 2.F0LYR0HIRL. | 3.H0DUL0.. H.FERHUTRTIOR.. 1 :FF 5.DIYIS G. FACTORS |j ! 8 i 1 ■: h n ■: l | ok RRITH HERU H.FERHUTATIOR.. | 5.DIYIS G. FACTORS I 7.LGCD :FF S.FROFFRAC j Out of this menu list, options 5 through 9 (D/V7S, FACTORS, LGCD, PROPFRAC, SIMP2) correspond to common functions that apply to integer numbers or to polynomials. The remaining options (7. INTEGER, 2. POLYNOMIAL, 3. MODULO, and 4. PERMUTATION) are actually sub-menus Page 5-9 of functions that apply to specific mathematical objects. This distinction between sub-menus (options 1 through 4) and plain functions (options 5 through 9) is made clear when system flag 1 1 7 is set to SOFT menus. Activating the ARITHMETIC menu ((Jnj arith_ ); under these circumstances, produces: Following, we present the help facility entries for the functions of options 5 through 9 in the ARITHMETIC menu: DIVIS: DIVIS: ~ List of divisors of a polynomial or integer :>IVlS<6> {6 3 2 See: FACTOR FACTORS: FACTORS: Returns irreduct ible factors of an integer or a polynomial FACTORS ^2-1 > £ X+l 1. X-l 1. -J\ See: FACTOR GCD (Greatest Common Denominator): GCD of a list of objects LGCD<£125,75,35» See: CCD PROPFRAC (proper fraction) :'RuPFRAC Splits a fraction into an integer part and a ■raction part ^ROPFRFlCt: 43^12} 3+7^13 iee: PARTFRAC SIMP2: EIMP2: Simplifies 2 objects by dividing them by their GCD SIMP2<XA3-liXA2-l> £X*-2+X+l?X+l} See: The functions associated with the ARITHMETIC submenus: INTEGER, POLYNOMIAL, MODULO, and PERMUTATION, are the following: INTEGER menu EULER Number of integers < n, co -prime with n Page 5-10 IABCUV Solves au + bv = c, with a,b,c = integers IBERNOULLI n-th Bernoulli number ICHINREM Chinese reminder for integers IDIV2 Euclidean division of two integers IEGCD Returns u,v, such that au + bv = gcd(a,b) IQUOT Euclidean quotient of two integers IREMAINDER Euclidean remainder of two integers ISPRIME? Test if an integer number is prime NEXTPRIME Next prime for a given integer number PA2B2 Prime number as square norm of a complex number PREVPRIME Previous prime for a given integer number POLYNOMIAL menu ABCUV Bezout polynomial equation (au+bv=c) CHINREM Chinese remainder for polynomials CYCLOTOMIC n-th cyclotomic polynomial DIV2 Euclidean division of two polynomials EGDC Returns u,v, from au+bv=gcd(a,b) FACTOR Factorizes an integer number or a polynomial FCOEF Generates fraction given roots and multiplicity FROOTS Returns roots and multiplicity given a fraction GCD Greatest common divisor of 2 numbers or polynomials HERMITE n-th degree Hermite polynomial HORNER Horner evaluation of a polynomial LAGRANGE Lagrange polynomial interpolation LCM Lowest common multiple of 2 numbers or polynomials LEGENDRE n-th degree Legendre polynomial PARTFRAC Partial-fraction decomposition of a given fraction PCOEF (help-facility entry missing) PTAYL Returns Q(x-a) in Q(x-a) = P(x), Taylor polynomial QUOT Euclidean quotient of two polynomials RESULTANT Determinant of the Sylvester matrix of 2 polynomials REMAINDER Euclidean reminder of two polynomials STURM Sturm sequences for a polynomial STURMAB Sign at low bound and number of zeros between bounds Page 5-1 1 MODULO menu ADDTMOD Add two expressions modulo current modulus DIVMOD Divides 2 polynomials modulo current modulus DIV2MOD Euclidean division of 2 polynomials with modular coefficients EXPANDMOD Expands/simplify polynomial modulo current modulus FACTORMOD Factorize a polynomial modulo current modulus GCDMOD GCD of 2 polynomials modulo current modulus INVMOD inverse of integer modulo current modulus MOD (not entry available in the help facility) MODSTO Changes modulo setting to specified value MULTMOD Multiplication of two polynomials modulo current modulus POWMOD Raises polynomial to a power modulo current modulus SUBTMOD Subtraction of 2 polynomials modulo current modulus Applications of the ARITHMETIC menu This section is intended to present some of the background necessary for application of the ARITHMETIC menu functions. Definitions are presented next regarding the subjects of polynomials, polynomial fractions and modular arithmetic. The examples presented below are presented independently of the calculator setting (ALG or RPN) Modular arithmetic Consider a counting system of integer numbers that periodically cycles back on itself and starts again, such as the hours in a clock. Such counting system is called a ring. Because the number of integers used in a ring is finite, the arithmetic in this ring is called finite arithmetic. Let our system of finite integer numbers consists of the numbers 0, 7 , 2, 3, n-1 , n. We can also refer to the arithmetic of this counting system as modular arithmetic of modulus n. In the case of the hours of a clock, the modulus is 12. (If working with modular arithmetic using the hours in a clock, however, we would have to use the integer numbers 0, 1,2, 3, 10, 11, rather than 1, 2, 3,...,1 1, 12). Page 5-12 Operations in modular arithmetic Addition in modular arithmetic of modulus n, which is a positive integer, follow the rules that if / and k are any two nonnegative integer numbers, both smaller than n, if j+k> n, then j+k is defined as j+k-n. For example, in the case of the clock, i.e., for n = 1 2, 6+9 "=" 3. To distinguish this 'equality' from infinite arithmetic equalities, the symbol = is used in place of the equal sign, and the relationship between the numbers is referred to as a congruence rather than an equality. Thus, for the previous example we would write 6+9 = 3 (mod 12), and read this expression as "six plus nine is congruent to three, modulus twelve." If the numbers represent the hours since midnight, for example, the congruence 6+9 = 3 (mod 1 2), can be interpreted as saying that "six hours past the ninth hour after midnight will be three hours past noon." Other sums that can be defined in modulus 1 2 arithmetic are: 2+5 = 7 (mod 1 2); 2+10 = 0 (mod 1 2); 7+5 = 0 (mod 1 2); etcetera. The rule for subtraction will be such that if / - k < 0, then j-k is defined as j-k+n. Therefore, 8-10 = 2 (mod 12), is read "eight minus ten is congruent to two, modulus twelve." Other examples of subtraction in modulus 12 arithmetic would be 10-5 = 5 (mod 1 2); 6-9 = 9 (mod 1 2); 5 - 8 = 9 (mod 1 2); 5-10 = 7 (mod 1 2); etcetera. Multiplication follows the rule that if j-k > n, so that j-k = m-n + r, where m and rare nonnegative integers, both less than n, then j-k = r (mod n). The result of multiplying / times k in modulus n arithmetic is, in essence, the integer remainder of j-k/ n in infinite arithmetic, if j-k>n. For example, in modulus 12 arithmetic we have 7-3 = 21 = 12 + 9, (or, 7-3/12 = 21/12 = 1 + 9/12, i.e., the integer reminder of 21/12 is 9). We can now write 7-3 = 9 (mod 1 2), and read the latter result as "seven times three is congruent to nine, modulus twelve." The operation of division can be defined in terms of multiplication as follows, r/k = j (mod n), if, j-k = r (mod n). This means that r must be the remainder of j-k/n. For example, 9/7 = 3 (mod 1 2), because 7-3 = 9 (mod 1 2). Some divisions are not permitted in modular arithmetic. For example, in modulus 12 arithmetic you cannot define 5/6 (mod 1 2) because the multiplication table of Page 5-13 6 does not show the result 5 in modulus 1 2 arithmetic. This multiplication table is shown below: 6*0 (mod 12) 0 6*6 (mod 12) 0 6*1 (mod 12) 6 6*7 (mod 12) 6 6*2 (mod 12) 0 6*8 (mod 12) 0 6*3 (mod 12) 6 6*9 (mod 12) 6 6*4 (mod 12) 0 6*10 (mod 12) 0 6*5 (mod 12) 6 6*11 (mod 12) 6 Formal definition of a finite arithmetic ring The expression a = b (mod n) is interpreted as "a is congruent to b, modulo n," and holds if (b-a) is a multiple of n. With this definition the rules of arithmetic simplify to the following: If a = b (mod n) and c = d (mod n), then o+c = b+d (mod nj, a-c = b - d (mod n), axe = bxd (mod n). For division, follow the rules presented earlier. For example, 17 = 5 (mod 6), and 21=3 (mod 6). Using these rules, we can write: 17 + 21 =5 + 3 (mod 6) => 38 = 8 (mod 6) => 38 = 2 (mod 6) 17-21=5-3 (mod 6) => -4=2 (mod 6) 17x21 = 5x3(mod6)=> 357 = 15 (mod 6) => 357 = 3 (mod 6) Notice that, whenever a result in the right-hand side of the "congruence" symbol produces a result that is larger than the modulo (in this case, n = 6), you can always subtract a multiple of the modulo from that result and simplify it to a number smaller than the modulo. Thus, the results in the first case 8 (mod 6) simplifies to 2 (mod 6), and the result of the third case, 75 (mod 6) simplifies to 3 (mod 6). Confusing? Well, not if you let the calculator handle those operations. Thus, read the following section to understand how finite arithmetic rings are operated upon in your calculator. Page 5-14 Finite arithmetic rings in the calculator All along we have defined our finite arithmetic operation so that the results are always positive. The modular arithmetic system in the calculator is set so that the ring of modulus n includes the numbers -n/2+1, ...,-1, 0, 1 ,...,n/2-l , n/2, if n is even, and -(n-l)/2, -(n-3)/2,...,-l ,0,1 ,...,(n-3)/2, (n-l)/2, if n is odd. For example, for n = 8 (even), the finite arithmetic ring in the calculator includes the numbers: (-3,-2,-1,0,1,3,4), while for n = 7 (odd), the corresponding calculator's finite arithmetic ring is given by (-3,-2,-1,0,1,2,3). Modular arithmetic in the calculator To launch the modular arithmetic menu in the calculator select the MODULO sub-menu within the ARITHMETIC menu (Ij^Jarith_ ). The available menu includes functions: ADDTMOD, DIVMOD, DIV2MOD, EXPANDMOD, FACTORMOD, GCDMOD, INVMOD, MOD, MODSTO, MULTMOD, POWMOD, and SUBTMOD. Brief descriptions of these functions were provided in an earlier section. Next we present some applications of these functions. Setting the modulus (or MODULO) The calculator contains a variable called MODULO that is placed in the {HOME CASDIR} directory and will store the magnitude of the modulus to be used in modular arithmetic. The default value of MODULO is 1 3. To change the value of MODULO, you can either store the new value directly in the variable MODULO in the sub- directory {HOME CASDIR} Alternatively, you can store a new MODULO value by using function MODSTO. Modular arithmetic operations with numbers To add, subtract, multiply, divide, and raise to a power using modular arithmetic you will use the functions ADDTMOD, SUBTMOD, MULTMOD, DIV2MOD and DIVMOD (for division), and POWMOD. In RPN mode you need to enter the two numbers to operate upon, separated by an [ENTER] or an [SPC] entry, and then press the corresponding modular arithmetic function. For example, using a modulus of 1 2, try the following operations: Page 5-15 ADDTMOD examples 6+5 = -1 (mod 12) 11+5 = 4 (mod 1 2) SUBTMOD examples 5 - 7 = -2 (mod 1 2) 11-8 = 3 (mod 1 2) MULTMOD examples 68 = 0 (mod 1 2) 5-6 = 6 (mod 12) DIVMOD examples 12/3 = 4 (mod 1 2) 25/5 = 5 (mod 1 2) 66/6 = -1 (mod 12) DIV2MOD examples 2/3 (mod 1 2) does not exist 26/1 2 (mod 1 2) does not exist 1 25/1 7 (mod 1 2) = 1 with remainder = 0 68/7 = -4 (mod 1 2) with remainder = 0 7/5 = -1 (mod 1 2) with remainder = 0 Note: DIVMOD provides the quotient of the modular division j/k (mod n), while DIMV2MOD provides no only the quotient but also the remainder of the modular division j/k (mod n). POWMOD examples 23= -4 (mod 1 2) 35= 3 (mod 1 2) 510= 1 (mod 1 2) 1 18= 1 (mod 12) 62=0 (mod 12) 99=-3 (mod 12) In the examples of modular arithmetic operations shown above, we have used numbers that not necessarily belong to the ring, i.e., numbers such as 66, 125, 17, etc. The calculator will convert those numbers to ring numbers 6+6 = 0 (mod 1 2) 6+7 = 1 (mod 1 2) 8+10 = -6 (mod 12) 8-4=4 (mod 12) 5 -1 0 = -5 (mod 1 2) 8 - 1 2 = -4 (mod 1 2) 9-8 = 0 (mod 12) 3-2 = 6 (mod 12) 1 1 -3 = -3 (mod 1 2) 1 2/8 (mod 1 2) does not exist 64/13 = 4 (mod 12) Page 5-16 before operating on them. You can also convert any number into a ring number by using the function EXPANDMOD. For example, EXPANDMOD(l 25) = 5 (mod 1 2) EXPANDMOD(l 7) = 5 (mod 1 2) EXPANDMOD(6) = 6 (mod 12) The modular inverse of a number Let a number k belong to a finite arithmetic ring of modulus n, then the modular inverse of k, i.e., 1/k (mod n), is a number /, such that j-k = 7 (mod n). The modular inverse of a number can be obtained by using the function INVMOD in the MODULO sub-menu of the ARITHMETIC menu. For example, in modulus 12 arithmetic: 1/11 =-1 (mod 12) The MOD operator The MOD operator is used to obtain the ring number of a given modulus corresponding to a given integer number. On paper this operation is written as m mod n = p, and is read as "m modulo n is equal to p". For example, to calculate 15 mod 8, enter: • ALG mode: CD CD MOD CDS • RPN mode: CDCDSCDS MOD The result is 7, i.e., 1 5 mod 8 = 7. Try the following exercises: 1 8 mod 1 1 = 7 23 mod 2 =1 40 mod 1 3 = 1 23 mod 17 = 6 34 mod 6 = 4 One practical application of the MOD function for programming purposes is to determine when an integer number is odd or even, since n mod 2 = 0, if n is even, and n mode 2 = 1, if n is odd. It can also be used to determine when an integer m is a multiple of another integer n, for if that is the case m mod n = 0. 1/6 (mod 1 2) does not exist. 1/7 = -5 (mod 12) 1/5 = 5 (mod 12) 1/3 (mod 1 2) does not exist. Page 5-17 Note: Refer to the help facility in the calculator for description and examples on other modular arithmetic. Many of these functions are applicable to polynomials. For information on modular arithmetic with polynomials please refer to a textbook on number theory. Polynomials Polynomials are algebraic expressions consisting of one or more terms containing decreasing powers of a given variable. For example, 'XA3+2*XA2-3*X+2' is a third-order polynomial in X, while 'SIN(X)A2-2' is a second-order polynomial in SIN(X). A listing of polynomial-related functions in the ARITHMETIC menu was presented earlier. Some general definitions on polynomials are provided next. In these definitions A(X), B(X), C(X), P(X), Q(X), U(X), V(X), etc., are polynomials. • Polynomial fraction: a fraction whose numerator and denominator are polynomials, say, C(X) = A(X)/B(X) • Roots, or zeros, of a polynomial: values of X for which P(X) = 0 • Poles of a fraction: roots of the denominator • Multiplicity of roots or poles: the number of times a root shows up, e.g., P(X) = (X+l)2(X-3) has roots {-1, 3} with multiplicities {2,1} • Cyclotomic polynomial (Pn(X)): a polynomial of order EULER(nj whose roots are the primitive n-th roots of unity, e.g., P2(X) = X+l, P4(X) = X2+l • Bezout's polynomial equation: A(X) U(X) + B(X)V(X) = C(X) Specific examples of polynomial applications are provided next. Modular arithmetic with polynomials The same way that we defined a finite-arithmetic ring for numbers in a previous section, we can define a finite-arithmetic ring for polynomials with a given polynomial as modulo. For example, we can write a certain polynomial P(X) as P(X) = X (mod X2), or another polynomial Q(X) = X + 7 (mod X-2). A polynomial, P(X) belongs to a finite arithmetic ring of polynomial modulus M(X), if there exists a third polynomial Q(X), such that (P(X) - Q(X)) is a multiple of M(X). We then would write: P(X) = Q(X) (mod M(X)). The later expression is interpreted as "P(X) is congruent to Q(X), modulo M(X)". Page 5-18 The CHINREM function CHINREM stands for CHINese REMainder. The operation coded in this command solves a system of two congruences using the Chinese Remainder Theorem. This command can be used with polynomials, as well as with integer numbers (function ICHINREM). The input consists of two vectors [expression^, modulo^] and [expression_2, modulo_2]. The output is a vector containing [expression_3/ modulo_3], where modulo_3 is related to the product (modulo_l).(modulo_2). Example: CHINREM(['X+1 ', 'XA2- r],[/x+r/xA2/]) = ['x+r,-(xA4-xA2)] Statement of the Chinese Remainder Theorem for integers If m7/ m2/...,mr are natural numbers every pair of which are relatively prime, and a7/ a2, ar are any integers, then there is an integer x that simultaneously satisfies the congruences: x =o} (mod mj, x =o2 (mod m2), x =ar (mod mr). Additionally, if x = a is any solution then all other solutions are congruent to a modulo equal to the product m7-m2- ... mr The EGCD function EGCD stands for Extended Greatest Common Divisor. Given two polynomials, A(X) and B(X), function EGCD produces the polynomials C(X), U(X), and V(X), so that C(X) = U(X)*A(X) + V(X)*B(X). For example, for A(X) = XA2+1 , B(X) = XA2-1, EGCD(A(X),B(X)) = {2, 1, -1}. i.e., 2 = 1*( XA2+T)-1*( XA2-1). Also, EGCD('XA3-2*X+5','X') = { 5, '-(XA2-2)', i}, j.e., 5 = - (XA2-2)*X + 1 *(XA3- 2*X+5). The GCD function The function GCD (Greatest Common Denominator) can be used to obtain the greatest common denominator of two polynomials or of two lists of polynomials of the same length. The two polynomials or lists of polynomials will be placed in stack levels 2 and 1 before using GCD. The results will be a polynomial or a list representing the greatest common denominator of the two polynomials or of each list of polynomials. Examples, in RPN mode, follow (calculator set to Exact mode): 'XA 3- 1 '[enter} 'Xa 2- 1 '[enter} GCD Results in: %V {'XA2+2*X+1','XA3+XA2'} [enter} {/XA3+r,,XA2+V} [enter} GCD results in fX+T 1} Page 5-19 The HERMITE function The function HERMITE [HERMI] uses as argument an integer number, k, and returns the Hermite polynomial of k-th degree. A Hermite polynomial, Hek(x) is defined as He0=l, Hen(x) = (-l)"e*2/2^(e-*2/2), n = l,2,.. ax An alternate definition of the Hermite polynomials is H* = l, Hn^x) = (-iyex2^(e-x2), n = \X- ax where dn/dxn = n-th derivative with respect to x. This is the definition used in the calculator. Examples: The Hermite polynomials of orders 3 and 5 are given by: HERMITE(3) = /8*XA3-12*X' And HERMITE(5) = '32*xA5-l 60*XA3+1 20*X'. The HORNER function The function HORNER produces the Horner division, or synthetic division, of a polynomial P(X) by the factor (X-a). The input to the function are the polynomial P(X) and the number a. The function returns the quotient polynomial Q(X) that results from dividing P(X) by (X-a), the value of a, and the value of P(a), in that order. In other words, P(X) = Q(X)(X-a)+P(a). For example, HORNER('XA3+2*XA2-3*X+r,2) = {'XA2+4*X+5', 2, 11}. We could, therefore, write X3+2X2-3X+1 = (X2+4X+5)(X-2)+l 1 . A second example: HORNER('XA6-l ,,-5)= {'XA5-5*XA4+25*XA3-1 25*XA2+625*X-31 25',-5, 15624} i.e., X6-l = (X5-5*X4+25X3-1 25X2+625X-31 25)(X+5)+l 5624. The variable VX A variable called VX exists in the calculator's {HOME CASDIR} directory that takes, by default, the value of 'X'. This is the name of the preferred independent variable for algebraic and calculus applications. Avoid using the variable VX in your programs or equations, so as to not get it confused with the CAS' VX. If you need to refer to the x-component of velocity, for example, you can use vx or Vx. For additional information on the CAS variable see Appendix C. Page 5-20 The LAGRANGE function The function LAGRANGE requires as input a matrix having two rows and n columns. The matrix stores data points of the form [[x1/x2/ xn] [yl7 y2/ yn]]. Application of the function LAGRANGE produces the polynomial expanded from n pn-Ax) = 2^—^ yr For example, for n = 2, we will write: p^=x~x2 y \x~*i y2 = (yi-y2)'x+(y2'xi-yrx2) OCy "^2 X-y OCy "^2 Check this result with your calculator: LAGRANGE([[ xl ,x2],[yl ,y2]]) = '((yl-y2)*X+(y2*xl-yl *x2))/(xl-x2)'. Other examples: LAGRANGE([[1 , 2, 3][2, 8, 15]]) = '(XA2+9*X-6)/2' LAGRANGE([[0.5,1.5,2.5,3.5,4.5][1 2. 2, 13.5, 19.2,27.3,32.5]]) = '-(.1 375*XA4+ -.7666666666667*XA3+ - .74375*XA2 = 1 .991 666666667*X-1 2.92265625)'. Note: Matrices are introduced in Chapter 1 0. The LCM function The function LCM (Least Common Multiple) obtains the least common multiple of two polynomials or of lists of polynomials of the same length. Examples: LCM('2*XA2+4*X+2' ,'XA2-1' ) = '(2*XA2+4*X+2)*(X-1 )'. LCM('XA3-1 ','XA2+2*X') = '(XA3-1 )*( XA2+2*X)' Page 5-21 The LEGENDRE function A Legendre polynomial of order n is a polynomial function that solves the differential equation (1 - x2) • — y- - 2 • x • — + n-(n + l)-y = 0 dx dx To obtain the n-th order Legendre polynomial, use LEGENDRE(n), e.g., LEGENDRE(3) = '(5*XA3-3*X)/2' LEGENDRE(5) = '(63*X A5-70*XA3+1 5*X)/8' The PCOEF function Given an array containing the roots of a polynomial, the function PCOEF generates an array containing the coefficients of the corresponding polynomial. The coefficients correspond to decreasing order of the independent variable. For example: PCOEF([-2,-l,0,l,l,2]) = [1. -1 . -5. 5. 4. -4. 0.], which represents the polynomial X6-X5-5X4+5X3+4X2-4X. The PROOT function Given an array containing the coefficients of a polynomial, in decreasing order, the function PROOT provides the roots of the polynomial. Example, from X2+5X-6 =0, PROOT([l, -5, 6]) = [2. 3.]. The PTAYL function Given a polynomial P(X) and a number a, the function PTAYL is used to obtain an expression Q(X-a) = P(X), i.e., to develop a polynomial in powers of (X- a). This is also known as a Taylor polynomial, from which the name of the function, Polynomial & TAYLor, follow: For example, PTAYL('XA3-2*X+2',2) = 'XA3+6*XA2+1 0*X+6'. In actuality, you should interpret this result to mean '(X-2) A3+6*(X-2) A2+10*(X-2) +6'. Let's check by using the substitution: 'X = x - 2'. We recover the original polynomial, but in terms of lower-case x rather than upper-case x. Page 5-22 The QUOT and REMAINDER functions The functions QUOT and REMAINDER provide, respectively, the quotient Q(X) and the remainder R(X), resulting from dividing two polynomials, P^X) and P2(X). In other words, they provide the values of Q(X) and R(X) from Pi(X)/P2(X) = Q(X) + R(X)/P2(X). For example, QUOT(XA3-2*X+2, X-l) = XA2+X-1 REMAINDER(XA3-2*X+2, X-l) = 1. Thus, we can write: (X3-2X+2)/(X-l ) = X2+X-l + 1/(X-1 ). Note: you could get the latter result by using PROPFRAC: PROPFRAC('(XA3-2*X+2)/(X-l)') = 'XA2+X-1 + 1/(X-1)'. The EPSXO function and the CAS variable EPS The variable s (epsilon) is typically used in mathematical textbooks to represent a very small number. The calculator's CAS creates a variable EPS, with default value 0.0000000001 = 1010, when you use the EPSXO function. You can change this value, once created, if you prefer a different value for EPS. The function EPSXO, when applied to a polynomial, will replace all coefficients whose absolute value is less than EPS with a zero. Function EPSXO is not available in the ARITHMETIC menu, it must be accessed from the function catalog (N). Example: EPSX0('XA3-1 .2E-1 2*XA2+1 .2E-6*X+6.2E-1 1 )= /XA3-0*XA2+.000001 2*X+0'. With GmT): 'Xa3+.0000012*X'. The PEVAL function The functions PEVAL (Polynomial EVALuation) can be used to evaluate a polynomial p(x) = on-xn+on.rx n']+ ...+ o2-x2+arx+ a0, given an array of coefficients [an, on.u ... a2/ a7/ a0] and a value of x0. The result is the evaluation p(x0). Function PEVAL is not available in the ARITHMETIC menu, it must be accessed from the function catalog (,N). Example: PEVAL([1,5,6,1],5) = 281. Page 5-23 The TCHEBYCHEFF function The function TCHEBYCHEFF(n) generates the Tchebycheff (or Chebyshev) polynomial of the first kind, order n, defined as Tn(X) = cos(n-arccos(X)). If the integer n is negative (n < 0), the function TCHEBYCHEFF(n) generates the Tchebycheff polynomial of the second kind, order n, defined as Tn(X) = sin(n-arccos(X))/sin(orccos(X)). Examples: TCHEBYCHEFF(3) = 4*XA3-3*X TCHEBYCHEFF(-3) = 4*XA2-1 Fractions Fractions can be expanded and factored by using functions EXPAND and FACTOR, from the ALG menu (,x). For example: EXPAND('(l+X)A3/((X-l)(X+3))') = '(XA3+3*XA2+3*X+1 )/(XA2+2*X-3)' EXPAND('(XA2*(X+Y)/(2*X-XA2)A2') = '(X+Y)/(XA2-4*X+4)' EXPANDp<*(X+Y)/(XA2-l)') = ,(XA2+Y*X)/(XA2-1 )' EXPAND('4+2*(X-1 )+3/((X-2)*(X+3))-5/XA2') = /(2*XA5+4*XA4-10*XA3-14*XA2-5*X)/(XA4+XA3-6*XA2), FACTOR('(3*XA3-2*XA2)/(XA2-5*X+6)') = 'XA2*(3*X-2)/((X-2)*(X-3))/ FACTOR('(XA3-9*X)/(XA2-5*X+6)' ) = 'X*(X+3)/(X-2)' FACTOR('(XA2-l)/(XA3*Y-Y)') = '(X+l )/((XA2+X+l )*Y)' TheSIMP2 function Functions SIMP2 and PROPFRAC are used to simplify a fraction and to produce a proper fraction, respectively. Function SIMP2 takes as arguments two numbers or polynomials, representing the numerator and denominator of a rational fraction, and returns the simplified numerator and denominator. For example: SIMP2(/XA3-r/XA2-4*X+3/) = { /XA2+X+r,/X-3/}. The PROPFRAC function The function PROPFRAC converts a rational fraction into a "proper" fraction, i.e., an integer part added to a fractional part, if such decomposition is possible. For example: Page 5-24 PROPFRAC('5/4') = '1+1/4' PROPFRAC('(xA2+l)/xA2') = 'l+l/xA2' The PARTFRAC function The function PARTFRAC decomposes a rational fraction into the partial fractions that produce the original fraction. For example: PARTFRAC(/(2*XA6-14*XA5+29*XA4-37*XA3+41*XA2-16*X+5)/(XA5- 7*XA4+1 1 *XA3-7*XA2+1 0*X)') = '2 *X+( 1 /2/(X-2)+5/(X-5)+ 1 /2/X+X/(XA 2+ 1 ))' This technique is useful in calculating integrals (see chapter on calculus) of rational fractions. If you have the Complex mode active, the result will be: '2 *X+( 1 /2/(X+i)+ 1 /2/(X-2)+5/(X-5)+ 1 /2/X+ 1 /2/(X-i))' The FCOEF function The function FCOEF is used to obtain a rational fraction, given the roots and poles of the fraction. Note: If a rational fraction is given as F(X) = N(X)/D(X), the roots of the fraction result from solving the equation N(X) = 0, while the poles result from solving the equation D(X) = 0. The input for the function is a vector listing the roots followed by their multiplicity (i.e., how many times a given root is repeated), and the poles followed by their multiplicity represented as a negative number. For example, if we want to create a fraction having roots 2 with multiplicity 1, 0 with multiplicity 3, and -5 with multiplicity 2, and poles 1 with multiplicity 2 and -3 with multiplicity 5, use: FCOEF([2 10 3 -5 21-2-3 -5]) = /(X-5)A2*XA3*(X-2)/(X-3)A5*(X-l )A2' Page 5-25 If you press Ieval) you will get: /(XA6+8*XA5+5*XA4-50*XA3)/(XA7+13*XA6+61*XA5+105*XA4-45*XA3- 297*XA2-81*X+243)' The FROOTS function The function FROOTS obtains the roots and poles of a fraction. As an example, applying function FROOTS to the result produced above, will result in: [1 -2. -3 -5. 0 3.2 1.-5 2.]. The result shows poles followed by their multiplicity as a negative number, and roots followed by their multiplicity as a positive number. In this case, the poles are (1, -3) with multiplicities (2,5) respectively, and the roots are (0, 2, -5) with multiplicities (3, 1, 2), respectively. Another example is: FROOTS('(XA2-5*X+6)/(XA5-XA2)> [0 -2.1 -1 .3 1 .2 1 .]. i.e., poles = 0 (2), 1 (1 ), and roots = 3(1 ), 2(1 ). If you have had Complex mode selected, then the results would be: [0-2. 1 -1. '-((l+i*V3)/2'-l. '-((l-i*V3)/2'-l.]. Step-by-step operations with polynomials and fractions By setting the CAS modes to Step/step the calculator will show simplifications of fractions or operations with polynomials in a step-by-step fashion. This is very useful to see the steps of a synthetic division. The example of dividing X3 -5X2 +3X-2 X-2 is shown in detail in Appendix C. The following example shows a lengthier synthetic division: X9-l X2-l j I V2<XA9-1?XA2-1) ■l^i'utiiMiiiittti^i'M^i^uiiiaiii Division H=BQ+R R: :: 1 , 0, 9, U, 9, U, G, U, G, B: a,e,-i> R: £0? 1,0,0,0,0,0,0,-1 ^ress a key to 90 on ■l^l'UtliMllilWtl^I'M^l^tllliaili Page 5-26 ^iuision fl=BQ+R h: ■:: i , u? y, u, q, q, i-j, q, g, B: 0,0,-1} Q: U,8> r: tiPes0,0,e,0,eP-i> Press a ke^j to 90 on fl: t 1?0,0?0?0?0?0?0?0? B: £1,8,-1} ^ £1,0,0,0,0,-1} Press a key to 90 on Muision fl=BQ+R =i: £1,0,0,0,0,0,0,0,0, B: £1,0,-1} Q: £1,0,1} R: £0,1,0,0,0,0,-1} Press a key to 90 on pyi^M!Mnai^mpwc|iMiai«Miio pyii^M;Mnai^M|nwc|iMiai«Miio Myision H=BQ+R division H=BQ+R wision H=BQ+ R: £1,0,0,0,0,0,0,0,0, B: £1,0,-1} Q: £1,0,1,0,1} R: £0,1,0,0,-1} Press a key to 90 on A E: ■! U V I C H I Ti F; I C V C L ■:■ | DI'.'3 | EGCD FACTO MABCUVCHinRCYCLO DI'.'2 I EG CD IFiiCTu ^lyision R=BQ+R =i: £1,0,0,0,0,0,0,0,0, B: £1,0,-1} Q: £1,0,1,0,1,0,1} Jiuision R=BQ+R £1,0,0,0,0,0,0,0,0, B: £1,0, -1} Q: £1,0, 1,0, 1,0} £1,0,0,-1} ^ress a key to 90 on ii:iil^tiir,iiiiitttwim-tl^i'igiH^ i vision H=BQ+ =|: £1,0,0,0,0,0,0,0,0, B: £1,0,-1} Q: £1,0, 1,0, 1,0, 1,0} R: £1,-1} ^ress a key to 90 on siMBHaiiiaHBBEsai^aBHa W ■ '.1 lUj 1 lUj R: £0,1,-1} ^ress a key to 90 on :DIV2(x9-lJX2-l) {q:(x7+X5+X3+x) R:CX-1)) BMBHEiiaHBBESai^aBHE The CONVERT Menu and algebraic operations The CONVERT menu is activated by using HT1 convert key (the CS key). This menu summarizes all conversion menus in the calculator. The list of these menus is shown next: ■: ■:■ n ■■■ert hehu 3. EASE.. 3. TRIG COnV.. H . REHRITE.. S . MhTRIX C0FWERT.. The functions available in each of the sub-menus are shown next. UNITS convert menu (Option 1) This menu is the same as the UNITS menu obtained by using L r> j UNITSs . The applications of this menu are discussed in detail in Chapter 3. Page 5-27 BASE convert menu (Option 2) This menu is the same as the UNITS menu obtained by using (j^JJ^ . The applications of this menu are discussed in detail in Chapter 19. TRIGONOMETRIC convert menu (Option 3) This menu is the same as the TRIG menu obtained by using L r> j trig . The applications of this menu are discussed in detail in this Chapter. MATRICES convert menu (Option 5) HRTRIK CORYERT HERU ^^^^^^ r.GKR H.SYST3HRT 5 . CORYERT.. These functions are discussed in detail in Chapter 10. REWRITE convert menu (Option 4) REHRITE HERU 3.EKPLR 3.EKP3P0H H.FDISTRIE 5.I-»R e.LIR REHRITE HERU ? . LRCOLLECT E . POHEXPRRD 5 . SIHPLIFY 10.-H1UH REHRITE HERU 3. SIHPLIFY lLl.-*flUH ii. ia.-^n 13.R-H Functions l->R and R->l are used to convert a number from integer (I) to real (R), or vice versa. Integer numbers are shown without trailing decimal points, while real numbers representing integers will have a trailing decimal point, e.g., Page 5-28 5. :R+I(12.:i 12 Function ->NUM has the same effect as the keystroke combination Lr^J^M^f (associated with the (enter} key). Function ->NUM converts a symbolic result into its floating-point value. Function ->Q converts a floating-point value into a fraction. Function ->G)7i converts a floating-point value into a fraction of n, if a fraction of n can be found for the number; otherwise, it converts the number to a fraction. Examples are of these three functions are shown next. :+Q(£.5533) ■B660254037B5 25533 10000 :+Qtt(.7586) 3793 5000 +Qtt(2. 09439510239) M BitiiiHitiiEC'HII'HO'HllEia Out of the functions in the REWRITE menu, functions DISTRIB, EXPLN, EXP2POW, FDISTRIB, LIN, LNCOLLECT, POWEREXPAND, and SIMPLIFY apply to algebraic expressions. Many of these functions are presented in this Chapter. However, for the sake of completeness we present here the help- facility entries for these functions. DISTRIB EXPLN EXPLN: Rewrites transcendent- functions in terms of EXP and LH explh<:cos<:x>:> <EXP<i*X> + l^EXP<i*X>>„, See: SI NCOS EXP2HYP :TSTRTF: 5t ep-^st ep d i st r i but i on nf * and s oyer +and - )istrib<<x+y)*<z+1>> x*<z+i>+y*<z+i> See: FDISTRIB EXP2POW EXP2P0N: ?ewr i t e exp <! a*Ln £ b > > as b--a EXP2P0N < EXP < X*LN < Y > ) ) See: FDISTRIB FDISTRIB: Full distribution of * and s oyer + and - FDISTRIB<<X+Y>*<Z+1>) Z*X+1*X+Z*Y+1*M See: DISTRIB Page 5-29 IN Linearization of exponent ials LIN<EXP<X>A2> See : TEXFRHD TLIH LNCOLLECT UNCOLLECT: Coll ect s 1 ogar i t hms LHCOLLECT (. LH (. X > +LH (. Y LHt!X*Y> See: TEXFRHD EaiE5mE3aE3aE3aiinil POWEREXPAND PONEXPRHD: I Step^step expansion of cowers 30WEXPfMK<X+Y>A2> «+Y>*t:X+Y> See: SIMPLIFY SIMPLIFY: I Attempts to simplify an expression SIMPLIFY<SIH<3X>^SIH<H >) 4*C0S<X>A2-1 See : EXFRHD COLLECT Page 5-30 Chapter 6 Solution to single equations In this chapter we feature those functions that the calculator provides for solving single equations of the form f(X) = 0. Associated with the L 7 J key there are two menus of equation-solving functions, the Symbolic SOLVer J5zv_ ), and the NUMerical SoLVer (©» ). Following, we present some of the functions contained in these menus. Change CAS mode to Complex for these exercises (see Chapter 2). Symbolic solution of algebraic equations Here we describe some of the functions from the Symbolic Solver menu. Activate the menu by using the keystroke combination . With system flag 1 1 7 s.slv HEnu a.isoL 3. LDEC H.LinSOLVE S . SOLVEVK 6 . SOLVE S.SLV HEnu a.isoL ?■ . LDEC H.LinSOLVE 5 . SOLVEVK 6. SOLVE Functions DESOLVE and LDEC are used for the solution of differential equations, the subject of a different chapter, and therefore will not be presented here. Similarly, function LINSOLVE relates to the solution of multiple linear equations, and it will be presented in a different chapter. Functions ISOL and SOLVE can be used to solve for any unknown in a polynomial equation. Function SOLVEVX solves a polynomial equation where the unknown is the default CAS variable VX (typically set to X). Finally, function ZEROS provides the zeros, or roots, of a polynomial. Entries for all the functions in the S.SLV menu, except ISOL, are available through the CAS help facility ((^(W)III1H ). Function ISOL Function ISOL(Equation, variable) will produce the solution(s) to Equation by isolating variable. For example, with the calculator set to ALG mode, to solve for t in the equation at3-bt = 0 we can use the following: Page 6-1 Using the RPN mode, the solution is accomplished by entering the equation in the stack, followed by the variable, before entering function ISOL. Right before the execution of ISOL, the RPN stack should look as in the figure to the left. After applying ISOL, the result is shown in the figure to the right: 3: a-t -b-t l: 't 1 MitiiffltiCE'nirnqi'MMtuaj The first argument in ISOL can be an expression, as shown above, or an equation. For example, in ALG mode, try: CflS CH| HELP Note: To type the equal sign (=) in an equation, use = (associated with the (JtJ key). The same problem can be solved in RPN mode as illustrated below (figures show the RPN stack before and after the application of function ISOL): 3: 2: CfiSCH HELP 2 2 2: 1= I. _ bl+j5k ,_tl+J5)j! L:"" 2 X" 2 Function SOLVE Function SOLVE has the same syntax as function ISOL, except that SOLVE can also be used to solve a set of polynomial equations. The help-facility entry for function SOLVE, with the solution to equation XA4 - 1 = 3 , is shown next: EOLVE: I Solves a tor a set of) po 1 y nom i a 1 equat i on S0LVE<XA4-l=3iX> CA=T2 X=-T2 J- See: LIHSOLVE SOLVEVX fri!¥iira!PlM*ww.iM*«i;r™^ Page 6-2 The following examples show the use of function SOLVE in ALG and RPN modes: isoi-veCp^s-p^s'/p1) S0LVE('p4-5-p=6,;pi 3=-ip=2 p=-l±^E3 ta[fiiH[fiEEgiiigiqNi«tii^l The screen shot shown above displays two solutions. In the first one, p4-5p = 1 25, SOLVE produces no solutions { }. In the second one, p4 - 5p = 6, SOLVE produces four solutions, shown in the last output line. The very last solution is not visible because the result occupies more characters than the width of the calculator's screen. However, you can still see all the solutions by using the down arrow key fs^?), which triggers the line editor (this operation can be used to access any output line that is wider than the calculator's screen): : S0LVEl>tfr-5*p=6";§i. [p=-l p=2 p=-^El p=-^ Cp=-l,p=2?p=-<: a + i+T ll>^2?,p=-<<l-i*J"ll V The corresponding RPN screens for these two examples, before and after the application of function SOLVE, are shown next: 3: 2: p -5-p=125 «p« l: 'p 4: 3: 2: l: {p=-ip=2 p=-A±^EU tamiHiHEEgiiigiqigiMtiiad Use of the down-arrow key (<\3?) in this mode will launch the line editor: ■6=2' 'p=-< ■:: ■2V 'p=-( a- l+i*Tll)/2 i*-J"llV2V > Page 6-3 Function SOLVEVX The function SOLVEVX solves an equation for the default CAS variable contained in the reserved variable name VX. By default, this variable is set to 'X'. Examples, using the ALG mode with VX = 'X', are shown below: S0LVEVx(x5-a-X=b) SOLVEVx(x5-6-X=20) X=2 In the first case SOLVEVX could not find a solution. In the second case, SOLVEVX found a single solution, X = 2. The following screens show the RPN stack for solving the two examples shown above (before and after application of SOLVEVX): The equation used as argument for function SOLVEVX must be reducible to a rational expression. For example, the following equation will not processed by SOLVEVX: iSOLVEVXtJX^JX + l) "Hot reducible to a r... A SOLVEVX Error: Hot reducible to a rational expression "Hot reducible to a i r„, Function ZEROS The function ZEROS finds the solutions of a polynomial equation, without showing their multiplicity. The function requires having as input the expression for the equation and the name of the variable to solve for. Examples in ALG mode are shown next: :ZER0s(k5-k^k) (01-!±U3 l-i-J3 ) ( : ZER0slmD=32,mJ 2'j'TT 4'1'TT SKIPH -KjEL DEL-* DEL L ins i __ 6'j'TT 2-e 5 2-e 5 2-e 5 aiHJHiHCE'HII'HO-HllIiigJ Page 6-4 To use function ZEROS in RPN mode, enter first the polynomial expression, then the variable to solve for, and then function ZEROS. The following screen shots show the RPN stack before and after the application of ZEROS to the two examples above: 2: l: 0 1 - l + i-J3 l-i-J3 2 2 ^if1iPJif1CE'J1ll'J1^JI'jmIIig 2-j-TT 6-i 2-e 5 2-e 5 2-e aiHJHiHCE'Hii'Hai'Hiaiijg] The Symbolic Solver functions presented above produce solutions to rational equations (mainly, polynomial equations). If the equation to be solved for has all numerical coefficients, a numerical solution is possible through the use of the Numerical Solver features of the calculator. Numerical solver menu The calculator provides a very powerful environment for the solution of single algebraic or transcendental equations. To access this environment we start the numerical solver (NUM.SLV) by using L r> Jnumslv . This produces a drop- down menu that includes the following options: 2 Solus diFF sg.. 3 Solus poly.. H Solus lin fyf.. 5 Solus financs.. 6 HSLY Item 2. Solve cliff eq.. is to be discussed in a later chapter on differential equations. Item 4. Solve lin sys.. will be discussed in a later Chapter on matrices. Item 6. MSL V (Multiple equation SoLVer) will be presented in the next chapter. Following, we present applications of items 3. Solve poly.., 5. Solve finance, and 7. Solve equation.., in that order. Appendix 1-A, at the end of Chapter 1, contains instructions on how to use input forms with examples for the numerical solver applications. Page 6-5 Notes: 1 . Whenever you solve for a value in the NUM.SLV applications, the value solved for will be placed in the stack. This is useful if you need to keep that value available for other operations. 2. There will be one or more variables created whenever you activate some of the applications in the NUM.SLV menu. Polynomial Equations Using the Solve poly... option in the calculator's SOLVE environment you can: (1 ) find the solutions to a polynomial equation; (2) obtain the coefficients of the polynomial having a number of given roots; (3) obtain an algebraic expression for the polynomial as a function of X. Finding the solutions to a polynomial equation A polynomial equation is an equation of the form: onxn + an.7xn"7 + ...+ o7x + o0 = 0. The fundamental theorem of algebra indicates that there are n solutions to any polynomial equation of order n. Some of the solutions could be complex numbers, nevertheless. As an example, solve the equation: 3s4 + 2s3 - s + 1 = 0. We want to place the coefficients of the equation in a vector [0^0^,01 a0]. For this example, let's use the vector [3,2,0,-1,1]. To solve for this polynomial equation using the calculator, try the following: {j^hiMsiv mm Select Solve poly. . . EDS— QDO 'CX3CB > CD CD > CD CD CD l CD EH Enter vector of coefficients lliHIIIl Solve equation The screen will show the solution as follows: SOLVE fln-KAn+..+fli K+flD Coefficients [ an .. oi ] = [3. ,2. j0. ? 1. ] Enter roots or press SOLVE Page 6-6 Press [enter] to return to stack. The stack will show the following results in ALG mode (the same result would be shown in RPN mode): Roots: [(, 432194894623, * To see all the solutions, press the down-arrow key (<\3?) to trigger the line editor: Roots: [(. 432194094623, > : Roots: [ < . 432194B94623,-.3S9... All the solutions are complex numbers: (0.432,-0.389), (0.432,0.389), (- 0.766, 0.632), (-0.766, -0.632). Note: Recall that complex numbers in the calculator are represented as ordered pairs, with the first number in the pair being the real part, and the second number, the imaginary part. For example, the number (0.432,-0.389), a complex number, will be written normally as 0.432 - 0.389/, where / is the imaginary unit, i.e., i2 = -1 . Note: The fundamental theorem of algebra indicates that there are n solutions for any polynomial equation of order n. There is another theorem of algebra that indicates that if one of the solutions to a polynomial equation with real coefficients is a complex number, then the conjugate of that number is also a solution. In other words, complex solutions to a polynomial equation with real coefficients come in pairs. That means that polynomial equations with real coefficients of odd order will have at least one real solution. Generating polynomial coefficients given the polynomial's roots Suppose you want to generate the polynomial whose roots are the numbers [1,5, -2, 4]. To use the calculator for this purpose, follow these steps: {jfjmw ^7 ^7 lilEHS CB > CD (JtJ CB > GD liiil missa Select Solve poly... Enter vector of roots Solve for coefficients Page 6-7 Press [enter] to return to stack, the coefficients will be shown in the stack. Coefficient; [ an .. ol afl ] : ■CI. i-B. i9. i3B . ,-40. ]| [ 1 ■ - 5 - - -2- - 4- Enter coefficients or ] press SOLVE EDIT | | ! Press ^3? to trigger the line editor to see all the coefficients. Note: If you want to get a polynomial with real coefficients, but having complex roots, you must include the complex roots in pairs of conjugate numbers. To illustrate the point, generate a polynomial having the roots [1 (1,2) (1,-2)]. Verify that the resulting polynomial has only real coefficients. Also, try generating a polynomial with roots [1 (1,2) (-1,2)], and verify that the resulting polynomial will have complex coefficients. Generating an algebraic expression for the polynomial You can use the calculator to generate an algebraic expression for a polynomial given the coefficients or the roots of the polynomial. The resulting expression will be given in terms of the default CAS variable X. (The examples below shows how you can replace X with any other variable by using the function | .) To generate the algebraic expression using the coefficients, try the following example. Assume that the polynomial coefficients are [1,5,-2,4]. Use the following keystrokes: {J+Jnumslv 111!! EDO— CDCB '(X) C3 > CD (jlD O > GD IIEI C±^> ::::;::.::.:.i.:;:h (enter} Select Solve poly... Enter vector of coefficients Generate symbolic expression Return to stack. The expression thus generated is shown in the stack as: 'XA3+5*XA2+-2*X+4'. Page 6-8 To generate the algebraic expression using the roots, try the following example. Assume that the polynomial roots are [1,3,-2,1]. Use the following keystrokes: C3 > (X) CB > CD E™ ^3? iiini [Qmw ^7 ^7 Ij:[|S! Select Solve poly... Enter vector of roots Generate symbolic expression Return to stack. The expression thus generated is shown in the stack as:'(X-l )*(X-3)*(X+2)*(X-1 )'. To expand the products, you can use the EXPAND command. The resulting expression is: 'XA4+-3*XA3+ -3*XA2+1 1 *X-6'. A different approach to obtaining an expression for the polynomial is to generate the coefficients first, then generate the algebraic expression with the coefficients highlighted. For example, for this case try: {J^nww mm Select Solve poly. . . ^3?CED£ CDO 'CD Enter vector of roots The expression thus generated is shown in the stack as: 'XA4+-3*XA3+ - 3*XA2+1 1 *X+-6*XA0\ The coefficients are listed in stack level 2. Financial calculations The calculations in item 5. Solve finance., in the Numerical Solver (NUM.SLV) are used for calculations of time value of money of interest in the discipline of engineering economics and other financial applications. This application can also be started by using the keystroke combination [jij(s\ finance (associated with the L 9 j key). Before discussing in detail the operation of this solving environment, we present some definitions needed to understand financial operations in the calculator. Solve for coefficients Generate symbolic expression Return to stack. Page 6-9 Definitions Often, to develop projects, it is necessary to borrow money from a financial institution or from public funds. The amount of money borrowed is referred to as the Present Value (PV). This money is to be repaid through n periods (typically multiples or sub-multiples of a month) subject to an annual interest rate of l%YR. The number of periods per year (P/YR) is an integer number of periods in which the year will be divided for the purpose of repaying the loan money. Typical values of P/YR are 1 2 (one payment per month), 24 (payment twice a month), or 52 (weekly payments). The payment(PI\Al) is the amount that the borrower must pay to the lender at the beginning or end of each of the n periods of the loan. The future value of the money (FV) is the value that the borrowed amount of money will be worth at the end of n periods. Typically payment occurs at the end of each period, so that the borrower starts paying at the end of the first period, and pays the same fixed amount at the end of the second, third, etc., up to the end of the n-th period. Example 1 - Calculating payment on a loan If $2 million are borrowed at an annual interest rate of 6.5% to be repaid in 60 monthly payments, what should be the monthly payment? For the debt to be totally repaid in 60 months, the future values of the loan should be zero. So, for the purpose of using the financial calculation feature of the calculator we will use the following values: n = 60, l%YR = 6.5, PV = 2000000, FV = 0, P/YR =12. To enter the data and solve for the payment, PMT, use: B J finance Start the financial calculation input form 68 MM Enter n = 60 6 « 5 EES 2888880 IB11 ^ cd rasa Enter l%YR = 6.5 % Enter PV = 2,000,000 US$ Skip PMT, since we will be solving for it Enter FV = 0, the option End is highlighted Highlight PMT and solve for it The solution screen will look like this: j$H»TIHE VALUE OF HOriEV^^ n= 60 IXVR: 6. 5 PV: 2000000-00 fv: 0.00 End Enter pa^Hgnt OHOunt or_ SOLV E Page 6-10 The screen now shows the value of PMT as -39,1 32.30, i.e., the borrower must pay the lender US $ 39,1 32.30 at the end of each month for the next 60 months to repay the entire amount. The reason why the value of PMT turned out to be negative is because the calculator is looking at the money amounts from the point of view of the borrower. The borrower has + US $ 2,000,000.00 at time period t = 0, then he starts paying, i.e., adding -US $ 391 32.30 at times t = 1 , 2, 60. At t = 60, the net value in the hands of the borrower is zero. Now, if you take the value US $ 39,1 32.30 and multiply it by the 60 payments, the total paid back by the borrower is US $ 2,347,937.79. Thus, the lender makes a net profit of $ 347,937.79 in the 5 years that his money is used to finance the borrower's project. Example 2 - Calculating amortization of a loan The same solution to the problem in Example 1 can be found by pressing 13103, which is stands for AMORTIZATION. This option is used to calculate how much of the loan has been amortized at the end of a certain number of payments. Suppose that we use 24 periods in the first line of the amortization screen, i.e., L2JLiJ EM. Then, press EIHIII. You will get the following result: mmmmmmm ™™™™ §§§ AHORTIZE §§§§§§§§§§§§§§§§§§§§§§§ Parents = 24 Principal.: Interest = -215963. 68 Balance: 1276788.57 This screen is interpreted as indicating that after 24 months of paying back the debt, the borrower has paid up US $ 723,21 1 .43 into the principal amount borrowed, and US $ 215,963.68 of interest. The borrower still has to pay a balance of US $1,276,788.57 in the next 36 months. Check what happens if you replace 60 in the Payments: entry in the amortization screen, then press 111:1 llllllllIElLlllllil. The screen now looks like this: Parents = 60 Principal -2000000.00 M Interest: -347937.79 Balance: -3. 16E-6 EDIT 1 1 ! 1 P-*f V 1 flHOR Page 6-1 1 This means that at the end of 60 months the US $ 2,000,000.00 principal amount has been paid, together with US $ 347,937.79 of interest, with the balance being that the lender owes the borrower US $ 0.00031 6. Of course, the balance should be zero. The value shown in the screen above is simply round-off error resulting from the numerical solution. Press jQN jor [enter] f twice, to return to normal calculator display. Example 3 - Calculating payment with payments at beginning of period Let's solve the same problem as in Examples 1 and 2, but using the option that payment occurs at the beginning of the payment period. Use: (jjjj finance Start the financial calculation input form 60 lEI Enter n = 60 6.5 IIIII Enter l%YR = 6.5 % 2000009 lililii Enter PV = 2,000,000 US$ ^▼7 Skip PMT, since we will be solving for it 9 III! Enter FV = 0, the option End is highlighted SilOiySlll^^ IIIIIIIIIIIIII Change payment option to Begin ^ CD BSSa Highlight PMT and solve for it The screen now shows the value of PMT as -38,921 .47, i.e., the borrower must pay the lender US $ 38,921 .48 at the beginning of each month for the next 60 months to repay the entire amount. Notice that the amount the borrower pays monthly, if paying at the beginning of each payment period, is slightly smaller than that paid at the end of each payment period. The reason for that difference is that the lender gets interest earnings from the payments from the beginning of the period, thus alleviating the burden on the lender. Notes: 1 . The financial calculator environment allows you to solve for any of the terms involved, i.e., n, l%YR, PV, FV, P/Y, given the remaining terms in the loan calculation. Just highlight the value you want to solve for, and press IIISI33. The result will be shown in the highlighted field. Page 6-12 2. The values calculated in the financial calculator environment are copied to the stack with their corresponding tag (identifying label). Deleting the variables When you use the financial calculator environment for the first time within the HOME directory, or any sub-directory, it will generate the variables iiiiiil lilll llili IIIIIIIIII 11113391 IIIIIIII to store the corresponding terms in the calculations.. You can see the contents of these variables by using: ( v 1 -I;: :■":::::: ( , ^ i::":"":"™::: ( ^ ( s, 1 ::::"!:"":"::::: ( ^ ( ■■ ^> ::::"n"sE LClJ iiii iiiilili Lj^LJ IIL:I:iSILILi:i!I ISZ_J I!!!.:!!:!:!!!!! LCLJ Sa-sis-s-sLSSi! IXlJ I!!!.:!!!.!!.:"!!! LCLJ ss-siiisii • You can either keep these variables for future use, or use the PURGE function to erase them from your directory. To erase all of the variables at once, if using ALG mode, try the following: Enter PURGE, prepare list of variables Enter name of variable N Enter a comma Enter name of variable l%YR Enter a comma Enter name of variable PV Enter a comma Enter name of variable PMT Enter a comma Enter name of variable PYR Enter a comma Enter name of variable FV Execute PURGE command CD C3 HE CD C3 i cd cb™ cd ra i CD C3 CD CB > CD CB \ CD C3I1I. [enter] The following two screen shots show the PURGE command for purging all the variables in the directory, and the result after executing the command. PURGE <£ 'N' , ' I*YR' , 1 PV 1 j 1 PMT 1 ? 1 PYR 1 ? gaitiiHitiieEgiiigiqi'JiMtijaj PURGEK'N' 'I^YR' "PV 'PMT* HOVRL taitiiHitiieEgiiigiqi'JiMtuaj In RPN mode, the command is executed by using: Page 6-13 !!!!.•!!.:.!!.!!!!!! (jmJ UnJU Prepare a list of variables to be purged ill! Enter name of variable N Enter name of variable l%YR Enter name of variable PV Enter name of variable PMT Enter name of variable PYR Enter name of variable FV (enter} Enter list of variables in stack [too) HIDES Purge variables in list Before the command PURGE is entered, the RPN stack will look like this: ff: <H I*YR PV PMT PYR FV! Solving equations with one unknown through NUM.SLV The calculator's NUM.SLV menu provides item 1. Solve equation., solve different types of equations in a single variable, including non-linear algebraic and transcendental equations. For example, let's solve the equation: ex- sin(7rx/3) = 0. Simply enter the expression as an algebraic object and store it into variable EQ. The required keystrokes in ALG mode are the following: CD ED £— ^ ED (3 CD CE3 C*D ED 5_ ED(^ED(3ED(X}®C3^ QDCD [stov] [alpha} (T\ [alpha} (q\ [enter] Function STEQ Function STEQ, available through the command catalog, CS_^r / will store its argument into variable EQ, e.g., in ALG mode: :STEQ[eX-SIH(^]=0] . HOVRL ■MiBaffiiiniiiMniici^CBaB In RPN mode, enter the equation between apostrophes and activate command STEQ. Thus, function STEQ can be used as a shortcut to store an expression into variable EQ. Page 6-14 Press jvAR j to see the newly created EQ variable Then, enter the SOLVE environment and select Solve equation..., by using: [j^jnumslv Ililllll, The corresponding screen y/jjlbeshown as: ^SOLVE ECUflTIOn^^™ Enter Function to sol.u« The equation we stored in variable EQ is already loaded in the Eq field in the SOLVE EQUATION input form. Also, a field labeled x is provided. To solve the equation all you need to do is highlight the field in front of X: by using ^▼7, and press MMM. The solution shown is X: 4.5006E-2: SOLVE EGUflTIOn Eg = EXP ( x > -S I H ( TT*X^3 > =0 4.50061385902E-2 Enter uglm or prgjj SOLVE This, however, is not the only possible solution for this equation. To obtain a negative solution, for example, enter a negative number in the X: field before solving the equation. Try LU l_!hJ KWs^? ii:;:i!i!i]!hili. The solution is now X: - 3.045. Solution procedure for Equation Solve... The numerical solver for single-unknown equations works as follows: • It lets the user type in or EDIilll an equation to solve. • It creates an input form with input fields corresponding to all variables involved in equation stored in variable EQ. • The user needs to enter values for all variables involved, except one. Page 6-15 • The user then highlights the field corresponding to the unknown for which to solve the equation, and presses iEilili • The user may force a solution by providing an initial guess for the solution in the appropriate input field before solving the equation. The calculator uses a search algorithm to pinpoint an interval for which the function changes sign, which indicates the existence of a root or solution. It then utilizes a numerical method to converge into the solution. The solution the calculator seeks is determined by the initial value present in the unknown input field. If no value is present, the calculator uses a default value of zero. Thus, you can search for more than one solution to an equation by changing the initial value in the unknown input field. Examples of the equations solutions are shown following. Example 1 - Hooke's law for stress and strain The equation to use is Hooke's law for the normal strain in the x-direction for a solid particle subjected to a state of stress given by °xx <J °yy (7 Gzx The equation is exx = — [<JXX - n • (a + <JZZ)] + OC • AT, here exx is the unit strain in the x-direction, <jxx/ <yyyf and <rzz, are the normal stresses on the particle in the directions of the x-, y-, and z-axes, E is Young's modulus or modulus of elasticity of the material, n is the Poisson ratio of the material, a is the thermal expansion coefficient of the material, and zlTis a temperature increase. Suppose that you are given the following data: <jxx= 2500 psi, cryy = l 200 psi, and azz = 500 psi, E = 1200000 psi, n = 0.15, a = 0.0000 1/°F, AT = 60 °F. To calculate the strain exx use the following: L r> J num.slv Access numerical solver to solve equations [ r> j eqw Access the equation writer to enter equation Page 6-16 At this point follow the instructions from Chapter 2 on how to use the Equation Writer to build an equation. The equation to enter in the Eq field should look like this (notice that we use only one sub-index to refer to the variables, i.e., exx is translated as ex, etc. -- this is done to save typing time): ?X=^i((JX-ni(cry+crz))+ai^T Use the following shortcuts for special characters: a: (alpha}[^J(s] a: (alpha}[W)(a] A: (alpha}[^J(c] and recall that lower-case letters are entered by using [alpha) j<-\ j before the letter key, thus, x is typed as (^[jT}g] . Press Lenter) to return to the solver screen. Enter the values proposed above into the corresponding fields, so that the solver screen looks like this: SOLVE EGUATIOni Eg = ex=l^E# < ux-n* ( try+tr... *x- E: 120... m= 25... n= .15 12... -n: 500 «: -00... fiT= 60 Enter ualm or prjjg SOLVE With the ex: field highlighted, press to solve for ex: SOLVE EGUATIOn Eg : ex=l/E* <. r/x-n* ( ay+tT... «X= ail E= 120... m= 25... n= .15 = 12... -n: 500 «= .00... *T: 60 Enter uglm or prjjj SOLVE Page 6-17 The solution can be seen from within the SOLVE EQUATION input form by pressing EES] while the ex: field is highlighted. The resulting value is 2.470833333333E-3. Press MM to exit the EDIT feature. Suppose that you now, want to determine the Young's modulus that will produce a strain of exx = 0.005 under the same state of stress, neglecting thermal expansion. In this case, you should enter a value of 0.005 in the ex: field, and a zero in the AT: field (with AT = 0, no thermal effects are included). To solve for E, highlight the E: field and press BHU. The result, seeing with the EMi feature is, E = 449000 psi. Press mBM [enter] to return to normal display. Notice that the results of the calculations performed within the numerical solver environment have been copied to the stack: ex:2.47083333333E-3 E: 449003. Also, you will see in your soft-menu key labels variables corresponding to those variables in the equation stored in EQ (press jNxrj to see all variables in your directory), i.e., variables ex, AT, a, oz, ay, n, ax, and E. Example 2 - Specific energy in open channel flow Specific energy in an open channel is defined as the energy per unit weight measured with respect to the channel bottom. Let E = specific energy, y = channel depth, V = flow velocity, g = acceleration of gravity, then we write v2 E = y + . The flow velocity, in turn, is given by V = Q/A, where Q = water discharge, A = cross-sectional area. The area depends on the cross-section used, for example, for a trapezoidal cross-section, as shown in the figure below, A = (b+m-y) y, where b = bottom width, and m = side slope of cross section. Page 6-18 We can type in the equation for E as shown above and use auxiliary variables for A and V, so that the resulting input form will have fields for the fundamental variables y, Q, g, m, and b, as follows: • First, create a sub-directory called SPEN (SPecific ENergy) and work within that sub-directory. Q A A. H : E=y+^ ►EQ Launch the numerical solver for solving equations: IIIEI1III. Notice that the input form contains entries for the variables y, Q, b, m, and g: b = Enter Function to ' folm Try the following input data: E = 1 0 ft, Q = second), b = 2.5ft^ri^ 1 .0, g = 32.2ft/sfr 0 cfs (cubic feet per ^ EtUflTIOn §§§§§§§§§§§§§§§§§ Eg:E=y+V-A-2^^2*a> E= 10 y G = 10 I 1 3 Enter ualm or prjjg SOLVE Solve for y. Page 6-19 ^ EtUflTIOl"! §§§§§§§§§§§§§§§§§ Eg: E=y+V-A-2^2*g> 10 b= 2.5 H= 1 3= 32.2 Enter ualm or prgss SOLVE The result is 0.149836.., i.e., y = 0.149836. It is known, however, that there are actually two solutions available for y in the specific energy equation. The solution we just found corresponds to a numerical solution with an initial value of 0 (the default value for y, i.e., whenever the solution field is empty, the initial value is zero). To find the other solution, we need to enter a larger value of y, say 15, highlight the y input field and solve for y once more: SOLVE EGUATIOn Eq:E=y+VA2^<2*a> E= 10 y G = 10 b H= 1 3 2.5 32.2 Enter ugluc or press SOLVE The result is now 9.99990, i.e., y = 9.99990 ft. This example illustrates the use of auxiliary variables to write complicated equations. When NUM.SLV is activated, the substitutions implied by the auxiliary variables are implemented, and the input screen for the equation provides input field for the primitive or fundamental variables resulting from the substitutions. The example also illustrates an equation that has more than one solution, and how choosing the initial guess for the solution may produce those different solutions. In the next example we will use the DARCY function for finding friction factors in pipelines. Thus, we define the function in the following frame. Special function for pipe flow: DARCY (s/D,Re) The Darcy-Weisbach equation is used to calculate the energy loss (per unit weight), hf, in a pipe flow through a pipe of diameter D, absolute roughness c, and length L, when the flow velocity in the pipe is V. The equation is Page 6-20 L V written as hf = f . The quantity f is known as the friction factor of D 2g the flow and it has been found to be a function of the relative roughness of the pipe, s/D, and a (dimensionless) Reynolds number, Re. The Reynolds number is defined as Re = pVD/ja = VD/v, where p and u. are the density and dynamic viscosity of the fluid, respectively, and v = uVp is the kinematic viscosity of the fluid. The calculator provides a function called DARCY that uses as input the relative roughness s/D and the Reynolds number, in that order, to calculate the friction CATALOG : F63 COHHflnDS DATE+ DBUG DDHVL" DEC For example, for e/D = 0.0001 , Re = 1 000000, you can find the friction factor by using: DARCY(0. 000 1,1 000000). In the following screen, the function ->NUM () was used to obtain a numerical va DflRC YC - 000 1 , 1 0000003 DflRCYC- 0001,10000005 ■*HUM(flHS(lH 1.34414320724E-2 ue of the function: The result is f = DARCY(0.0001 , 1 000000) = 0.01 341 . The function FANNING(s/D,Re) In aerodynamics applications a different friction factor, the Fanning friction factor, is used. The Fanning friction factor, fF, is defined as 4 times the Darcy- Weisbach friction factor, f. The calculator also provides a function called FANNING that uses the same input as DARCY, i.e., s/D and Re, and provides the FANNING friction factor. Check that FANNING(0.0001, 1000000) = 0.0033603589181s. Page 6-21 DflRCY(.000i,i000000]| :+HUM(flHS(lH 1.34414320724E-2 : FflHH I HGC . 000 1 , 1 000000) FRHHIHGC. 0001,1000000) :+NUM(flNS(lH 3.36035S01S1E-3 Example 3 - Flow in a pipe You may want to create a separate sub-directory (PIPES) to try this example. The main equation governing flow in a pipe is, of course, the Darcy-Weisbach equation. Thus, type in the following equation into EQ: Also, enter the following variables (f, A, V, Re): hf = f 'V 'L : DRRCY 2-g-D DflRCY^Re TT-CT 4 Q fl In this case we stored the main equation (Darcy-Weisbach equation) into EQ, and then replaced several of its variables by other expressions through the definition of variables f, A, V, and Re. To see the combined equation, use EVAL(EQ). In this example we changed the display setting so that we can see the entire equation in the screen: :EYAL(EGJ S-G -L-DARCY D nu Page 6-22 Thus, the equation we are solving, after combining the different variables in the directory, is: f QD ^ h =MJl..Darcy f *2gD5 D ' Nu The combined equation has primitive variables: hf, Q, L, g, D, s, and Nu. Launch the numerical solver (\j+jnumslv IjEGIl) to see the primitive variables listed in the SOLVE EQUATION input form: SOLVE ECUfiTIOn Eg y: nu: Enter Function to sol.u« [i: L = Suppose that we use the values hf = 2 m, s = 0.00001 m, Q = 0.05 m3/s, Nu = 0.000001 m2/s, L = 20 m, and g = 9.806 m/s2, find the diameter D. Enter the input values, and solve for D, The solution is: 0.1 2, i.e., D = 0.1 2 m. SOLVE EQUATION Eg = hf =f *V'-2*Ls <. 2*g*D ) hf= 2 .00,,, D= IffHW t= .05 nu= .0,,, L: £0 3= 9.S... Enter ujl.ug or press SOLVE If the equation is dimensionally consistent, you can add units to the input values, as shown in the figure below. However, you must add those units to the initial guess in the solution. Thus, in the example below we place 0_m in the D: field before solving the problem. The solution is shown in the screen to the right: SOLVE EGUATIOn; Eg:hf=f*VA2*L^2*g*D) hf: 2_m e= .00,,, d= TS8BM G = . 5_... nu: .0,,, L: 1 0_m s= 9.8... Enter ualue or press SOLVE »b»b solve EtuflTior.g Eg hf 2_ru e= .00,,, D : y: . 5_... nu= .0,,, L: 10_m 3: 9.3... 1 259210489698_ru' Press [fi^ to return to normal calculator display. The solution for D will be listed in the stack. Page 6-23 Example 4 - Universal gravitation Newton's law of universal gravitation indicates that the magnitude of the attractive force between two bodies of masses m7 and m2 separated by a . . . , , . - ^ M,-M2 distance r is given by the equation t = Lr - . r Here, G is the universal gravitational constant, whose value can be obtained through the use of the function CONST in the calculator by using: COHSTCG) 6.67259E-11_ 2. s -kg We can solve for any term in the equation (except G) by entering the equation as: F=CONST(G> M1-M2 24 r EaaEnaBgiBaiiMHiHEBini This equation is then stored in EQ: 6.67259E-11_- 2. s -kg F=C0HSTCG3■■!:^:^^EQ Launching the numerical solver for this equation results in an input form containing input fields for F, G, ml, m2, and r. SOLVE EGUATIOn HZ: Enter Function to so Luc Let's solve this problem using units with the following values for the known variables ml = 1.0xl06kg, m2 = 1.0xl012kg, r = l.OxlO11 m. Also, enter a value of 0_N in field F to ensure the proper solution using units in the calculator: Page 6-24 SOLVE EGUATIOng Eg = F=(6.67259E- 1 1 _mA3„ Hi: 100000,,, f: 1000000,, Enter ualm or prjjg SOLVE Solve for F, and press to return to normal calculator display. The solution is F : 6.67259E-1 5_N, or F = 6.67259x1 0"15 N. Note: When using units in the numerical solver make sure that all the variables have the proper units, that the units are compatible, and that the equation is dimensionally homogeneous. Different ways to enter equations into EQ In all the examples shown above we have entered the equation to be solved directly into variable EQ before activating the numerical solver. You can actually type the equation to be solved directly into the solver after activating it by editing the contents of the EQ field in the numerical solver input form. If variable EQ has not been defined previously, when you launch the numerical solver (CS^IIlli), the EQ field will be highlighted: Enter Function to so Lug At this point you can either type a new equation by pressing BED. You will be provided with a set of apostrophes so that you can type the expression between them: Type an equation, say XA2 - 1 25 = 0, directly on the stack, and press I Page 6-25 E*UATi.:.r.:;« Eq:X--2-12!5= =0 Enter ual.u« or pfjJJ SOLVE 'X^2- 125=0* At this point the equation is ready for solution Alternatively, you can activate the equation writer after pressing lllliiilil to enter your equation. Press [enter] to return to the numerical solver screen. Another way to enter an equation into the EQ variable is to select a variable already existing in your directory to be entered into EQ. This means that your equation would have to have been stored in a variable name previously to activating the numerical solver. For example, suppose that we have entered the following equations into variables EQ1 and EQ2: :X -5S=0^Q1 2 X3-58=0 a -a+300=@^Q2 2 _a -a+30_0=6 lsts i ■: h m n l i f- ■:■ l f; m Now, launch the numerical solver (C7*1num.slv mm, and highlight the EQ field. At this point press the HM5 soft menu key. Use the up and down arrow keys (^^^3?) to select, say, variable EQ1 : Eff EG3 hLG Press Iliiilll after selecting EQ1 to load into variable EQ in the solver. The new equation is ready to be solved. SOLVE EGUATIOn Eq=XA3.-5S.=0. K Enter ual.u« or press SOLVE Page 6-26 The SOLVE soft menu The SOLVE soft menu allows access to some of the numerical solver functions through the soft menu keys. To access this menu use in RPN mode: 74 MENU, or in ALG mode: MENU(74). Alternatively, you can use C3 (hold) L_7J to activate the SOLVE soft menu. The sub-menus provided by the SOLVE soft menu are the following: P1 l: The ROOT sub-menu The ROOT sub-menu include the followinq functions and sub-menus: Function ROOT Function ROOT is used to solve an equation for a given variable with a starting guess value. In RPN mode the equation will be in stack level 3, while the variable name will be located in level 2, and the initial guess in level 1 . The following figure shows the RPN stack before and after activating function 4: 3: TflH(9)=e 2: ■e ■ l: 5 4: 3: 2: l: 7.72525183694 In ALG mode, you would use ROOT('TAN(e)=e','e',5) to activate function ROOT: ROOTCTflNCe^e' '9' 5) 7.72525183694 Variable EQ The soft menu key 11:11 in this sub-menu is used as a reference to the variable EQ. Pressing this soft menu key is equivalent to using function RCEQ (ReCall EQ). Page 6-27 The SOLVR sub-menu The SOLVR sub-menu activates the soft-menu solver for the equation currently stored in EQ. Some examples are shown next: Example 1 - Solving the equation t2-5t = -4 For example, if you store the equation 'tA2-5*t=-4' into EQ, and press IMI^inMslzLj:!/ it will activate the following menu: r't \mm I This result indicates that you can solve for a value of t for the equation listed at the top of the display. If you try, for example, C3D [ t ], it will give you the result t: 1 ., after briefly flashing the message "Solving for t." There is a second root to this equation, which can be found by changing the value of t, before solving for it again. Do the following: 1 0 [ t ], then press (JnJ[ t ]. The result is now, t: 4.0000000003. To verify this result, press the soft menu key labeled IIIEIili, which evaluates the expression in EQ for the current value of t. The results in this case are: J- 4: t: 1. 3: t: 4. 00000000003 £: Left: (-4.) l: Right: (-4] -L- ll ll ll To exit the SOLVR environment, press Cjjj j . The access to the SOLVE menu is lost at this point, so you have to activate it once more as indicated earlier, to continue with the exercises below. Example 2 - Solving the equation Q = at2+bt It is possible to store in EQ, an equation involving more than one variable, say, 'Q = atA2 + bt'. In this case, after activating the SOLVE soft menu, and pressing E^SEEHEB, you will get the following screen: l: I o II .i II t II h iBflBl I Within this SOLVR environment you can provide values for any of the variables listed by entering the value in the stack and pressing the corresponding soft-menu keys. For example, say you enter the values Q = 14, a = 2, and b = 3. You would use: 14 [ Q ], 2 [ a ], 3 [ b ]. Page 6-28 As variables Q, a, and b, get assigned numerical values, the assignments are listed in the upper left corner of the display. At this point we can solve for t, by using LjnJ [ t ]. The result is t: 2. Pressing lllllllill s h o ws the results: 4: 3: t:2. 2: Left: 14 l: Right: 14. 4 II * 1 1 t II b lUMJSl Example 3 - Solving two simultaneous equations, one at a time You can also solve more than one equation by solving one equation at a time, and repeating the process until a solution is found. For example, if you enter the following list of equations into variable EQ: { 'a*X+b*Y = c', 'k*X*Y=s'}, the keystroke sequence C:Ei!!!lj! ii!:E!EI!:i, within the SOLVE soft menu, will produce the followinq screen: i 3 II ; ; II t- ■■ II ■- mm The first equation, namely, a*X + b*Y = c, will be listed in the top part of the display. You can enter values for the variables a, b, and c, say: 2[a ]5[ b ] 19[c ]. Also, since we can only solve one equation at a time, let's enter a guess value for Y, say, 0 [ Y ], and solve for X, by using C3D[ X ]. This gives the value, X: 9.4999.... To check the value of the equation at this point, press IIIIIIIII;;!. The results are: Left: 1 9, Right: 1 9. To solve the next equation, press [nxtJ EHEH. The screen shows the soft menu keys as: X: 9. 5000000000^ Left: 19 Right: 19| Say we enter the values k = 2, s = 12. Then solve for Y, and press IIIIIIIII;;!. The results are now, Y: X: 9.50000000002 Left: 19. Right: 19 .631573547368 Left: 12. _ Right: 12 I h II K II T ll f IWyBlrtHffl We then continue moving from the first to the second equation, back and forth, solving the first equation for X and the second for Y, until the values of X and Y converge to a solution. To move from equation to equation use To solve for X and Y use LjnJ [ X ], and C3D[ Y ], respectively. The following sequence of solutions is produced: Page 6-29 X: 7. 92105263162) V: .757475083056 X: 7- 60631229237 Y: .733313519325 X: 7. 5279537017 V: .797029343923 X: 7. 5074266402 7* V:.79920S60S69| 6: X: 7. 50197347325 5: Y: .799739017976 4: X: 7. 50052745505 3: Y: .799943742032 2: X: 7. 5001406443 l: Y: .799934993167 After solving the two equations, one at decimal, X is converging to a value of value o 0.799. h ii k ii v il i Imuflirart a time, we notice that, up to the third 7.500, while Y is converging to a Using units with the SOLVR sub-menu These are some rules on the use of units with the SOLVR sub-menu: • Entering a guess with units for a given variable, will introduce the use of those units in the solution. • If a new guess is given without units, the units previously saved for that particular variable are used. • To remove units enter a number without units in a list as the new guess, i.e., use the format { number }. • A list of numbers can be given as a guess for a variable. In this case, the units takes the units used belong to the last number in the list. For example, entering { 1 .41_ft l_cm l_m } indicates that meters (m) will be used for that variable. • The expression used in the solution must have consistent units, or an error will result when trying to solve for a value. The DIFFE sub-menu The DIFFE sub-menu provides a number of functions for the numerical solution of differential equations. The functions provided are the following: ll^MMliflH«iiflfl[raiiamaIMJ These functions are presented in detail in Chapter 16. The POLY sub-menu The POLY sub-menu performs operations on polynomials. The functions included are the followinc PP.00T FCOEF PEYflL Page 6-30 Function PROOT This function is used to find the roots of a polynomial given a vector containing the polynomial coefficients in decreasing order of the powers of the independent variable. In other words, if the polynomial is anxn + a^x""1 + ... + a2x2 + q}x + a0/ the vector of coefficients should be entered as [an/ an. l7 ... , a2/ O] , a0]. For example, the roots of the polynomial whose coefficients are [1, -5, 6] are [2, 3]. Function PCOEF This function produces the coefficients [an/ an.-|, ... , a2/ o} , a0] of a polynomial anxn + a^x""1 + ... + a2x2 + a^ + a0/ given a vector of its roots [r]f r2/ rn]. For example, a vector whose roots are given by [-1, 2, 2, 1, 0], will produce the following coefficients: [1, -4, 3, 4, -4, 0]. The polynomial is x5 - 4x4 + 3x3 + 4x2 - 4x. Function PEVAL This function evaluates a polynomial, given a vector of its coefficients, [an/ an. l7 ... , a2, ®} , ao]/ and a value x0, i.e., PEVAL calculates anx0n + a^Xo""1 + ... + a2x02 + a^o + a0. For example, for coefficients [2, 3, -1 , 2] and a value of 2, PEVAL returns the value 28. The SYS sub-menu The SYS sub-menu contains a listing of functions used to solve linear systems. The functions listed in this sub-menu are: These functions are presented in detail in Chapter 1 1 . The TVM sub-menu The TVM sub-menu contains functions for calculating Time Value of Money. This is an alternative way to solve FINANCE problems (see Chapter 6). The functions available are shown next: W femihiu:i:T.]r:i:H:i|Hini^Ml7llll Page 6-31 The SOLVR sub-menu The SOLVR sub-menu in the TVM sub-menu will launch the solver for solving TVM problems. For example, pressing liliiiESIiiEili, at this point, will trigger the following screen: As an exercise, try using the values n = 1 0, l%YR = 5.6, PV = 1 0000, and FV = 0, and enter ED [ PMT ] to find PMT = -1021.08.... Pressing ®; produces the following screen: I'd. payment s^year BEGIN mode 5: 4: 3: £: l: PMT: (-1021. 08086483] ™ I"" Press jvAR j to exit the SOLVR environment. Find your way back to the TVM sub-menu within the SOLVE sub-menu to try the other functions available. Function TVMROOT This function requires as argument the name of one of the variables in the TVM problem. The function returns the solution for that variable, given that the other variables exist and have values stored previously. For example, having solved a TVM problem above, we can solve for, say, 'N', as follows: [ ' ] {alph$(n] (enter) mm. The result is 1 0. Function AMORT This function takes a value representing a period of payment (between 0 and n) and returns the principal, interest, and balance for the values currently stored in the TVM variables. For example, with the data used earlier, if we activate function AMORT for a value of 1 0, we get: 4: 3: -9999.99999995 £: -210-808648348 1 : . 00000004766 Page 6-32 Function BEG If selected, the TMV calculations use payments at the beginning of each period. If deselected, the TMV calculations use payments at the end of each period. Page 6-33 Chapter 7 Solving multiple equations Many problems of science and engineering require the simultaneous solutions of more than one equation. The calculator provides several procedures for solving multiple equations as presented below. Please notice that no discussion of solving systems of linear equations is presented in this chapter. Linear systems solutions will be discussed in detail in subsequent chapters on matrices and linear algebra. Rational equation systems Equations that can be re-written as polynomials or rational algebraic expressions can be solved directly by the calculator by using the function SOLVE. You need to provide the list of equations as elements of a vector. The list of variables to solve for must also be provided as a vector. Make sure that the CAS is set to mode Exact before attempting a solution using this procedure. Also, the more complicated the expressions, the longer the CAS takes in solving a particular system of equations. Examples of this application follow: Example 1 - Projectile motion Use function SOLVE with the following vector arguments, the first being the list of equations: ['x = xO + vO*COS(eO)*t' 'y =yO+vO*SIN(60)*t - g*tA2/2'](^D, and the second being the variables to solve for, say t and yO, i.e., ['t"yO']. The solution in this case will be provided using the RPN mode. The only reason being that we can build the solution step by step. The solution in the ALG mode is very similar. First, we store the first vector (equations) into variable A2, and the vector of variables into variable Al . The following screen shows the RPN stack before saving the variables. &: 5: 3: 'fl2' l: 'fli Page 7-1 At this point, we need only press jsroy J twice to store these variables. To solve, first change CAS mode to Exact, then, list the contents of A2 and Al , in that order: IHilil I 3: 2: Ct $01 Use command SOLVE at this point (from the S.SLV menu: C5D^) After about 40 seconds, maybe more, you get as result a list: {'t = (x-x0)/(COS(e0)*v0)' 'yO = (2*COS(e0)A2*v0A2*y+(g*xA2(2*x0*g+2*SIN(e0))*COS(e0)*v0A2)*x+ (x0A2*g+2*SIN(e0)*COS(e0)*v0A2*x0)))/(2*COS(e0)A2*v0A2),]} Press [eval) to remove the vector from the list, then use command OBJ->, to get the equations listed separately in the stack 5: 4: 3: 2: y0= 4: 3 ' -"COSteDJ-uD 2= ^a.costao^.ufl^+j-xMa.xfl.j- *a.: Note: This method worked fine in this example because the unknowns t and yO were algebraic terms in the equations. This method would not work for solving for 00, since 60 belongs to a transcendental term. Example 2 - Stresses in a thick wall cylinder Consider a thick-wall cylinder for inner and outer radius a and b, respectively, subject to an inner pressure P, and outer pressure PD. At any radial distance r from the cylinder's axis the normal stresses in the radial and transverse directions, arr and a0e, respectively, are given by _a2.Pi-b2.P0 a2.b2-(P,-P0) ee~ b2-a2 0\.„ = a2-P-b2-P„ ■a r2\b2-a2) a2-b2-{P-P0) r2-(b2-a2) Page 7-2 Notice that the right-hand sides of the two equations differ only in the sign between the two terms. Therefore, to write these equations in the calculator, I suggest you type the first term and store in a variable Tl , then the second term, and store it in T2. Writing the equations afterwards will be matter of recalling the contents of Tl and T2 to the stack and adding and subtracting them. Here is how to do it with the equation writer: Enter and store term Tl : 2 2 a -Pi-b -Po ■ 2 2 b -a EaaEnaBgaBanMHiHEBini Enter and store term T2: 4: 3: 2: 2 2 a -Pi-b -Po b -a l: 'Tl ' 4: 3: 2: 2 2 a -b -CPi-Po) r£.(b£-a£) l: 'T2' a2-b2<Fi-Fo) r%2-*2 ) EaaBnaBgiEBMaiBEBini Notice that we are using the RPN mode in this example, however, the procedure in the ALG mode should be very similar. Create the equation for gqq. (j^T) 1111111 11131! L+J [alpha] CrD (S [dLPHA) CrD (3 Q^D CD CnD = Create the equation for crrr: C^5D !!!!u!::i!!!!!l!l C^D S^CSdl ^™)(JxJ(3 I^nter] CD CB^ Put together a vector with the two equations, using function ->ARRY (find it using the command catalog L r> j cat ) a 3: 2: l: 3B. k2fti 2k2, ba-aa lb -a _ .]".Fi-t.".F-M j*-.ba.^Fi-Foj ba-.a ra4a-.a) ter typing a LU ' 5: 4: 3: 2: 1: r , ja.Fi-ba-F0 . ja.ba.tFi-F0^ baV ra-(ba-.a) Now, suppose that we want to solve for P, and PG, given a, b, r, crrr, and cr^. We enter a vector with the unknowns: 2: l: [ ga.Fi-ba-Fo ja-ba-tFi — to; ■FoJ CFi Fo: Page 7-3 To solve for P, and Pol use the command SOLVE from the S.SLV menu ([ <i )s.5Lv ); jt may take the calculator a minute to produce the result: {['Pi=.(((ae-ar)*rA2-(CT9+ar)*aA2)/(2*aA2))' 'Po=-(((aO-ar)*rA2-(ae+ar)*bA2)/(2*bA2))' ] }, i.e., 1 1! {[- i:-TTH-.Tr;i.r3-i;.TTH+.Tr;i..]3 2^ Notice that the result includes a vector [ ] contained within a list { }. To remove the list symbol, use [eval). Finally, to decompose the vector, use function OBJ->. The result is: 3: 2: l: I! .TTH - .Tf j ■ |" *" ~ l| iTH + .Tf j ■ ■] ^ a-a ■;.TiH-.T,-;i.,-5-i;.TiH+.T,-;i.t.5 2-b *a.J These two examples constitute systems of linear equations that can be handled equally well with function LINSOLVE (see Chapter 1 1). The following example shows function SOLVE applied to a system of polynomial equations. Example 3 - System of polynomial equations The following screen shot shows the solution of the system X2+XY=1 0, X2-Y2=-5, using function SOLVE: [x2+X-Y=10 X2-Y2=-!d] 2 2 2 X +Y-X=10 X -Y =-5 : SOLVECFlNSm ,TX YT) {[X=2 Y=3] tx=-2 Y=-3]> Solution to simultaneous equations with MSLV Function MSLV is availab e as the last option in the jj^m^ menu: £: 5: 4: 3: 2: l: i. "J -2 equation.. 2. Salve diFF eq.. 3. Solve poly.. H. Solve Lin syf.. 5. Solus Finance.. The help-facility entry for function MSLV is shown next: Page 7-4 mur: ; I ■^on-po 1 ynom i a 1 multi- variate so Iyer 1SLV< ' CSIH(X>+Y,X+SIH( y>=l] ' i ' CXiV] ' , [0,0]} [1.32384112611 -.9681... See: SOLVE bwm«:Dim«mtjm«i;r;ti^ Example 1 - Example from the help facility As with all function entries in the help facility, there is an example attached to the MSLV entry as shown above. Notice that function MSLV requires three arguments: 1 . A vector containing the equations, i.e., '[SIN(X)+Y,X+SIN(Y)=1 ]' 2. A vector containing the variables to solve for, i.e., '[X,Y]' 3. A vector containing initial values for the solution, i.e., the initial values of both X and Y are zero for this example. In ALG mode, press BSE to copy the example to the stack, press [enter) to run the example. To see all the elements in the solution you need to activate the line editor by pressing the down arrow key ); HELP MSLVCCSIHCX3+Y X+SINCY3* {[SINCXHY X+SIN(Y)=1.] D+ «SINOO+Ystt+SIN<Y> = l„, CX,Y], [1.323341 1261 1 ,-,9631 blitiaHitigCOWI.HCll.HBIHlttj In RPN mode, the solution for this example is produced by using: 4: ] 3: CSIHCX3+Y X+SIHCY)=1 - ] £: CXY] l: [0. 0.] Activating function MSLV results in the following screen. 4: 3: CSIHCX3+Y X+SIHCY)=1 - ] 2: CXY] You may have noticed that, while producing the solution, the screen shows intermediate information on the upper left corner. Since the solution provided by MSLV is numerical, the information in the upper left corner shows the results of the iterative process used to obtain a solution. The final solution is X = 1.8238, Y = -0.9681. Page 7-5 Example 2 - Entrance from a lake into an open channel This particular problem in open channel flow requires the simultaneous v2 solution of two equations, the equation of energy: H0 = y H , and 2g Cu A5/3 Manning's equation: Q = — • ^S~^ . In these equations, HQ n P represents the energy head (m, or ft) available for a flow at the entrance to a channel, y is the flow depth (m or ft), V = Q/A is the flow velocity (m/s or ft/s), Q is the volumetric discharge (m3/s or ft3/ s), A is the cross-sectional area (m2 or ft2), Q is a coefficient that depends on the system of units (Q = 1 .0 for the SI, Cu = 1 .486 for the English system of units), n is the Manning's coefficient, a measure of the channel surface roughness (e.g., for concrete, n = 0.01 2), P is the wetted perimeter of the cross section (m or ft), S0 is the slope of the channel bed expressed as a decimal fraction. For a trapezoidal channel, as shown below, the area is given by A = (b + my)y , while the wetted perimeter is given by P = b + 2y^l + in , where b is the bottom width (m or ft), and m is the side slope (1 V:mH) of the cross section. Typically, one has to solve the equations of energy and Manning's simultaneously for y and Q. Once these equations are written in terms of the primitive variables b, m, y, g, SQ, n, Cu, Q, and HG, we are left with a system of equations of the form fi(y,Q) = 0, f2(y,Q) = 0. We can build these two equations as follows. We assume that we will be using the ALG and Exact modes in the calculator, although defining the equations and solving them with MSLV is very similar in the RPN mode. Create a sub-directory, say CHANL (for open CHANneL), and within that sub-directory define the following variables: Ho=y+2^*EQ1 Ho= 2-9 Page 7-6 Q fl : Cb+m-yJ-yH1! Q fl 2 yb+y to : Cb+m-yJ-yH1! : b+2-y-Jl+m^P 2 yb+y b+2-y To see the original equations, EQ1 and EQ2, in terms of the primitive variables listed above, we can use function EVAL applied to each of the equations, i.e., U^Iil:!!:!!! \jval) IBjjEEl. The equations are listed in the stack as follows (small font option selected): : E'.'HLiEuij Q^.y^j.^+H.y^H.j.b^.y^H3^ 2 2 3 H3 "u_ 2 2 *3 H 2 2.yc.3.bc+H.y^.H.3. fr+2-y -h .3 :EYfil_(EG2) c_(y.t+ya.H).JSo-Cu 3 1 — ~2 . -Jy.b+y >h 3I 1 n. -Jb+2.y.-J 2 Ha + i We can see that these equations are indeed given in terms of the primitive variables b, m, y, g, SQ, n, Cu, Q, and HQ. In order to solve for y and Q we need to give values to the other variables. Suppose we use H0 = 5 ft, b = 1 .5 ft, m = 1 , n = 0.012, S0 = 0.00001, g = 32.2, and Cu = 1 .486. Before being able to use MSLV for the solution, we need to enter these values into the corresponding variable names. This can be accomplished as follows: 1 :5HHo 5 : .012^ .012 : 1 . 5^ 1.5 : -00001 ►So .00001 : ltm :32.2^ 1 32.2 Page 7-7 I. 00001^0 .00001 :32.2^ 32-2 : 1 . 4B6Ku 1.486 4 Now, we are ready to solve the equation. First, we need to put the two equations together into a vector. We can do this by actually storing the vector into a variable that we will call EQS (EQuationS): : l . 4obH_.u 1 1.486 j[EQl EQ2]*EQS As initial values for the variables y and Q we will use y = 5 (equal to the value of HQ/ which is the maximum value that y can take) and Q = 1 0 (this is a guess). To obtain the solution we select function MSLV from the NUM.SLV menu, e.g., [j^Jnumslv (^gjBM, to place the command in the screen: 1 . j CEQ1 EQ2>EQS Ho=vf±2^ Q=HjSo£i£3J 2-9 n-3JP Next, well enter variable EQS: (WKWJBH, followed by vector [y,Q]: and by the initial guesses C3 »C5D£ i CDQD- Before pressing [enter] f the screen will look like this: ■ 1 . 4yy jCEQl EQ2>EQS Press (enter} to solve the system of equations. You may, if your angular measure is not set to radians, get the following request: Page 7-8 :[EQ1 EQ2>EQS 4tfb Rod ion Hod« on? ,3., Ho no™ T " T"*'ij"'L* ^ 1SLV(EQS3 CyPQ]P C5P 104) Press !!!!!:![!:!! and allow the solution to proceed. An intermediate solution step may look like this: |C4. 99656516277,15.90111 358822986286 Hq= Vf^c, Q=R.JS^.CU.3J 1SLV(EQS3 CyPQ]P C5P 104) The vector at the top representing the current value of [y,Q] as the solution progresses, and the value .358822986286 representing the criteria for convergence of the numerical method used in the solution. If the system is well posed, this value will diminish until reaching a value close to zero. At that point a numerical solution would have been found. The screen, after MSLV finds a solution will look like this: n-3JP :MSLV(EQS,[y Q],[5 10]) Ho=yf^ Q=*^4 The result is a list of three vectors. The first vector in the list will be the equations solved. The second vector is the list of unknowns. The third vector represents the solution. To be able to see these vectors, press the down-arrow key ^3? to activate the line editor. The solution will be shown as follows: :;HD KYI HEM f;-- EHOHE EK21 hLG 2'9 *" n.3JP? 4 [ Ho= < V^2+2*y*9 V < 2*9. 'y?Q], 4. 99369613276, 20. 661, ta[fiiH[fiEEgiiigiqNi«tiiaj The solution suggested is [4.9936.., 20.661 ...]. This means, y = 4.99 ft, and Q = 20.661 ... ft3/ s . You can use the arrow keys ((3D CD ^> ^3?) to see the solution in detail. Page 7-9 Using the Multiple Equation Solver (MES) The multiple equation solver is an environment where you can solve a system of multiple equations by solving for one unknown from one equation at a time. It is not really a solver to simultaneous solutions, rather, it is a one-by-one solver of a number of related equations. To illustrate the use of the MES for solving multiple equations we present an application related to trigonometry in the next section. The examples shown here are developed in the RPN mode. Application 1 - Solution of triangles In this section we use one important application of trigonometric functions: calculating the dimensions of a triangle. The solution is implemented in the calculator using the Multiple Equation Solver, or MES. Consider the triangle ABC shown in the figure below. B c A The sum of the interior angles of any triangle is always 1 80°, i.e., a + p + y = 1 80°. The sine law indicates that: sin a sin j5 sin y a o c The cosine law indicates that: a2 = b2 + c2 - 2-b-c -cos a, b2 = o2 + c2 - 2-o-c -cos p, c2 = a2 + b2 - 2-a-b-cos y In order to solve any triangle, you need to know at least three of the following six variables: a, b, c, a, p, y. Then, you can use the equations of the sine law, Page 7-10 cosine law, and sum of interior angles of a triangle, to solve for the other three variables. If the three sides are known, the area of the triangle can be calculated with Heron's formula A = ^js - (s — a) - (s — b) - (s — c) , where s is known as the , . . a+b+c semi-perimeter ot the triangle, i.e., s = . Triangle solution using the Multiple Equation Solver (MES) The Multiple Equation Solver (MES) is a feature that can be used to solve two or more coupled equations. It must be pointed out, however, that the MES does not solve the equations simultaneously. Rather, it takes the known variables, and then searches in a list of equations until it finds one that can be solved for one of the unknown variables. Then, it searches for another equation that can be solved for the next unknowns, and so on, until all unknowns have been solved for. Creating a working directory We will use the MES to solve for triangles by creating a list of equations corresponding to the sine and cosine laws, the law of the sum of interior angles, and Heron's formula for the area. First, create a sub-directory within HOME that we will call TRIANG, and move into that directory. See Chapter 2 for instructions on how to create a new sub-directory. Entering the list of equations Within TRIANG, enter the following list of equations either by typing them directly on the stack or by using the equation writer. (Recall that [alpha] [ r> j (a) produces the character a, and [alpha} (j^J® produces the character p. The character y needs to be lllllIEIed from chars): 'SIN(a)/a = SIN(p)/b' 'SIN(a)/a = SIN(y)/c' 'SIN(p)/b = SIN(y)/c' 'cA2 = aA2+bA2-2*a*b*COS(y)' 'bA2 = aA2+cA2-2*a*c*COS(p)' Page 7-1 1 'aA2 = bA2+cA2-2*b*c*COS(a)' a+p+y = 1 80' 's = (a+b+c)/2' 'A = V (s*(s-a)*(s-b)*(s-c))' Then, enter the number L 9 j, and create a list of equations by using: function -HIST (use the command catalog Lr>J cat ). Store this list in the variable EQ. The variable EQ contains the list of equations that will be scanned by the MES when trying to solve for the unknowns. Entering a window title Next, we will create a string variable to be called TITLE to contain the string "Triangle Solution", as follows: [alpha] [alpha] I <i j (alpha) (^(S(E)(D®®©(3(B(jrD [enter] CZD [alpha] [alpha] (f\ (Tj (t](l\(J] [enter] [ST0>] Creating a list of variables Next, create a list of variable names in the stack that will look like this: { abcaPyAs } and store it in variable LVARI (List of VARIables). The list of variables represents the order in which the variables will be listed when the MES gets started. It must include all the variables in the equations, or it will not work with function MITM (see below). Here is the sequence of keystrokes to use to prepare and store this list: Press G^D, if needed, to get your variables menu. Your menu should show the variables WMm liiiliilii! SIII! . Open double quotes in stack Locks keyboard into lower-case alpha. Enter text: Triangle_ Enter text: Solution Enter string "Triangle Solution" in stack Open single quotes in stack Enter variable name 'TITLE' Store string into 'TITLE' Page 7-12 Preparing to run the MES The next step is to activate the MES and try one sample solution. Before we do that, however, we want to set the angular units to DEGrees, if they are not already set to that, by typing (Aum) (alpha} @ ® @ [enter) . Next, we want to keep in the stack the contents of TITLE and LVARI, by using: MEM W!3M We will use the following MES functions • MINIT: MES INITialization: initializes the variables in the equations stored in EQ. • MITM: MES' Menu Item: Takes a title from stack level 2 and the list of variables from stack level 1 and places the title atop of the MES window, and the list of variables as soft menu keys in the order indicated by the list. In the present exercise, we already have a title ("Triangle Solution") and a list of variables ({abcaPyAs}) in stack levels 2 and 1, respectively, ready to activate MITM. • MSOLVR: MES SOLVER; activates the Multiple Equation Solver (MES) and waits for input by the user. /tunning the MES interactively To get the MES started, with the variables TITLE and LVARI listed in the stack, activate command MINIT, then MITM, and finally, MSOLVR (find these functions in the catalog (j^J_q*t ). The MES is launched with the following list of variables available (Press LnxtJ to see the next list of variables): 1 a II b II c II « II * II * 1 1 * II * II II II Inn Press InxtJ to see the third list of variables. You should see: Press jNxrj once more to recover the first variable menu. Let's try a simple solution of Case I, using a = 5, b = 3, c = 5. Use the following entries: Page 7-13 L5J [ a ] a:5 is listed in the top left corner of the display. LJJ [ b ] b:3 is listed in the top left corner of the display. L5J [ c ] c:5 is listed in the top left corner of the display. To solve for the angles use: CjjD [ a ] Calculator reports Solving for a, and shows the result a: 72.5423968763. Note: If you get a value that is larger than 1 80, try the following: CDCE)[ a ] ED [ a ] Re-initialize a to a smaller value. Calculator reports Solving for a Next, we calculate the other two values: C3D [ P ] The result is P: 34.9152062474 C3D [ y ] The result is y: 72.5423968763. You should have the values of the three angles listed in stack levels 3 through 1 . Press L+J twice to check that they add indeed to 1 80°. ~ 432. 542396376 " «: 72.5423963762 p: 34. 9152062475 4: 3: 2: l: 72.54239637621 SI lj *:432. *rM"iMwTnr~: 54239687^ 130 F-ii-r-ir^r Press [nxtJ to move to the next variables menu. To calculate the area use: C5D[ A ]. The calculator first solves for all the other variables, and then finds the area as A: 7.15454401063. 4: 3: «: 432.542396376 £: 130. l: fl: 7. 15454401063 A HI f HI II II IIH1 Note: When a solution is found, the calculator reports the conditions for the solution as either Zero, or Sign Reversal. Other messages may occur if the calculator has difficulties finding a solution. Pressing L*i JlilHBI intermediate results. will solve for all the variables, temporarily showing the Press C5DEH to see the solutions: Page 7-14 -v: 72- p: 34.9152062474 «: 72.542396876S s: 6.5 fl: 7.1545440106c i When done, press L0A/ J to return to the MES environment. Press Cjjj j to exit the MES environment and return to the normal calculator display. Organizing the variables in the sub directory Your variable menu will now contain the variables (press [nxtJ to see the second set of variables): Variables corresponding to all the variables in the equations in EQ have been created. There is also a new variable called Mpar (MES parameters), which contains information regarding the setting up of the MES for this particular set of equations. If you use LrLJ EREH to see the contents of the variable Mpar. You will get the cryptic message: Library Data. The meaning of this is that the MES parameters are coded in a binary file, which cannot be accessed by the editor. Next, we want to place them in the menu labels in a different order than the one listed above, by following these steps: 1. Create a list containing { EQ Mpar LVARI TITLE }, by using: ( y \ I 1 ::::::"::v:::::i: ::: ::: : :!":"!::": :::::"::":":--:::":: ( rhll-rn\ LJnjy !!.:.! ::!::.!.!!=! II.::iL:i.:.L-jLi iyLIL:=Ll.:i::[ [ENTER} 2. Place contents of LVARI in the stack, by using: HEH3. 3. Join the two lists by pressing L±J . Use function ORDER (use the command catalog L J cat ) to order the variables as shown in the list in stack level 1 . 4. Press (jgjj to recover your variables list. It should now look like this: ti™iMlimiliHfchH«MM^ ^ 5. Press [nxT) to recover the first variable menu. Page 7-15 Programming the MES triangle solution using User RPL To facilitate activating the MES for future solutions, we will create a program that will load the MES with a single keystroke. The program should look like this: « DEG MINIT TITLE LVARI MITM MSOLVR », and can be typed in by using: L r> J <K>> Opens the program symbol {alpha} [alpha} Locks alphanumeric keyboard @(J}@ispcJ Type in DEG (angular units set to DEGrees) ®@($}(B(B(J!!D Type in MINIT_ {alpha} Unlocks alphanumeric keyboard List the name TITLE in the program List the name LVARI in the program Locks alphanumeric keyboard &CD(S& Cz3 Type in MITM_ ®®@®(v}(El Type in MSOLVR [enter} Enter program in stack Store the program in a variable called TRISOL, for TRIangle SOLution, by using: CZD(^)(^)(3(3(3(I1(§1(3^^) (£Z2t) Press G^D, if needed, to recover your list of variables. A soft key label liilillilE! should be available in your menu. Running the program - solution examples To run the program, press the SIlililH soft menu key. You will now have the MES menu corresponding to the triangle solution. Let's try examples of the three cases listed earlier for triangle solution. Example 1 - Right triangle Use a = 3, b = 4, c = 5. Here is the solution sequence: CB[a]CE[b]GD[c]To enter data C5D[ a ] The result is a: 36.8698976458 C5D[ P ] The result is p: 53.1301023541. C5D[ y ] The result is y: 90. jNxrj To move to the next variables menu. [<n][ A ] The result is A: 6. jNxrj Inxt] To move to the next variables menu. Page 7-16 Example 2 - Any type of triangle Use a = 3, b = 4, c = 6. The solution procedure used here consists of solving for all variables at once, and then recalling the solutions to the stack: L^J IliiilliliEl To clear up data and re-start MES CE[a]CE[b]CS[c]To enter data jNxrj To move to the next variables menu. C5D EH! Solve for all the unknowns. C3 EH! Show the solution The solution is: Triansl.* Solution 117.279612736 36.3360575147 26.3S43297495 6.5 5.3326S225193 At the bottom of the screen, you will have the soft menu keys: BID?!!- IHIilll llliili:! ill!! The square dot in lllillillL!" indicates that the values of the variables, rather than the equations from which they were solved, are shown in the display. To see the equations used in the solution of each variable, press the EQ}3 soft menu key. The display will now look like this: Triansl.* Solution b^2=a^2+c^2-2*a*„ ^2=bA2+cA2-2*b*.. '£=(a+b+c)/2' 'fi=J"<s*<s-a>*<s-b„ VALUE EGnS- FRinT The soft menu key SlIIill is used to print the screen in a printer, if available. And IIIEiil returns you to the MES environment for a new solution, if needed. To return to normal calculator display, press G^D- The following table of triangle solutions shows the data input in bold face and the solution in italics. Try running the program with these inputs to verify the solutions. Please remember to press jvM j 101113 at the end of each solution to clear up variables and start the MES solution again. Otherwise, you may Page 7-17 carry over information from the previous solution that may wreck havoc with your current calculations. a b c a(°) PC) r(°) A 2.5 6.9837 7.2 20.299 75 84.771 8.6933 7.2 8.5 74.26 22.616 27 130.38 23.309 21.92 17.5 13.2 90 52.97 37.03 115.5 41.92 23 29.6 75 32 73 328.81 10.27 3.26 10.5 77 18 85 16.66 17 25 32 37.79 50.78 97.44 210.71 Adding an INFO button to your directory An information button can be useful for your directory to help you remember the operation of the functions in the directory. In this directory, all we need to remember is to press liLiilii to get a triangle solution started. You may want to type in the following program: «"Press [TRISO] to start." MSGBOX », and store it in a variable called INFO. As a result, the first variable in your directory will be the lililliE! button. Application 2 - Velocity and acceleration in polar coordinates Two-dimensional particle motion in polar coordinates often involves determining the radial and transverse components of the velocity and acceleration of the particle given r, r' = dr/dt, r" = d2r/dt2, 0, 9' = d 6 /dt, and, 0" = d20/dt2. The following equations are used: vr = r ar = r — ra ve - r6 ae —r0 + 2r6 Create a subdirectory called POLC (POLar Coordinates), which we will use to calculate velocities and accelerations in polar coordinates. Within that subdirectory, enter the following variables: Page 7-18 Program or value Store into variable: « PEQ STEQ MINIT NAME LIST MITM MSOLVR » SOLVEP "vel. & acc. polar coord." NAME { r rD rDD 9D ODD vr v9 v ar a9 a } LIST {'vr=rD' 'v9 = r*9D' 'v = V(vrA2 + v9A2)' 'ar = rDD - r*9DA2' 'a9 = r*9DD + 2*rD*9D' 'a = V(arA2 + a9A2)' } PEQ An explanation of the variables follows: SOLVEP = a program that triggers the multiple equation solver for the particular set of equations stored in variable PEQ; NAME = a variable storing the name of the multiple equation solver, namely, "vel. & acc. polar coord. "; LIST = a list of the variable used in the calculations, placed in the order we want them to show up in the multiple equation solver environment; PEQ = list of equations to be solved, corresponding to the radial and transverse components of velocity (vr, v9) and acceleration (ar, a6 ) in polar coordinates, as well as equations to calculate the magnitude of the velocity (v) and the acceleration (a) when the polar components are known. r, rD, rDD = r (radial coordinate), r-dot (first derivative of r), r-double dot (second derivative of r). 0D, 0DD = 0-dot (first derivative of 0), 0-double dot (second derivative of 0). Suppose you are given the following information: r = 2.5, rD = 0.5, rDD = - 1 .5, 0D = 2.3, 0DD = -6.5, and you are asked to find vr, v0, ar, a0, v, and a. Page 7-19 Start the multiple equation solver by pressing L m J H3SH. The calculator produces a screen labeled , "vel. & acc. polar coord.", that looks as follows: l: r II re II m II ?c II m WvTl To enter the values of the known variables, just type the value and press the button corresponding to the variable to be entered. Use the following keystrokes: 2.5 [ r ] 0.5 [ rD ] 1 .5 CltD [ rDD ] 2.3 [9D ]6.5H[ 0DD ]. Notice that after you enter a particular value, the calculator displays the variable and its value in the upper left corner of the display. We have now entered the known variables. To calculate the unknowns we can proceed in two ways: a). Solve for individual variables, for example, LjnJ [ vr ] gives vr: 0.500. Press (jwiJLtlJ [ v6 ] to get v6 : 5.750 , and so on. The remaining results are v: 5.77169819031; or: -14.725; a9: -13.95; and a: 20.2836911089.; or, b). Solve for all variables at once, by pressing CSEHi- The calculator will flash the solutions as it finds them. When the calculator stops, you can press C3EH3 to list all results. For this case we have: y: 5.77169819031 ar: -14.725 a9: -13.95 a: 20.2336911039 Pressing the soft-menu key lililili will let you know the equations used to solve for each of the values in the screen: Sue!.. & acc. polar coord. 1 u9=r*8D 1 ar : 1 ar =r DD-r *G D^2 . ' a6 : ' ae=r*GDD+2. #rD*„. a: la=f<.ar'-2.+atiy-2. > ' VALUE EMS" PRim Page 7-20 To use a new set of values press, either E HTTUT1 [nxt j [nxtJ f or jVARj Let's try another example using r = 2.5, vr = rD = -0.5, rDD = 1 .5, v = 3.0, a = 25.0. Find, 0D, 6DD, v9, ar, and a6. You should get the following results: 0D: 1. 18321595662 a9: -24.9198715888 GDD: -9.4946622529 iwi.. & acc. polar coord. 1 yr=rD 1 1 v=\ 0^2. +v$*2. 'ar=rDD-r*eD^2. 1 'ae=r*eDD+2.*rD.. Page 7-21 Chapter 8 Operations with lists Lists are a type of calculator's object that can be useful for data processing and in programming. This Chapter presents examples of operations with lists. Definitions A list, within the context of the calculator, is a series of objects enclosed between braces and separated by spaces (Lspc J )/ in the RPN mode, or commas (Lr*J » ), in both modes. Objects that can be included in a list are numbers, letters, character strings, variable names, and/or operators. Lists are useful for manipulating data sets and in some programming applications. Some examples of lists are: i t I } , i "BETA" h2 4>, i 1 1.5 2B@}, i a a a a } , { i 1 2 3 > i 3 2 1 > i 1 2 3 > > In the examples shown below we will limit ourselves to numerical lists. Creating and storing lists To create a list in ALG mode, first enter the braces key CSDU (associated with the L + J key), then type or enter the elements of the list, separating them with commas (LrU » ). The following keystrokes will enter the list {1 2 3 4} and store it into variable LI . C5D{j CD C3 > CTD C3 > (JJ C3 > CZJ The screen will show the following: C1,2,3,4»L1 +^kip skiph -kjel del-i- del l ins <!■ 2. 3. 4.) ^!^JH!^gE.]jll.]jgll.]jWIHlTJ1 The figure to the left shows the screen before pressing [enter] f while the one to the right shows the screen after storing the list into LI . Notice that before pressing (enter} the list shows the commas separating its elements. However, after pressing (enter) , the commas are replaced with spaces. Entering the same list in RPN mode requires the following keystrokes: Page 8-1 S™) O CD (flv^D CD d^t) The figure below shows the RPN stack before pressing the G^T) key: 2: {1. 2. 3. 4-> l: LI ' T F; I H H | HESi | STRS | F Rii-J | GRflV | PIPE Composing and decomposing lists Composing and decomposing lists makes sense in RPN mode only. Under such operating mode, decomposing a list is achieved by using function OBJ->. With this function, a list in the RPN stack is decomposed into its elements, with stack level 1 : showing the number of elements in the list. The next two screen shots show the stack with a small list before and after application of function OBJ->: 4: 3: 2: l: {3 -2 0} I Hpar | L H F; 1 1 T I T L E | 4: 3 3: -2 £: 0 l: 3. EC | Hpar | L '.' m F; 1 1 T I T L E | a | I Notice that, after applying OBJ->, the elements of the list occupy levels 4: through 2:, while level 1 : shows the number of elements in the list. To compose a list in RPN mode, place the elements of the list in the stack, enter the list size, and apply function ->LIST (select it from the function catalog, as follows: LlU_c^ (j^J^^ , then use the up and down arrow keys (^^^▼7 ) to locate function -HIST). The following screen shots show the elements of a list of size 4 before and after application of function ->L 5: 4: 3: 2: I Hpar | L '.' h F; 1 1 T I T L E ST: Note: Function OBJ-> applied to a list in ALG mode simply reproduces the list, adding to it the list size] :0BJ+({3 2 -1» {3 2 -1 3-> I Hpar | L '.' H F; 1 1 T I T L E Page 8-2 Operations with lists of numbers To demonstrate operations with lists of numbers, we will create a couple of other lists, besides list LI created above: L2={-3,2, 1 ,5}, L3={-6,5,3,1 ,0,3,-4}, L4={3,-2,1 ,5,3,2,1 }. In ALG mode, the screen will look like this after entering lists L2, L3, L4: : {-3 2 1 5>H_2 {-3 2 1 5> : {-6 5 3 1 0 3 -4>H_3 {-653 1 0 3 -4> : {3 -2 1 5 3 2 1>H_4 , {3-2 1 532 1> In RPN mode, the following screen shows the three lists and their names ready to be stored. To store the lists in this case you need to press jsroy J three times. Changing sign The sign-change key (L+/- J) , when applied to a list of numbers, will change the sign of all elements in the list. For example: :|_1 -LI {1. 2. 3. 4-> {-!■ -2. z3. -4.} El-MMliBMfTiHiljlQai Addition, subtraction, multiplication, division Multiplication and division of a list by a single number is distributed across the list, for example: -5-L2 {15 -10 -5 -25^ -ki 5 {.2 .4 .6 .8> Subtraction of a single number from a list will subtract the same number from each element in the list, or example: :|_2 {-3 2 1 5> :|_2-10 {-13. -3- -9. -5-> Page 8-3 Addition of a single number to a list produces a list augmented by the number, and not an addition of the single number to each element in the list. For example: LI Ll+6 {12 3 4} <12 3 4 6> Subtraction, multiplication, and division of lists of numbers of the same length produce a list of the same length with term-by-term operations. Examples: L1-L2 L1-L2 {4. 0- 2. -1.) {-3. 4. 3. 20. > {4- 0. 2. -1.) {-3. 4. 3. 20. > L1-L.1 :|_1-L2 Li L2 {-.333333333333 1.3..* The division L4/L3 will produce an infinity entry because one of the elements in L3 is zero: If the lists involved in the operation have different lengths, an error message is produced (Error: Invalid Dimension). The plus sign (L + J ), when applied to lists, acts a concatenation operator, putting together the two lists, rather than adding them term-by-term. For example: L1+L2 , {1 234-32 1 5} b«M—«Mi7»mnffi«d In order to produce term-by-term addition of two lists of the same length, we need to use operator ADD. This operator can be loaded by using the function catalog (LrU_c^ ). The screen below shows an application of ADD to add lists LI and L2, term-by-term: LI ADD L2 {-2 4 4 9} Page 8-4 Real number functions from the keyboard Real number functions from the keyboard (ABS, ex, LN, 10x, LOG, SIN, x2, V, COS, TAN, ASIN, ACOS, ATAN, yx) can be used on lists. Here are some examples: ABS L2 :IL2I {-3 2 1 5> {3 2 15} EXP and LN = eL1 | 1 2 3 41 : LHCL1 J , {0 LHC2) LHC3) 2-LHC2)> LOG and ANTILOG iLOGCLli {0 L0GC2) L0GC3) L0G(4^ : RL0GCL2) SQ and square root SQCLli {14 9 16^ JL2 {■PT-J3 J2 1 Js) ■^■■^■■^■■■■ffftwnn*H SIN, ASIN SIHCLli KSIHCli SIHC2i SIMC33 SI NO {-.304692654015 .20135* COS, ACOS C0SCL2) [{C0SC3) C0SC2) coscii cosc^H RC0S(m {1.47062390563 1. 36943* AN, ATAN TFMLl) KTfMl) TflHC23 TflHC33 TflNO : RTRHCL2) -flTflNO) flTfM2) ^ flTflNd* INVERSE (1/x) IHV(Ll) I1 2 3 4J Real number functions from the MTH menu Functions of interest from the MTH menu include, from the HYPERBOLIC menu: SINH, ASINH, COSH, ACOSH, TANH, ATANH, and from the REAL menu: %, %CH, %T, MIN, MAX, MOD, SIGN, MANT, XPON, IP, FP, RND, TRNC, FLOOR, CEIL, D->R, R->D. Some of the functions that take a single argument are illustrated below applied to lists of real numbers: Page 8-5 SINK ASINH :SINH(L1) {SINH(l) SINHC2) SIHHC3) SH RSINH^f] {-.295673847563 . 19869* ba<n:i™<n:iMm:iriMiH:iBfiin:iriifiin:i TANH, ATANH TRNHCL2) K-TRHHC3) TAHHC23 TflHHCl J RTRHHCL1) {flTflHH(l) RTRNHC2) RTRHHC* b*<n:ir:^<n:iM.H;ir:Tro;iBfnn;ir:ifnn;i COSH, ACOSH C0SHCL2) KC0SHC3) C0SHC2) COSH(l) CH RCOSHCLl) <0 RC0SHC2) RC0SHC3) RCOS* ba<n:i™<n:iMm:iriMiH:iBfiin:iriifiin:i SIGN, MANT, XPON : ol UNI. LI J {1111 :MRHTC100-L23 <3. 2. 1. 5 :XPON(LM00) {2- 2- 2- 2.) b:MBC1lll,nilim']ll»«'»^ P, FP IPCU.2 2.3 -l.5» U. 2. -l^ FPCU.2 2.3 -1.5H {.2 .3 -.5> FLOOR, CEIL FL00RCU.2 2.3 -l.5>i U. 2. -2.^ CEILCU.2 2.3 -l.5» {2. 3. -I D^R, R^D : D+RK30 60 90» (.523593775593 1.04719H Hit fill {30. 60.0000000002 90. Examples of functions that use two arguments The screen shots below show applications of the function % to list arguments. Function % requires two arguments. The first two examples show cases in which only one of the two arguments is a list. :*K10 20 30U) {. I .2.3> :*(5,U0 20 30» r 10 D 5 D i0j The results are lists with the function % distributed according to the list argument. For example, Page 8-6 while %({10, 20, 30}, 1) = {%( 1 0, 1 ),%(20, 1 ),%(30, 1 )}, %(5,{1 0,20,30}) = {%(5,10),%(5,20),%(5,30)} In the following example, both arguments of function % are lists of the same size. In this case, a term-by-term distribution of the arguments is performed, i.e., %({10,20,30},{1,2,3}) = {%(10,1),%(20,2),%(30,3)} :*(U0 £@ 30M1 2 3» {10TO201A30-ll0} ^■MiiiMMiMiMirfl-amifiia This description of function % for list arguments shows the general pattern of evaluation of any function with two arguments when one or both arguments are lists. Examples of applications of function RND are shown next: Lists of complex numbers The following exercise shows how to create a list of complex numbers given two lists of the same length, one representing the real parts and one the imaginary parts of the complex numbers. Use LI ADD i*L2. The screen also shows that the resulting complex-number list is stored into variable L5: i L2 ADD * U + i-3 2+i-2 3+i 4+i-5> :FlNSmH_5 {l + i-3 2+i-2 3+i 4+i-5> ■"■"■"■""■'"fa*™ Functions such as LN, EXP, SQ, etc., can also be applied to a list of complex numbers, e.g., Page 8-7 SQCL5) SSQd + i-3) SQ(2+i-2) SQC3-* JL5 [t3+ii-Jg-2-i-J5)-Jl+JT8 h> 6 u eL5 l + i-3 2+i-2 3+i 4+ e e e e :LHCL5) <LH(l + i-3) LH(2+i-23 LNC3-* MLUbi. L~i J (RLOGCl + i-3) RL0G(2+i-2) H L0GCL5J KLOGCl + i— 33 L0G(2+i-2) LOH IHVCL5J J 1 1 1 1 , ll + i-3 2+i-2 3+i 4+_i-5 , :SIHCL5i (SIHCl + i-33 SIHC2+i-23 SI* :SIHHCL53 (SIHHCl + i-33 SIHHC2+i-23 ► :RSIN(L5) (nSIHCl + i-33 nSIHC2+i-23 ► The following example shows applications of the functions RE(Real part), IM(imaginary part), ABS(magnitude), and ARG(argument) of complex numbers. The results are lists of real numbers: :RECL5) IMCL5) :IL5I {1 2 3 4} {-3 2 1 5> {■HI 2-J2 HI RRGCL5J RTRNC3) t RTRHl^l RTRHlH ■*MT-«TM?MTMiiaiil]] [1] flTRNl. Lists of algebraic objects The following are examples of lists of algebraic objects with the function SIN applied to them: SINtflHSdH SIH(ot-p) SIH The MTH/LIST menu The MTH menu provides a number of functions that exclusively to lists. With flag 1 1 7 set to CHOOSE boxes: Page 8-8 HHTH HEHU 1 . VECTOR.. 2 . HflTRIK.. H. HYPERBOLIC. 5 . REAL.. 6. EASE.. LIST HEHU a.ELIST 3.iTLIST H.SORT 5. REVLIST 6. RDD Next, with system flag 1 1 7 set to SOFT menus: This menu contains the following functions: ALIST : Calculate increment among consecutive elements in list HIST : Calculate summation of elements in the list nLIST : Calculate product of elements in the list SORT : Sorts elements in increasing order REVLIST : Reverses order of list ADD Operator for term-by-term addition of two lists of the same length (examples of this operator were shown above) Examples of application of these functions in ALG mode are shown next: {-6 5 3 1 0 3 -4> *LIST(L3) {11 -2 -2 -1 3 -7> L3 {-6 5 3 1 0 3 -4> SORTCL33 {-6 -40 1 33 5> :|_3 {-653 1 0 3 -4> SLISTCL33 L3 {-653 1 0 3 -4> REVLISTCL33 {-430 1 3 5 -6> bniiMniininmiJiiiiii^iiMiUid SORT and REVLIST can be combined to sort a list in decreasing order: L3 {-653 1 0 3 -4H :REVLIST£S0RT(L3H {53 3 1 0 -4 -0 *LIST ELIST FTLIST SORT REVLI ADD Page 8-9 Manipulating elements of a list The PRG (programming) menu includes a LIST sub-menu with a number of functions to manipulate elements of a list. With system flag 1 1 7 set to CHOOSE boxes: PROG HEMJ i. STACK.. \ Z.HEHORY.. 3 . GRflnCH.. H . TEST.. 5. TYPE.. le.LIST.. II LIST HEHU i . ELEHEnTS.. Z. PROCEDURES.. 3.0EJ+ H.-H.IST 5. SUE C.REPL Item 1 . ELEMENTS., contains the following functions that can be used for the manipu < ation of elements in lists: ELEHEnT METlU ™ett7 3. PUT 1 H.PUTI 1 S . SIZE e . pos y ELEHEnT HEHU H.PUTI S . SIZE G.POS ? . HEAD S.TfllL List size Function SIZE, from the PRG/LIST/ELEMENTS sub-menu, can be used to obtain the size (also known as length) of the list, e.g., L3 : SIZECL33 {-653 1 0 3 -4> Extracting and inserting elements in a list To extract elements of a list we use function GET, available in the PRG/LIST/ELEMENTS sub-menu. The arguments of function GET are the list and the number of the element you want to extract. To insert an element into a list use function PUT (also available in the PRG/LST/ELEMENTS sub-menu). The arguments of function PUT are the list, the position that one wants to replace, and the value that will be replaced. Examples of applications of functions GET and PUT are shown in the following screen: : GET(L3,5) :PUT(L3,5.10) ;-6 5 3 0 1 10 3 -4> ElMMtMliBMflillil]] Page 8-10 Functions GETI and PUTI, also available in sub-menu PRG/ ELEMENTS/, can also be used to extract and place elements in a list. These two functions, however, are useful mainly in programming. Function GETI uses the same arguments as GET and returns the list, the element location plus one, and the element at the location requested. Function PUTI uses the same arguments as GET and returns the list and the list size. Element position in the list To determine the position of an element in a list use function POS having the list and the element of interest as arguments. For example, ■~L3 I {-653 1 0 3 -4> : P0S(L3,5i 2- ■aMaMaMsmmfHiiEi HEAD and TAIL functions The HEAD function extracts the first element in the list. The TAIL function removes the first element of a list, returning the remaining list. Some examples are shown next: :|_3 {-653103 -4; : HEADCL3) -6 :TRILCL3) {53103 -4; The SEQ function Item 2. PROCEDURES., in the PRG/LIST menu contains the following functions that can be used to operate on lists. |FF;ml HEHU 3.nSUE= H.EnDSUB I 5 . l"TF;EHM 1; 6 . REYLIST U FRmC HEHU H.EnDSUB S . :"TF;EHM G.REYLIST 7. SORT Functions REVLIST and SORT were introduced earlier as part of the MTH/LIST menu. Functions DOLIST, DOSUBS, NSUB, ENDSUB, and STREAM, are designed as programming functions for operating lists in RPN mode. Function Page 8-1 1 SEQ is useful to produce a list of values given a particular expression and is described in more detail here. The SEQ function takes as arguments an expression in terms of an index, the name of the index, and starting, ending, and increment values for the index, and returns a list consisting of the evaluation of the expression for all possible values of the index. The general form of the function is SEQ(express/on/ index, start, end, increment). In the following example, in ALG mode, we identify expression = n2, index n, start = 1 , end =4, and increment = 1 : SEQ(n2\n,l.,4. ,1 J {V- V. 9. 16-> The list produced corresponds to the values {I2, 22, 32, 42}. In RPN mode, arguments of the function as 5: 2. n 4: 'n' 3: 1. 2: 4. l: 1. ollows: before applying function SEQ. The MAP function The MAP function, available through the command catalog (Lr>J cat )f takes as arguments a list of numbers and a function f(X) or a program of the form « -> a ... », and produces a list consisting of the application of function f or the program to the list of numbers. For example, the following call to function MAP applies the function SIN(X) to the list {1,2,3}: MRP({1 2 3>,SIHCXi) {SINClJ SIHC2) SIHC3)> The following call to function MAP uses a program instead of a function as second argument: MflP<£8,l,2},* ■* x 'x {-1 0 3> Page 8-12 Defining functions that use lists In Chapter 3 we introduced the use of the DEFINE function ( (jT3?^— ) to create functions of real numbers with one or more arguments. A function defined with DEF can also be used with list arguments, except that, any function incorporating an addition must use the ADD operator rather than the plus sign (L±J). For example, if we define the function F(X,Y) = (X-5)*(Y-2), shown here in ALG mode: DEFIHE('F(X,Y)=EX-5. MY-* HOVRL we can use lists (e.g., variables LI and L2, defined earlier in this Chapter) to evaluate the function, resulting in: : DEFIHE('F(X,Y)=EX-5. MY-* HOVRL F(L1,L2) {20- 0. 2. -3.} Since the function statement includes no additions, the application of the function to list arguments is straightforward. However, if we define the function G(X,Y) = (X+3)*Y, an attempt to evaluate this function with list arguments (LI, L2) will fail: :DEFIHEE'G(X,Y)=(X+3.:i-Y') HOVRL G<L1PL2> :DE A * Error: Inual id Dimension n VRL :G(Li,i_£j " I nu a lid D i mens i on " To fix this problem we can edit the contents of variable I list in the stack by using 03 !! ! , which we can :DEFIHE('G(X,Y)=EX+3.:i-Y') HOVRL :GEL1,L2) 11 1 nu a lid D i mens i on 11 * ■* X Y 'CX+3.W * to replace the plus sign (+) with ADD: Page 8-13 GCL1.L2) " I nya lid D i mens i on " * ■+ X Y ' <!X+3. )*Y' * : * ■* X Y ' <X ADD 3.}* « ■* X Y 1 £X ADD 3.W ft Next, we store the edited expression into variable X Y 1 <X RDD 3.>* y * « ■* X Y ' <!X RDD 3. >*Y' ft :RNS(1 « ■* X Y ' <!X RDD 3. >*Y' ft Evaluating G(L1,L2) now produces the following result: G(L1,L2) {-12. 10. 6. 35.> As an alternative, you can define the function with ADD rather than the plus sign (+), from the start, i.e., use DEFINED 5 GCX, Y> = CX HDD 3)*Y 5 > :DEFIHE('G(X,Y)=EX RDD 3 J NOVRL :G(L1,L2) {-12. 10. 6. 35.> You can also define the function as G(X,Y) = (X-3)*Y. Applications of lists This section shows a couple of applications of lists to the calculation of statistics of a sample. By a sample we understand a list of values, say, {s^ s2/ sn}. Suppose that the sample of interest is the list { I « 5 » 3 1 2. 1 3 4 » 2 » 1 } Page 8-14 and that we store it into a variable called S (The screen shot below shows this action in ALG mode, however, the procedure in RPN mode is very similar. Just keep in mind that in RPN mode you place the arguments of functions in the stack before activating the function): £i. s. 3. i. a. i. 3. H . a. i.J a. s. 3. i. a. i. 3. h. a. l.i Harmonic mean of a list This is a small enough sample that we can count on the screen the number of elements (n=l 0). For a larger list, we can use function SIZE to obtain that number, e.g., {1. 5- 3. 1. 2. 1. 3. 4- ► Kl. 5. 3. 1- 2. 1. 3. 4. 2* SIZECSi 10. Suppose that we want to calculate the harmonic mean of the sample, defined as 1 1 1 n 1 n k=\ sn 1 1 — + + • • + 1 Vs 1 ^2 To calculate this value we can follow this procedure: 1 . Apply function INV () to list S: <1. 5. 3. 1. 2- 1. 3. 4- ► Kl- 5- 3. 1. 2. 1. 3. 4. SIZECS) 10 INV(S) Kl. -2 .333333333333 1. H 2. Apply function SLIST() to the resulting list inl . Kl. 5. 3. 1. 2. 1. 3. 4. £H SIZECS3 10. IHVCSi Kl- -2 .333333333333 1. H ELISTCFlNSCl.H 6. 1166666666^ aLIST ELIST FTLIST SORT REYLI ADD Page 8-15 3. Divide the result above by n = 10: 1= invi.:i..i SI. .2 .333333333333 1. H ELISTtflNSd.H 6. 1166666666^ RHSdJ 10. ,611666666666 4. Apply the INV() function to the latest result: 1= i,l_lb I l.HNbl. 1 . II 6. 1166666666^ ■ RHSdJ " 10. .61166666666^ : INVtflNSd.H 1 . 6348773843 Thus, the harmonic mean of list S is sh = 1 .6348... Geometric mean of a list The geometric mean of a sample is defined as XS = \\flXk = a/X1 'X2"'Xn k=\ To find the geometric mean of the list stored in S, we can use the following procedure: 1 . Apply function nl_ STQ to list S: . MMoLl . J A. " 10. .611666666666 : INVCRNSd ■ H 1 . 6343773342 : TTLISTCSJ 720. 2. Apply function XROOT(x,y), i.e., keystrokes tj^J^Z , to the result in 1: .61166666666ej INVCRNSd. H 1 . 6343773343 : TTLISTCS1 720 KR00T<fiHS<l>, 10)4 . bl Ibbbbbbbb^ INVCRNSd . )) 1 . 634S773S42I TTLISTCS) 720. RHSd.iJTo7 1.003203154021 Thus, the geometric mean of list S is sg = 1 .003203... Page 8-16 Weighted average Suppose that the data in list S, defined above, namely: S :::= J 1 =S 5 ». 3 :s 1 H 2 =i 1 3 *. 4 *. 2 « 1 } is affected by the weights, ■ : - ■■ ""I .-: :~V .■ 1= i-": :™: ■■ s~.s S !■'■! ■■- \ .!. Z- ;■ "f ;■ ..J ;■ *D ;■ ;■ O ;■ \s ;i .1. kJ X If we define the weight list as W = {w1,w2,...,wn}, we notice that the /c-th element in list W, above, can be defined by wk = k. Thus we can use function SEQ to generate this list, and then store it into variable !!!!![;!!!!!!!! as follows: .■■liL.i. i RNsa . ).ji07 1.003203154021 :SEQ(k,k,l-,10.,l.:i Given the data list {sl7 s2/ sn }, and the weight list {w^ w2, wn }, the weighted average of the data in S is defined as sw = k=\ To calculate the weighted average of the data in list S with the weights in list W, we can use th e following steps: 1 . Multiply lists S and W: I 1.00320315402) :SEQ(k,k,l-,10.,l.:i U. 2. 3. 4. 5. 6. 7. S. ^ :nHSCl.^N U. 2. 3. 4. 5. 6. 7. S. ^ :S-W a. 10. 9. 4. 10. 6. 21. > 2. Use function ZLIST in this result to calculate the numerator of Kl. 2. 3. 4. 5. 6. 7. S. M iflNSd.iHJ U. 2. 3. 4. 5. 6. 7. 3. ^ :S-W U. 10. 9. 4. 10. 6. 21. ► iSLISTCflNSa.H 121. Page 8-17 3. Use function ZLIST, once more, to calculate the denominator of sw: {1. 2- 3. 4. 5. 6. 7. S. ^ (1. 10. 9. 4. 10. 6. 21. ► :SLIST(fiHS(l.H 121. :SLIST(W) 55. Use the expression ANS(2)/ANS(1 ) to calculate the weighted average: 121. :SLIST(W) 55. . RHSC2J " flHSCU 2.2 Thus, the weighted average of list S with weights in list W is sw= 2.2. Note: ANS(1 ) refers to the most recent result (55), while ANS(2) refers to the previous to last result (121). Statistics of grouped data Grouped data is typically given by a table showing the frequency (w) of data in data classes or bins. Each class or bin is represented by a class mark (s), typically the midpoint of the class. An example of grouped data is shown next: Class Frequency Class mark count boundaries wk 0-2 1 5 2-4 3 12 4-6 5 18 6-8 7 1 8 -10 9 3 The class mark data can be stored in variable S, while the frequency count can be stored in variable W, as follows: Page 8-18 :SEQ(2-k-l,k,l,5,U {1 3579} :flNS(l)*S {1 3 5 7 9} :{5 12 IS 1 3>Ud {5 12 IS 1 3} Given the list of class marks S = {sl7 s2, sn }, and the list of frequency counts W = {v/t, w2, wn }, the weighted average of the data in S with weights W represents the mean value of the grouped data, that we call s, in this context: s = k=\ k=\ N k=\ where N = ^^wk represents the total frequency count. k=l The mean value for the data in lists S and W, therefore, can be calculated using the procedure outlined above for the weighted average, i.e., *~* I T^1 I~E TO I ^71 ■ SLISTCN) 55 13 :+NUM(flNS(lH 4.230769230771 We'll store this value into a variable called XBAR: 2Llb i in J 55 13 :+NUM(flNS(lH 4.23076923077^ :RHSC1>XERR 4.230769230771 The variance of this grouped data is defined as n n Yjwk<sk-*)2 Y,wk<sk-s)2 v = k=\ k=\ N k=\ Page 8-19 To calculate this last result, we can use the following: :flNS(l)*XBflR :RHSC1>XBRR 4.23076923077 4.23076923077 :ELISt(u-(S-XBFiR)£) :2LISt(w-(S-XBFiR)£] 156.923076923 156.923076923 :SLIST(W) :SLIST(H) 39 39 The standard deviation of the grouped data is the square root of the variance I" i ■_■ i n*n 1 39 . nHSC2) ■ ANsm 4. 02366363905 : JflHStlJ 2. 00590343237 Page 8-20 Chapter 9 Vectors This Chapter provides examples of entering and operating with vectors, both mathematical vectors of many elements, as well as physical vectors of 2 and 3 components. Definitions From a mathematical point of view, a vector is an array of 2 or more elements arranged into a row or a column. These will be referred to as row and column vectors. Examples are shown below: u = [1,-3,5,2] v = 3 6 Physical vectors have two or three components and can be used to represent physical quantities such as position, velocity, acceleration, forces, moments, linear and angular momentum, angular velocity and acceleration, etc. Referring to a Cartesian coordinate system (x,y,z), there exists unit vectors i, j, k associated with each coordinate direction, such that a physical vector A can be written in terms of its components Ax, Ay, Az, as A = Axi + Ayj + Azk. Alternative notation for this vector are: A = [Ax, Ay, Az], A = (Ax, Ay, Az), or A = < Ax, Ay, Az >. A two dimensional version of this vector will be written as A = Axi + Ayj, A = [Ax, Ay], A = (Ax, Ay), or A = < Ax, Ay >. Since in the calculator vectors are written between brackets [ ], we will choose the notation A = [Ax, Ay, AJ or A = [Ax, Ay, AJ, to refer to two- and three-dimensional vectors from now on. The magnitude of a vector A is defined as | A| = ^A2 + Ay + A2z . A unit vector in the direction of vector A, is defined as eA = A/ 1 A | . Vectors can be multiplied by a scalar, e.g., kA = [kAx, kAy, kAJ. Physically, the vector kA is parallel to vector A, if k>0, or anti-parallel to vector A, if k<0. The negative of a vector is defined as -A = (-1 )A = [-Ax, - Ay/ -AJ. Division by as scalar can be interpreted as a multiplication, i.e., A/k = (l/k)-A. Addition and subtraction of vectors are defined as A+B = [Ax ± Bx, Ay± By, Az± By], w h e re B is the vector B = [Bx, By/ BJ. Page 9-1 There are two definitions of products of physical vectors, a scalar or internal product (the dot product) and a vector or external product (the cross product). The dot product produces a scalar value defined as A*B = | A | | B | cos(0), where 9 is the angle between the two vectors. The cross product produces a vector Ax B whose magnitude is |AxB| = |A| |B|sin(0), and its direction is given by the so-called right-hand rule (consult a textbook on Math, Physics, or Mechanics to see this operation illustrated graphically). In terms of Cartesian components, A*B = AxBx+AyBy+AzBz, and AxB = [AyBz-AzBy,AzBx-AxBz,AxBy- AyBJ. The angle between two vectors can be found from the definition of the dot product as cos(0) = A*B/ 1 A | | B | = eA*eB. Thus, if two vectors A and B are perpendicular (9 = 90° = 7i/2rad), A*B = 0. Entering vectors In the calculator, vectors are represented by a sequence of numbers enclosed between brackets, and typically entered as row vectors. The brackets are generated in the calculator by the keystroke combination L*~i )[l , associated with the L x J key. The following are examples of vectors in the calculator: L 3 :: 5 :■ 2 :: 2 " 1 :: 3 5 :: 6 2 :: 3 J A gene^l TOW VCCtOr CI. 5, -2. 2] A 2-D vector C 3 =: ■■■■■ 1 2 "I A 3-D vector C 5 1 5 , 5 1--2 , 5 3 1 N ( t > 5 ] A vector of algebraics Typing vectors in the stack With the calculator in ALG mode, a vector is typed into the stack by opening a set of brackets (CjjD(Z ) and typing the components or elements of the vector separated by commas (Lr* J j ). The screen shots below show the entering of a numerical vector followed by an algebraic vector. The figure to the left shows the algebraic vector before pressing LjnJ • The figure to the right shows the calculator's screen after entering the algebraic vector: : [5 3 -1 2 4] [5 3 -1 2 4] [tA2Ps-2*t, T<t-3« [5 3 -1 2 4] [5 3-1 2 41 [t2 s-2-t Jt^] [t2 s-2-t JF^ Page 9-2 In RPN mode, you can enter a vector in the stack by opening a set of brackets and typing the vector components or elements separated by either commas (LrU » ) or spaces (jspcj). Notice that after pressing (enter) f in either mode, the calculator shows the vector elements separated by spaces. Storing vectors into variables Vectors can be stored into variables. The screen shots below show the vectors u2 = I" 1 ? 2 "I , u3 = C stored into variables II! mode: 2],v2 = C3!-l],v3 = C: 2:1 !, IIIEI, and llJIsI, respectively. First, in ALG :[1 2>u2 CI 2] : [-3 2 -2»u3 [-3 2 -21 [-3 2 -2]*u3 [3 -l»y2 :C1 -5 2]*v3 Then, in RPN mode (before pressing [sjo>), repeatedly) 4: 3: 2: l: [1 2] 'u2' [-3 2 -2] 'u3' 4: 3: 2: l: [-3 2 -2] C3 -1] [1 -5 2] [3 -1] 'v2' [1 -5 2] ■v3' Using the Matrix Writer (MTRW) to enter vectors Vectors can also be entered by using the Matrix Writer [j^mtm_ (third key in the fourth row of keys from the top of the keyboard). This command generates a species of spreadsheet corresponding to rows and columns of a matrix (Details on using the Matrix Writer to enter matrices will be presented in a subsequent chapter). For a vector we are interested in filling only elements in the top row. By default, the cell in the top row and first column is selected. At the bottom of the spreadsheet you will find the following soft menu keys: •:\:;-;;; 1 The IllSli! key is used to edit the contents of a selected cell in the Matrix Writer. The iillJlili key, when selected, will produce a vector, as opposite to a matrix of one row and many columns. Page 9-3 Vectors vs. matrices To see the Sill key in action, try the following exercises: (1) Launch the Matrix Writer (C5Jmw ). With VSEm and HUb selected, enter CX3f^CS^)CX]^)^) . This produces [3. 5. 2.]. (In RPN mode, you can use the following keystroke sequence to produce the same result: CSC^CTDC^CXDt^)^^))- (2) With lillJlii! deselected and EEUb selected,, enter CBC^CIDCz3CE(^(^. This produces [[3. 5. 2.]]. Although these two results differ only in the number of brackets used, for the calculator they represent different mathematical objects. The first one is a vector with three elements, and the second one a matrix with one row and three columns. There are differences in the way that mathematical operations take place on a vector as opposite to a matrix. Therefore, for the time being, keep the soft menu key mm* selected while using the Matrix Writer. The <-IEI key is used to decrease the width of the columns in the spreadsheet. Press this key a couple of times to see the column width decrease in your Matrix Writer. The EH3-> key is used to increase the width of the columns in the spreadsheet. Press this key a couple of times to see the column width increase in your Matrix Writer. The B3->« key, when selected, automatically selects the next cell to the right of the current cell when you press [enter] . This option is selected by default. The EiU key, when selected, automatically selects the next cell below the current cell when you press (enter} . Moving to the right vs. moving down in the Matrix Writer Activate the Matrix Writer and enter CT](^^CJJ(^^C2l)(^)(^) with the B3->« key selected (default). Next, enter the same sequence of numbers with the iiSlUB key selected to see the difference. In the first case you entered a vector of three elements. In the second case you entered a matrix of three rows and one column. Page 9-4 Activate the Matrix Writer again by using (<n Jmtrw / and press jNxrj to check out the second soft key menu at the bottom of the display. It will show the keys: :::!::"!-v:"":: ;::::::»::;::•:;::: :: :-r:r"2«: «"!::»»■■ ii:::i.::i:!:i.:.iii I!:::!.:!!:!:!.:.! i!:::!:!:!:!:!.::!!! i!:::!:!:!:!:!.::!!! .! — !!.:!!!!!! I!::.!:!:!!.!!:!:;!! The lilll;]!! key will add a row full of zeros at the location of the selected cell of the spreadsheet. The IIIIIIII key will delete the row corresponding to the selected cell of the spreadsheet. The DX3 key will add a column full of zeros at the location of the selected cell of the spreadsheet. The illliili key will delete the column corresponding to the selected cell of the spreadsheet. The il^iill! key will place the contents of the selected cell on the stack. The EED3 key, when pressed, will request that the user indicate the number of the row and column where he or she wants to position the cursor. Pressing [nxt) once more produces the last menu, which contains only one function ill!!!!! (delete). The function EES will delete the contents of the selected cell and replace it with a zero. To see these keys in action try the following exercise: (1) Activate the Matrix Writer by using (j^/ww m Make sure the EE3a and IZEI->b keys are selected. (2) Enter the following: CD (enter) CT3 [enter} [JJ (enter) (jvxT) iiijiiiij;!!! 1131311 r~r~) 12311 iiion [ 4 j (enter) [ 5 j (enter) [ 6 j [enter) [JJ (enter) £jj (enter) (^9j (enter) (3) Move the cursor up two positions by using . Then press 11I3I!. The second row will disappear. (4) Press lilllil. A row of three zeroes appears in the second row. Page 9-5 (5) Press 1II3II. The first column will disappear. (6) Press Mlil!!!!!!!!!!!!!!! . A row of two zeroes appears in the first row. (7) Press B9Q (JJWM (JJWM lilll to move to position (3,3). (8) Press ii^ii!:!. This will place the contents of cell (3,3) on the stack, although you will not be able to see it yet. (9) Press [enter] to return to normal display. Element (3,3) and the full matrix will be available in the screen. Summary of Matrix Writer use for entering vectors In summary, to enter a vector using the Matrix Writer, simply activate the writer (L*i Jmtrw ), and place the elements of the vector, pressing (enter} after each of them. Then, press (enter) [enter] . Make sure that the VB&m and EH->«I keys are selected. Example: (j^mjrw (^(^[^(gc^cxJt^ produces: ['xA2' 2 -5 ] Building a vector with ->ARRY The function ->ARRY, available in the function catalog (Lr>J cat ^ r> j — ► ; use <^N> ^3? to locate the function), can also be used to build a vector or array in the following way. In ALG mode, enter ->ARRY(vecfor elements, number of elements), e.g., :+FlRRY( 1,2,3,4,43 [12 3 4] : +FIRRY( 1,-2,-3,33 [1 -2 -3] :-HWiV.p,a,33 [o: p 61 In RPN mode: (1) Enter the n elements of the array in the order you want them to appear in the array (when read from left to right) into the RPN stack. (2) Enter n as the last entry. (3) Use function ^ARRY. Page 9-6 The following screen shots show the RPN stack before and after applying function -^ARRY: 6: 5: 4: 3: 2: l: -5 -4 -3 -2 1 5 £: 5: 4: 3: 2: l: [-5 -4 -3-2 1] In RPN mode, the function [->ARRY] takes the objects from stack levels n+1, n, n-7, down to stack levels 3 and 2, and converts them into a vector of n elements. The object originally at stack level n+1 becomes the first element, the object originally at level n becomes the second element, and so on. Note: Function -^ARRY is also available in the PRG/TYPE menu (C5D^ ) Identifying, extracting, and inserting vector elements If you store a vector into a variable name, say A, you can identify elements of the vector by using A(i), where i is an integer number less than or equal to the vector size. For example, create the following array and store it in variable A: [-1,-2,-3,-4,-5]: -2 -3 -4 -5^R [-1 -2 -3 -4 -53 To recall the third element of A, for example, you could type in A(3) into the calculator. In ALG mode, simply type A(3). In RPN mode, type 'A(3)' [enter] [EVALj . You can operate with elements of the array by writing and evaluating algebraic expressions such as: : nC23+nC53 :nC13-nC43 : nC33-nC23 -7 3 6 . nC33 " RC5) : LNCFK5H 3 5 LHC53+i-TTl Page 9-7 no) More complicated expressions involving elements of A can also be written. For example, using the Equation Writer (L r> J eqw ), we can write the following summation of the elements of A: EaaEnaBgaBEiMHiHEBini Highlighting the entire expression and using the IIIISIII soft menu key, we get the result: "-3.5. Note: The vector A can also be referred to as an indexed variable because the name A represents not one, but many values identified by a sub-index. To replace an element in an array use function PUT (you can find it in the function catalog C3_c^ / or in the PRG/LIST/ELEMENTS sub-menu - the later was introduced in Chapter 8). In ALG mode, you need to use function PUT with the following arguments: ?U\[array, location to be replaced, new value). For example, to change the contents of A(3) to 4.5, use: PUT(Fl,3,4.5) C-l -2 4.5-4 -53 In RPN mode, you can change the value of an element of A, by storing a new value in that particular element. For example, if we want to change the contents of A(3) to read 4.5 instead of its current value of -3., use: To verify that the change took place use: C3 [-1 -2 4.5 -4 -5]. The result now shown is: Page 9-8 Note: This approach for changing the value of an array element is not allowed in ALG mode, if you try to store 4.5 into A(3) in this mode you get the following error message: Invalid Syntax. To find the length of a vector you can use the function SIZE, available through the command catalog (N) or through the PRG/LIST/ELEMENTS sub-menu. Some examples, based on the arrays or vectors stored previously, are shown below: :SIZE(u3) {3.} :SIZE(u2) {2.} :SIZECm {5.} ■iiifiBiiwiriM Simple operations with vectors To illustrate operations with vectors we will use the vectors A, u2, u3, v2, and v3, stored in an earlier exercise. Changing sign To change the sign of a vector use the key L^jJ, e.g., -[2 3 5] -,'3 -H [-2 -3 -5] [-1 5 -2] [1 2 3 4 5] Addition, subtraction Addition and subtraction of vectors require that the two vector operands have the same length: : u2+u2 : u3+u3 [4 1] [-2 -3 0] [-2 -4 -6 -3 -10] Page 9-9 Attempting to add or subtract vectors of different length produces an error message (Invalid Dimension), e.g., v2+v3, u2+u3, A+v3, etc. Multiplication by a scalar, and division by a scalar Multiplication by a scalar or division by a scalar is straightforward: 3-u2 -5-u3 C9 -3] [15 -10 10] [-16 10] .u3 2 Absolute value function The absolute value function (ABS), when applied to a vector, produces the magnitude of the vector. For a vector A = [A1,A2,...,An], the magnitude is defined as | A \= ^A2 + A2y H \- A2z . In the ALG mode, enter the function name followed by the vector argument. For example: MBS J > , RBS <!■■■!>, RB3<u3>, will show in the screen as follows: |[1 -2 6]l IHI Iu3l J4l ■JT7 The MTH/VECTOR menu The MTH menu (L*i Jmth ) contains a menu of functions that specifically to vector objects: HATH HEnU 2 . MhTRI!!.. 3. LIST.. J H. HYPERBOLIC. 5 . REAL.. 6. EASE.. 1 The VECTOR menu contains the following functions (system flag 1 1 7 set to CHOOSE boxes): Page 9-10 VECTOR HERU 3. CROSS II VECTOR HERU C.-*V3 S.CVLIR x 5. SPHERE x Magnitude The magnitude of a vector, as discussed earlier, can be found with function ABS. This function is also available from the keyboard (LjnJ^— )• Examples of application of function ABS were shown above. Dot product Function DOT is used to calculate the dot product of two vectors of the same length. Some examples of application of function DOT, using the vectors A, u2, u3, v2, and v3, stored earlier, are shown next in ALG mode. Attempts to calculate the dot product of two vectors of different length produce an error message] :DOT(fl,fl) :D0T(u2,u2) :D0T(u3,u3) 55 1 -17 : D0T(u2,u3) 11 1 nua lid D i mens i on 11 D0T(fl,v3) 11 1 nua lid D i mens i on 11 : D0T(u2,u3) 11 1 nua lid D i mens i on 11 Cross product Function CROSS is used to calculate the cross product of two 2-D vectors, of two 3-D vectors, or of one 2-D and one 3-D vector. For the purpose of calculating a cross product, a 2-D vector of the form [Ax, Ay], is treated as the 3-D vector [Ax, Ay,0]. Examples in ALG mode are shown next for two 2-D and two 3-D vectors. Notice that the cross product of two 2-D vectors will produce a vector in the z-direction only, i.e., a vector of the form [0, 0, CJ: : CR0S3(u2,u2) [0 9 -7] : CR0SS(u2,C2 -3]) [0 0 -7] :CR0SS([1.5 -2H,u2) [0 0 4.5] CR0SS(u3,u3) : CR0SS(u3,u3) [-6 4 13] C0 0 0] CR0SSCC1 3 -5],[1 2 3]) [19 -3 -1] Page 9-1 1 Examples of cross products of one 3-D vector with one 2-D vector, or vice versa, are presented next] : CR0SS(u3,u2) [-2 -6 -3] : CR0SS(u2,u3) [-2 -6-14] iCROSSCl 2 3],[5 -6]) [IS 15 -16] ■iiifiBiiwiriM Attempts to calculate a cross product of vectors of length other than 2 or 3, produce an error message (Invalid Dimension), e.g., CROSS(v3,A), etc. Decomposing a vector Function V-> is used to decompose a vector into its elements or components. If used in the ALG mode, V-> will provide the elements of the vector in a list, e.g., {-1. -2. -3- -4. -5 {1. -5. a. In the RPN mode, application of function V-> will list the components of a vector in the stack, e.g., V->(A) will produce the following output in the RPN stack (vector A is listed in stack level 6:). &: 5: 4: 3: 2: l: C-l -2 -3 -4 -5] -1. -2. -3. -4. -5. Building a two-dimensional vector Function ->V2 is used in the RPN mode to build a vector with the values in stack levels 1 : and 2:. The following screen shots show the stack before and Page 9-12 Building a three-dimensional vector Function ->V3 is used in the RPN mode to build a vector with the values in stack levels 1 : , 2:, and 3:. The following screen shots show the stack before and after applying function ->V2: 3: 8 3: 2: 6 2: l: 2 l: C8. 6. 2. Changing coordinate system Functions RECT, CYLIN, and SPHERE are used to change the current coordinate system to rectangular (Cartesian), cylindrical (polar), or spherical coordinates. The current system is shown highlighted in the corresponding CHOOSE box (system flag 1 1 7 unset), or selected in the corresponding SOFT menu label (system flag 1 1 7 set). In the following figure the RECTangu' £: 5: 4: 3: 2: l: VECTOR HEMJ S.CYLin k 5. SPHERE * RECT" CVLin SPHER When the rectangular, or Cartesian, coordinate system is selected, the top line of the display will show an XYZ field, and any 2-D or 3-D vector entered in the calculator is reproduced as the (x,y,z) components of the vector. Thus, to enter the vector A = 3i+2j-5k, we use [3,2,-5], and the vector is shown as: If instead of entering Cartesian components of a vector we enter cylindrical (polar) components, we need to provide the magnitude, r, of the projection of the vector on the x-y plane, an angle 0 (in the current angular measure) representing the inclination of r with respect to the positive x-axis , and a z- component of the vector. The angle 0 must be entered preceded by the angle character (Z), generated by using ^^JLlULU • For example, suppose that we have a vector with r = 5, 0 = 25° (DEG should be selected as the angular measure), and z = 2.3, we can enter this vector in the following way: Page 9-13 ED {LCD CB > (^C3(3J CX3CD CB ? CSraCX} Before pressing t^j, the screen will look as in the left-hand side of the following figure. After pressing {enter), the screen will look as in the right-hand side of the figure (For this example, the numerical format was changed to Fix, with three decimals). ,[5,^25,2.3] C4.5S 32 2-113 2.300:| Notice that the vector is displayed in Cartesian coordinates , with components x = r cos(9), y = r sin(0), z = z, even though we entered it in polar coordinates. This is because the vector display will default to the current coordinate system. For this case, we have x = 4.532, y = 2. 1 1 2, and z = 2.300. Suppose that we now enter a vector in spherical coordinates (i.e., in the form (p,9,(|)), where p is the length of the vector, 0 is the angle that the xy projection of the vector forms with the positive side of the x-axis, and § is the angle that p forms with the positive side of the z axis), with p = 5, 9 = 25°, and § = 45°. We will use:CfD£ CD CS > (^C3CX3 CX3CD I The figure below shows the transformation of the vector from spherical to Cartesian coordinates, with x = p sin(4>) cos(0), y = p sin (§) cos (0), z = p cos((|)). For this case, x = 3.204, y = 1 .494, and z = 3.536. |l: [3.204 1.494 3.536l| III hi II W MM Id 1 1 I^M^MIH ■ ,[5,^25,^454 _ If the CYLINdrical system is selected, the top line of the display will show an RZZ field, and a vector entered in cylindrical coordinates will be shown in its cylindrical (or polar) coordinate form (r,0,z). To see this in action, change the coordinate system to CYLINdrical and watch how the vector displayed in the last screen changes to its cylindrical (polar) coordinate form. The second component is shown with the angle character in front to emphasize its angular nature. l: [3.536 ^25.000 3. 536> Page 9-14 The conversion from Cartesian to cylindrical coordinates is such that r = (x2+y2)1/2, 9 = tan'^y/x), and z = z. For the case shown above the transformation was such that (x,y,z) = (3.204, 2.1 12, 2.300), produced (r,6,z) = (3.536,25°,3.536). At this point, change the angular measure to Radians. If we now enter a vector of integers in Cartesian form, even if the CYLINdrical coordinate system is active, it will be shown in Cartesian coordinates, e.g., 4: " 3: 2: [3.536 ^25.000 3.= l: [2 This is because the integer numbers are intended for use with the CAS and, therefore, the components of this vector are kept in Cartesian form. To force the conversion to polar coordinates enter the vector components as real numbers (i.e., add a decimal point), e.g., [2., 3., 5.]. l: [3.606 ,£0.933 5.000! With the cylindrical coordinate system selected, if we enter a vector in spherical coordinates it will be automatically transformed to its cylindrical (polar) equivalent (r,9,z) with r = p sin 0 = 9, z = p cos <|>. For example, the following figure shows the vector entered in spherical coordinates, and transformed to polar coordinates. For this case, p = 5, 0 = 25°, and § = 45°, while the transformation shows that r = 3.563, and z = 3.536. (Change to DEG): 3: 4: 2: [3.536 ^25.000 3. 536^ 3: [3. 536 ^25. 000 3. 536> l: [2 3 5] 2: [2 3 5] [5, ^25, ^454 1 : [3. 536 ^25. 000 3. 536> Next, let's change the coordinate system to spherical coordinates by using function SPHERE from the VECTOR sub-menu in the MTH menu. When this coordinate system is selected, the display will show the RZZ format in the top line. The last screen will change to show the following: 4: 3: [5.000 ^25. 000 <£45. 0* 2 s [2 3 5] ,1: [5.000 ^25. 000 ^45. 0> li^lH'^iilHiilfl^W^Hia Page 9-15 Notice that the vectors that were written in cylindrical polar coordinates have now been changed to the spherical coordinate system. The transformation is such that p = (r2+z2)1/2, 9 = 0, and = tan"1(r/z). However, the vector that originally was set to Cartesian coordinates remains in that form. Application of vector operations This section contains some examples of vector operations that you may encounter in Physics or Mechanics applications. Resultant of forces Suppose that a particle is subject to the following forces (in N): ?} = 3i+5j+2k, F2 = -2i+3j-5k, and F3 = 2i-3k. To determine the resultant, i.e., the sum, of all these forces, you can use the following approach in ALG mode: : [3 5 2H+C-2 3 -5H+C2 0 -3> C3 3 -6] ■Man ■■■■ "^'i m^m Thus, the resultant is R = F2 + F3 = (3i+8j-6k)N. RPN mode use: C3,5,2] (enter) [-2, 3, -5] (enter) [2,0,3] (enter) CB Angle between vectors The angle between two vectors A, B, can be found as 0 =cos"](A*B/ 1 A | | B | ) Suppose that you want to find the angle between vectors A = 3i-5j+6k, B = 2i+j-3k, you could try the following operation (angular measure set to degrees) in ALG mode: 1 - Enter vectors [3,-5,6], press (enter), [2,1,-3], press (enter). 2 - DOT(ANS(l),ANS(2)) calculates the dot product 3 - ABS(ANS(3))*ABS((ANS(2)) calculates product of magnitudes 4 - ANS(2)/ANS(1 ) calculates cos(6) 5 - ACOS(ANS(l)), followed by ,^NUM(ANS(1 )), calculates 6 The steps are shown in the following screens (ALG mode, of course): [3 -5 61 12 1 -3] D0T(flNS(l),flNS(2H [3 -5 6] [2 1 -3] -17 : [2 1 -3] :D0TCRHSC1)JRHSC2)3 : lflHS(3)MflHS(2)l Ld --■ bJ C2 1 -3] -17 J70--JT4 Page 9-16 : IRNSC3)I-IRHS(S)I ■J70--JT4 . RHSC23 " HHS(l) -17 J70--JT4 A. J70--JT4 :flCOS(HHS(lH RCOS -17 1 J70-JT4J :+NUM(flNS(lH 122.891 Thus, the result is 6 = 122.891°. In RPN mode use the following: C 3 -i -5 =■ 6 J (enter) i2~ 1 3 J [enter) DOT [3,-5,6] (enter) RBS [2, 1,-3] (py^D MBS QD C±D H C 0 S H U M Moment of a force The moment exerted by a force F about a point O is defined as the cross- product M = rxF, where r, also known as the arm of the force, is the position vector based at O and pointing towards the point of application of the force. Suppose that a force F = (2i+5j-6k) N has an arm r = (3i-5j+4k)m. To determine the moment exerted by the force with that arm, we use function CROSS as shown next: :C3 -5 4] : [2 5 -61 C3 -5 4] C2 5 -6] :CR0SSCRHSC2),RHSCD) [10 26 25] lilMl'MiMil-H-M'aE'MKM Thus, M = (1 0i+26j+25k) m-N. We know that the magnitude of M is such that | M | = | r | | F | sin(0), where 6 is the angle between r and F. We can find this angle as, 9 = sin"1 ( | M | / 1 r | | F | ) by the following operations: 1 - ABS(ANS(1))/(ABS(ANS(2))*ABS(ANS(3)) calculates sin(6) 2 - ASIN(ANS(1)), followed by ^NUM(ANS(1)) calculates 6 These operations are shown, in ALG mode, in the following screens: C R 0 S S i R H S f 2 i , R H S L I i i [10 26 25] IFlHSmi IRHSC23I-IRHSC33I ■JT40T J65-5-J2 :flSIH(flHS(lH RSIH +NUM(RNSm) ■J65-5--J2 JI40T ' J65-5-J2 41.038 Page 9-17 Thus the angle between vectors r and F is 6 = 41 .038°. RPN mode, we can use: L3« ■■■■5« 4"! [enter) 12«.S«-&1 (enter) CROSS FIBS L3« -5i 4"! [enter) MBS C2,5,-6] (enter) RBS CZD S MS IN ->NUM Equation of a plane in space Given a point in space Po(*oyo/Zo) and a vector N = Nxi+Nyj+Nzk normal to a plane containing point P0/ the problem is to find the equation of the plane. We can form a vector starting at point P0 and ending at point P(x,y,z), a generic point in the plane. Thus, this vector r = P0P = (x-x0)i+ (y-y0)i + (z~zo)k, is perpendicular to the normal vector N, since r is contained entirely in the plane. We learned that for two normal vectors N and r, N*r =0. Thus, we can use this result to determine the equation of the plane. To illustrate the use of this approach, consider the point P0(2,3,-l) and the normal vector N = 4i+6j+2k, we can enter vector N and point P0 as two vectors, as shown below. We also enter the vector [x,y,z] last: : [4 6 21 C4 6 21 :[2 3 -1] 12 3 -1] : [x y z] Cx y z] lillil'I'HEilH-M'JCMEa Next, we calculate vector P0P = r as ANS(1 ) - ANS(2), i.e., [4 6 2] :[2 3 -1] [2 3 -1] : [x y z] [x y z] : FlNSm-FlNS(2) [x-2 y -3 z— 1] Finally, we take the dot product of ANS(1 ) and ANS(4) and make it equal to zero to complete the operation N*r =0: [2 3 -1] [x y z] [x y z] FlNSm-FlNS(2) [x-2 y-3 z— 1] DOT(FlNSm..FlNS(4h=0 Jz— 1 3-2+Cy-33-6+Cx-2M=0 Page 9-18 We can now use function EXPAND (in the ALG menu) to expand this expression: :flNSU)-flNS(2) [x y z] [x-2 y-3 z— 1] DOT(fiHS(l),fiHS(4))=0 Cz— 13-2+Cy-33-6+Cx-2M=^ 4-x+6-y+2-z-24=6 ^gi^i^iiifiiiii^ngiii^giitijjiiimj Thus, the equation of the plane through point P0(2, 3,-1 ) and having normal vector N = 4i+6j+2k, is 4x + 6y + 2z - 24 = 0. In RPN mode, use: 1 1 J [enter] [ J (enter) (3=3 [ 4 :■ 6 := 2 1 DOT ExpflND Row vectors, column vectors, and lists The vectors presented in this chapter are all row vectors. In some instances, it is necessary to create a column vector (e.g., to use the pre-defined statistical functions in the calculator). The simplest way to enter a column vector is by enclosing each vector element within brackets, all contained within an external set of brackets. For example, enter: ■" r ■: "5 ™ ill" ": : : ": :" .■: i™ ™ ™ ." ": !.. !.. .!. :: si::. ..! » !.. £. ■■ ..! « !.. .I::: :: ^ ..! « !.. ! i I ..! » !.. :: ..! This is represented as the following column vector: In this section we will showing you ways to transform: a column vector into a row vector, a row vector into a column vector, a list into a vector, and a vector (or matrix) into a list. We first demonstrate these transformations using the RPN mode. In this mode, we will use functions OBJ^, ^LIST, ^ARRY and DROP to perform the transformation. To facilitate accessing these functions we will set system flag 1 1 7 to SOFT menus (see Chapter 1 ). With this flag set, functions OBJ->, ->ARRY, and -HIST will be accessible by using C3D^— llilllill. Functions Page 9-19 OBJ^, -^ARRY, and ^LIST will be available in soft menu keys QD , GD , and (jD • Function DROP is available by using (jT]??g_ StHSD^a. Following we introduce the operation of functions OBJ->, LIST, ->ARRY, and DROP with some examples. Function OBJ^ This function decomposes an object into its components. If the argument is a list, function OBJ-> will list the list elements in the stack, with the number of elements in stack level 1, for example: i 1 :■ £? 3> (enter) (jT]ffi^_ jjililill IEEE -> II results in: 4: 1 3: 2 2: 3 l: 3. OEJ-h |- RRY|-H_IST| -+5TR 1 -+TRG |-KJniT When function OBJ-> is applied to a vector, it will list the elements of the vector in the stack, with the number of elements in level 1 : enclosed in braces (a list). The following example illustrates this application: C 33 [enter] CZD??G_fl!aS ilin^jj results in: 4: 1 3: 2 2: 3 l: {3.> OEJ-h |- RRY|-H_IST| -+5TR 1 -+TAG |-KJniT If we now apply function OBJ-> once more, the list in stack level 1 :, {3.}, will be decomposed as follows: ?: &: 5: 1 4: 2 3: 3 2: 3. l: 1. OEJ-h |- RRYKISTI -+5TR | -+TRG |-KJniT Function -HIST This function is used to create a list given the elements of the list and the list length or size. In RPN mode, the list size, say, n, should be placed in stack level 1 :. The elements of the list should be located in stack levels 2:, 3:, Page 9-20 n+1 :. For example, to create the list {1,2, 3}, type: CTD(^D CS(^™D [JJijNTER) [JJ(enter) rgHfflG fflin Function -^ARRY This function is used to create a vector or a matrix. In this section, we will use it to build a vector or a column vector (i.e., a matrix of n rows and 1 column). To build a regular vector we enter the elements of the vector in the stack, and in stack level 1 : we enter the vector size as a list, e.g., L / Renter) L 2 j [enter) i^JJijNTER) (JT]U [JJijNTER) CfD5TC_fflH l-»MI To build a column vector of n elements, enter the elements of the vector in the stack, and in stack level 1 enter the list {n 1}. For example,CD(^D CB(^D [JJ(enter) CSi^- CDCS :CD^ csD?^-ffla \^mm. Function DROP This function has the same effect as the delete key (L4 J). Transforming a row vector into a column vector We illustrate the transformation with vector L 3 "I . Enter this vector into the RPN stack to follow the exercise. To transform a row vector into a column vector, we need to carry on the following operations in the RPN stack: 1 - Decompose the vector with function OBJ-> 4: 1 3: 2 £: 3 l: {3.> RRYKISTI -+5TR | -+TAG |-4JniT 2 - Press LUL+J to transform the list in stack level 1 : from {3} to {3, 1 } 1- \Q. l.i BaHE3MCIHiK3i«niBEIEHi 3 - Use function ->ARRY to build the column vector l: i [i]:?nF;l;l;VJE*tidE.-irf;lEf;' G |-4JniT| These three steps can be put together into a UserRPL program, entered as follows (in RPN mode, still): (S^CSD?^- (BH illJ^II CD GD 1^311:11 [enter) ■ )[alpha)[alpha)(r\(x\(c) [enter) [sto>] Page 9-21 A new variable, , will be available in the soft menu labels after pressing Press CB ! to see the program contained in the variable RXC: jJP.J-> 1 ■■!■■ ->j:::jRRY V> This variable, llllllllllll, can now be used to directly transform a row vector to a column vector. In RPN mode, enter the row vector, and then press 1113111! . Try, for example: C 1 ? 2* 33 (enter) WMM. After having defined this variable , we can use it in ALG mode to transform a row vector into a column vector. Thus, change your calculator's mode to ALG and try the following procedure: 1 1 :s 2? 31 (enter) [WJ IlEiliii CfD (l C3D ans_ f resulting in: [1 2 3] :RXCCRHSC1)3 CI 2 3] L_ i Transforming a column vector into a row vector To illustrate this transformation, we'll enter the column vector "I in RPN mode. Then, follow the next exercise to transform a row vector into a column vector: 1 - Use function OBJ-> to decompose the column vector 4: 3: 2: l: 1 2 3 <3. !■> -tfRRY M-IST -kSTR -HflG -HJniT 2 - Use function OBJ-> to decompose the list in stack level 1 : &: 1 5: 2 4: 3 3: 3. 2: 1. l: 2. OEJ-h |- RRYKISTI -KSTR 1 -HAG |-KJniT Page 9-22 3 - Press the delete key J (also known as function DROP) to eliminate the number in stack level 1 : 5: 1 4: 2 3: 3 2: 3. l: 1. OEJ-h |- RRY|-H_IST| -+5TR 1 -+TRG |-KJniT 4 - Use function -HIST to create a list 4: 1 3: 2 2: 3 l: {3.> RRY|-H_I£T| -+5TR | -+TAG |-4JniT 5 - Use function ->ARRY to create the row vector 4: 3: 2: l: CI 2 3] BaHE3MCIHiK3i«niBEIEHi These five steps can be put together into a UserRPL program, entered as follows (in RPN mode, still): ( . „ „ ( , 1 DDr ::::ilT: :!: :::: Sv;~!s5_V8 ::=:=":=:::" \:i ( J <K>> \ JH... ) PRG m<ZS ~7 II m$tt ~7 !! [ ■ j ^iw/) {alpha} (q}(x}(r} [enter) [STQy] A new variable, liiillii, will be available in the soft menu labels after pressing [ var) : Press CSE321 to see the program contained in the variable CXR: << OBJ-» OBJ-» DROP ^HRRV >> This variable, I!!!!!!!:!:!!!:!!!!!, can now be used to directly transform a column vector to a row vector. In RPN mode, enter the column vector, and then press IIIESI1. Try, for example: L L 1 "I ». 121 I" 3 "I "I (enter) WSm. After having defined variable illlEEill!, we can use it in ALG mode to transform a row vector into a column vector. Thus, change your calculator's mode to ALG and try the following procedure: c c i ::i i2 i , lb::! ::i ^ cwj mm c?D£^_ czd^ Page 9-23 resulting in: 111 [izaj :CXR(ANS(D) Transforming a list into a vector To illustrate this transformation, well enter the list i 3> in RPN mode. Then, follow the next exercise to transform a list into a vector: 1 - Use function OBJ-> to decompose the column vector 4: 1 3: 2 2: 3 l: 3. OEJ-h |- RRY|-H_IST| -+5TR 1 -+TRG |-KJniT 2 - Type a 1 and use function -HIST to create a list in stack level 1 : 4: 1 3: 2 2: 3 l: {3.> OEJ-h |- RRY|-H_IST| -+5TR 1 -+TRG |-KJniT 3 - Use function ->ARRY to create the vector |f: [12 3^ OEJ^|-*flRRVKlST| ■+:" T F; | -+TRG |-KJniT These three steps can be put together into a UserRPL program, entered as follows (in RPN mode): [ ' )[ALPHA)[ALPHA)(L\(x\(y] [ENTER] [STO>] A new variable, IISIIII, will be available in the soft menu labels after pressing Cj^D: P 1 l: ■HEMUMaMaia Press CB 11501 to see the program contained in the variable LXV: s.j ::::::...! -7 .!. ~7\ !.::::: -7r\r.r. \ This variable, can now be used to directly transform a list into a vector. In RPN mode, enter the list, and then press DS9. Try, for example: \ .!. j: j: / [ENTER ' jjjj.jjjY&jjjjjj . Page 9-24 After having defined variable IIIIIII, we can use it in ALG mode to transform a list into a vector. Thus, change your calculator's mode to ALG and try the following procedure: i 1 ? 2j 3> (enter) {jmJ WMM C3D^ {j^Jans_ f resulting in: :LXVlflNS(l)) CI 2 3] ■HEMfflMaMaia Transforming a vector (or matrix) into a list To transform a vector into a list, the calculator provides function AXL. You can find this function through the command catalog, as follows: {alpha} {alpha} @)(x}@ {alpha} mm As an example, apply function AXL to the vector L 3 J in RPN mode by using:!!! 1 ;s 2?. 31 [enter} flXI The following screen shot shows the application of function AXL to the same vector in ALG mode. :RXLCC1 2 31) {1 2 3> ■HEuaiiaiaia Page 9-25 Chapter 1 0 Creating and manipulating matrices This chapter shows a number of examples aimed at creating matrices in the calculator and demonstrating manipulation of matrix elements. Definitions A matrix is simply a rectangular array of objects (e.g., numbers, algebraics) having a number of rows and columns. A matrix A having n rows and m columns will have, therefore, nxm elements. A generic element of the matrix is represented by the indexed variable corresponding to row i and column j. With this notation we can write matrix A as A = [aij]nXm . The full matrix is shown next: A - [^ij]nxm - a, a 12 a a 21 a 22 a 2 m a nl a nl A matrix is square if m = n. The transpose of a matrix is constructed by swapping rows for columns and vice versa. Thus, the transpose of matrix A, is AT = [(aT)jj] mXn = [ajj]mXn. The main diagonal of a square matrix is the collection of elements aM. An identity matrix, lnXn, is a square matrix whose main diagonal elements are all equal to 1, and all off-diagonal elements are zero. For example, a 3x3 identity matrix is written as "1 0 0" I An identity matrix can be written as I as Kronecker's delta, and defined as 0 1 0 0 0 1 lnxn - [Sjj]/ where SS| is a function known *.=r ifi=i ' l0, Page 10-1 Entering matrices in the stack In this section we present two different methods to enter matrices in the calculator stack: (1) using the Matrix Writer, and (2) typing the matrix directly into the stack. Using the Matrix Writer As with the case of vectors, discussed in Chapter 9, matrices can be entered into the stack by using the Matrix Writer. For example, to enter the matrix: -2.5 0.3 2 4.2 2.0 1.9 2.8 -0.1 0.5 first, start the matrix writer by using [ *i Jjxraw . Make sure that the option !!&!!!->■ is selected. Then use the following keystrokes: CSS CZDCDSS CZDCD^™) At this point, the Matrix Writer screen may look like this: Press (£N7h) once more to place the matrix on the stack. The ALG mode stack is [[-2.5,< [.3, 1." [2,-.l 4.2,2] 3,2.8] P .5]] -2.54.2 2 .3 1.92.3 2 -.1 .5 -2.5 4.2 2 .3 1.92.31 2 -.1 .5 Page 1 0-2 If you have selected the textbook display option (using [mope] HI Illjlj and checking off ^Textbook), the matrix will look like the one shown above. Otherwise, the display will show: The display in RPN mode will look very similar to these. Note: Details on the use of the matrix writer were presented in Chapter 9 Typing in the matrix directly into the stack The same result as above can be achieved by entering the following directly into the stack: ED(L_ _ C3 i CB > ram cb ! ma® CB ' CX3CBCJD CD CTD CB ' CBCBCB CB ' (BCD Thus, to enter a matrix directly into the stack open a set of brackets (L*i )[l and enclose each row of the matrix with an additional set of brackets (CB(^ )• Commas (CB \ CB) should separate the elements of each row, as well as the brackets between rows. (Note: In RPN mode, you can omit the inner brackets after the first set has been entered, thus, instead of typing, for example, [[1 2 3] [4 5 6] [7 8 9]], type [[1 2 3] 4 5 6 7 8 9].) For future exercises, let's save this matrix under the name A. In ALG mode use [s^Pj(ALPHA}(A] . In RPN mode, use CBC™)(3 (22t) • Creating matrices with calculator functions Some matrices can be created by using the calculator functions available in either the MTH/ MATRIX/MAKE sub-menu within the MTH menu (CB^™- ), Page 1 0-3 HATH HEMJ 1 . VECTOR.. I EzHZHiBL^iiiiiiiiiiiiiiiiiiiiiiiiiiM 3. LIST.. 1 H. HYPERBOLIC. [ S . REAL.. CEASE.. HATRIK HEHU a . RORHALIZE.. 3. FACTORS.. H.COL.. 5.R0H.. G.LSG or in the MATRICES/CR :ATE menu available through HATRICES HEAU It. CREATE.. [11 a. OPERATION. . 3.FACT0RI^ATI0n.. H. QUADRATIC FORH.. 1 S . LIREAR SYSTEHS.. B C.LinEAR APPL.. |J The MTH/MATRIX/MAKE sub menu (let's call it the MAKE menu) contains the HATRIK HAHE MEHU HATRIK HAKE MEHU ? . GET n S.GETI r.TRn 5. PUT I H.RDH 1D.PUTI 1 S . RAAH 11. SUB | 6. SIZE HATRIK HAKE MEHU la.REPL 13.-HHAG 1H.DIAG+ 15 . VAADERHOADE 15 . HILBERT while the MATRICES/CREATE sub-menu (let's call it the CREATE menu) has the HATRIK CREATE MEHU a. ROM.. | 3 . AUGHERT H.IDn 5. con fi.-*IAG i HATRIK CREATE MEHU 3. GET 5.GETI 10. HILBERT 11. PUT la.PUTI Page 1 0-4 HATRIK CREATE HERU IH.RDH ! iE.REPL 1 16. SUB 1? . VRRDERHORDE f, IE . MHTRIlEl".. 1 As you can see from exploring these menus (MAKE and CREATE), they both have the same functions GET, GETI, PUT, PUTI, SUB, REPL, RDM, RANM, HUBERT, VANDERMONDE, IDN, CON, ->DIAG, and DIAG^. The CREATE menu includes the COLUMN and ROW sub-menus, that are also available under the MTH/MATRIX menu. The MAKE menu includes the functions SIZE, that the CREATE menu does not include. Basically, however, both menus, MAKE and CREATE, provide the user with the same set of functions. In the examples that follow, we will show how to access functions through use of the matrix MAKE menu. At the end of this section we present a table with the keystrokes required to obtain the same functions with the CREATE menu when system flag 1 1 7 is set to SOFT menus. If you have set that system flag (flag 1 1 7) to SOFT menu, the MAKE menu will be available through the keystroke sequence: {^Jmjh_ \MSM The functions available will be shown as soft-menu key labels as follows (press jNxrj to move to the next set of functions): nttj«B4a«BifirHfia;Hiffin;m*iJ GETMET^mT ■Hiuimiaifltti IN^^rtHM With system flag 1 1 7 set to SOFT menus, the functions of the CREATE menu, HilffllMHMUMfliMBaiMCKE ■ DIHG-H GET | GETI |HILBE| PUT | PUTI In the next sections we present applications of the matrix functions in the MAKE and CREATE menu. Page 1 0-5 Functions GET and PUT Functions GET, GETI, PUT, and PUTI, operate with matrices in a similar manner as with lists or vectors, i.e., you need to provide the location of the element that you want to GET or PUT. However, while in lists and vectors only one index is required to identify an element, in matrices we need a list of two indices {row, column} to identify matrix elements. Examples of the use of GET and PUT follow. Let's use the matrix we stored above into variable A to demonstrate the use of the GET and PUT functions. For example, to extract element a23 from matrix A, in ALG mode, can be performed as follows: : GET(Fl,{2 3H 2.8 : Fl(2,3) 2. 8 Notice that we achieve the same result by simply typing FK2p 3) and pressing [enter) . In RPN mode, this exercise is performed by entering [enter [enter) GET, or by using FK2? 3) [enter). Suppose that we want to place the value V into element a31 of the matrix. We can use function PUT for that purpose, e.g., PUT(FI,{3 1>,tt) T-2.5 4.2 2 .3 1.92.31 TT -.1.5 GET GETI PUT PUTI SUE P.EPL In RPN mode you can use: C^D EB < 3p 1 > (^m) (jT]7r PUT. Alternatively, in RPN mode you can use: LlJFK2 ? 3> [enter) (TroT) . To see the contents of variable A after this operation, use Ell. Functions GETI and PUTI Functions PUTI and GETI are used in UserRPL programs since they keep track of an index for repeated application of the PUT and GET functions. The index list in matrices varies by columns first. To illustrate its use, we propose the following exercise in RPN mode: IIIIIIII {2,2}[enter) GETI. Screen shots showing the RPN stack before and after the application of function GETI are shown below: Page 1 0-6 Notice that the screen is prepared for a subsequent application of GETI or GET, by increasing the column index of the original reference by 1, (i.e., from {2,2} to {2,3}), while showing the extracted value, namely A(2,2) = 1 .9, in stack level 1 . Now, suppose that you want to insert the value 2 in element {3 1} using PUTI. Still in RPN mode, try the following keystrokes: C5D SK 3 I > [enter} [TD (enter) PUTI . The screen shots below show the RPN stack before and after the application of function PUTI: In this case, the 2 was replaced in position {3 1}, i.e., now A(3,l) = 2, and the index list was increased by 1 (by column first), i.e., from {3,1} to {3,2}. The matrix is in level 2, and the incremented index list is in level 1 . Function SIZE Function SIZE provides a list showing the number of rows and columns of the matrix in stack level 1 . The following screen shows a couple of applications of function SIZE in ALG mode: SIZECm <3. 3 {£. 2.) In RPN mode, these exercises are performed by using ! EC 1,2], C3,4]] (enter) SIZE . and Page 1 0-7 Function TRN Function TRN is used to produce the transconjugate of a matrix, i.e., the transpose (TRAN) followed by its complex conjugate (CONJ). For example, the following screen shot shows the original matrix in variable A and its transpose, shown in small font display (see Chapter 1): \-2.5--2.5>i>2 H.a-H.a.i-2 2-2>i>2 - jl 2-2-i-a -.1— .5- .5>i>2. :H-i.2.H -a.s—a.s.i-a H.a-H.a-i-a a-a-i-a .3-.3.i-a i.S-i.S-i-a n-n-i-a * a-a-i-a -.i—.i-i-a .5-.E-i.a :TRntfl-i-a.fl) -a.5~a.5.-i-a .s-.s-i-a a-a-- H.a-H.a-i-a i.s-i.s-i-a -.1— .> a-a-i-a n-n-i-a .5-. 5 If the argument is a real matrix, TRN simply produces the transpose of the real matrix. Try, for example, TRN(A), and compare it with TRAN(A). In RPN mode, the transconjugate of matrix A is calculated by using BMTRH. Note: The calculator also includes Function TRAN in the MATRICES/OPERATIONS sub-menu: HATRICES HEHU 1 . CREATE.. 3 . FftCTORiaflTIOn.. H . QUADRATIC FORH.. 5 . LiriEHF; SVSTEHS.. 6 . LIHEhF; AFFL. HATRIK OPERATION HEAU 13.SI.aE r iH.SD.RH 15. S RAD lg.TRAC^^^^^^^ i^ha'trTc^ For example, in ALG mode: : TRRHCRi [-2.5 .3 2 1 4-2 1.9 -. 1 I 2 TT - 5 J Function CON The function takes as argument a list of two elements, corresponding to the number of row and columns of the matrix to be generated, and a constant Page 1 0-8 value. Function CON generates a matrix with constant elements. For example, in ALG mode, the following command creates a 4x3 matrix whose elements are all equal to -1 .5: : C0NK4 3 ^-1.5) -1.5-1.5-1.51 -1.5-1.5-1.5 -1.5-1.5-1.5 -1.5 -1.5 -l.sJ In RPN mode this is accomplished by using i 4». 3> [enter] CDCZDCS (JtJ (enter) CON. Function IDN Function IDN (IDeNtity matrix) creates an identity matrix given its size. Recall that an identity matrix has to be a square matrix, therefore, only one value is required to describe it completely. For example, to create a 4x4 identity matrix in ALG mode use: : IDHC43 [1 0 0 01 0 10 0 0 0 10 .0 0 0 lJ You can also use an existing square matrix as the argument of function IDN, ri 0 0i 0 1 0 10 0 lJ The resulting identity matrix will have the same dimensions as the argument matrix. Be aware that an attempt to use a rectangular (i.e., non-square) matrix as the argument of IDN will produce an error. In RPN mode, the two exercises shown above are created by using: 14 J[enter) IDN and 111 IDN. Page 1 0-9 Function RDM Function RDM (Re-DiMensioning) is used to re-write vectors and matrices as matrices and vectors. The input to the function consists of the original vector or matrix followed by a list of a single number, if converting to a vector, or two numbers, if converting to a matrix. In the former case the number represents the vector's dimension, in the latter the number of rows and columns of the matrix. The following examples illustrate the use of function RDM: Re-dimensioning a vector into a matrix The following example shows how to re-dimension a vector of 6 elements into a matrix of 2 rows and 3 columns in ALG mode: In RPN mode, we can use C 1 ? 2«. 3*. 4*. 6 "I [enter] { ?«. 3> [enter] RDM to produce the matrix shown above. Re-dimensioning a matrix into another matrix In ALG mode, we now use the matrix created above and re-dimension it into a matrix of 3 rows and 2 columns: In RPN mode, we simply use i 3«. £> [enter] RDM. Re-dimensioning a matrix into a vector To re-dimension a matrix into a vector, we use as arguments the matrix followed by a list containing the number of elements in the matrix. For example, to convert the matrix from the previous example into a vector of length 6, in ALG mode, use: Page 10-10 :RDM(flNS(l)/£3 2H 14 - bJ If using RPN mode, we assume that the matrix is in the stack and use i Note: Function RDM provides a more direct and efficient way to transform lists to arrays and vice versa, than that provided at the end of Chapter 9. Function RANM Function RANM (RANdom Matrix) will generate a matrix with random integer elements given a list with the number of rows and columns (i.e., the dimensions of the matrix). For example, in ALG mode, two different 2x3 matrices with random elements are produced by using the same command, namely, RflNM<< 2~. '. : RHNMK2 3>i [-5 -7 -91 12 5 sJ : RHNMK2 3>i [-4 9 41 i-9 -5 SJ In RPN mode, use {2,3} (enter} RflHM. Obviously, the results you will get in your calculator will most certainly be different than those shown above. The random numbers generated are integer numbers uniformly distributed in the range [-10,10], i.e., each one of those 21 numbers has the same probability of being selected. Function RANM is useful for generating matrices of any size to illustrate matrix operations, or the application of matrix functions. Function SUB Function SUB extracts a sub-matrix from an existing matrix, provided you indicate the initial and final position of the sub-matrix. For example, if we Page 10-11 want to extract elements a12/ a13/ a22/ and a23 from the last result, as a 2x2 sub-matrix, in ALG mode, use: : RRNMK2 3>i [-4 9 41 SUB(flNS(l)/£l 2W2 3H [9 41 1-5 SJ In RPN mode, assuming that the original 2x3 matrix is already in the stack, use { I :s 2> {enter} ■;; 2 j 3> {enter} SUB. Function REPL Function REPL replaces or inserts a sub-matrix into a larger one. The input for this function is the matrix where the replacement will take place, the location where the replacement begins, and the matrix to be inserted. For example, keeping the matrix that we inherited from the previous example, enter the matrix: L L 1 ;s :■ 3 J L 4 :s 5 :s 6 J :■ C 7 8 ? 9 J J . In ALG mode, the following screen shot to the left shows the new matrix before pressing [enter} . The screen shot to the right shows the application of function RPL to replace the matrix in HNS<2>, the 2x2 matrix, into the 3x3 matrix currently located in RNS< 1 >, starting at position i 2> : :SUBCRHSC1W1 £>,{£ 3» [9 4 1-5 S 1 2 3 4 5 6 7 S 9. krl^IHHljl^lillUKHI^jd If working in the RPN mode, assuming that the 2x2 matrix was originally in the stack, we proceed as follows: C C 1 ;i 2 :i 3 "I := C 4 5 6 "I :: C 7 := 3 :s 9 "I "I {enter} (T) (this last key swaps the contents of stack levels 1 and 2) -i! 2> {enter} (another swapping of levels 1 and 2) REP! Page 10-12 Function -^DIAG Function ->DIAG takes the main diagonal of a square matrix of dimensions nxn, and creates a vector of dimension n containing the elements of the main diagonal. For example, for the matrix remaining from the previous exercise, ir1 :REPL(flNS(l)/£2 2>,f =INS(2H 2 31 II. 9 4 -5 SJ :+DIflG(flNS(lH [1 9 S] In RPN mode, with the 3x3 matrix in the stack, we simply have to activate function ->DIflG to obtain the same result as above. Function DIAG^ Function DIAG-> takes a vector and a list of matrix dimensions {rows, columns}, and creates a diagonal matrix with the main diagonal replaced with the proper vector elements. For example, the command I f\Q ( [" ;{ .. ■■■■■ ;| .. .. 3 ] „ \ 3 .. "»:; )■ j produces a diagonal matrix with the first 3 elements of the vector argument: L'lHLjHHLl -1 v :=:_!,■:.:=: :=:.:■ i "1 0 01 10 -1 0l L0 0 2J In RPN mode, we can use L 1 ? - 1 * 2 * 3 1 (enter) ■■: 3 ;s 3 } (enter) D I AG to obtain the same result as above. Another example of app ication of the DIAG-> function follows, in ALG mode: iDlHU-HLl ^4 1 [1 01 0 2l J00J In RPN mode, use L 1 2 :■ 3 :■ 4 ■■ 5 "I [enter) ■{ 3 2 > [enter) D I AG -> . In this case a 3x2 matrix was to be created using as main diagonal elements as many elements as possible form the vector [1,2,3,4,5]. The main diagonal, for a rectangular matrix, starts at position (1,1) and moves on to position (2,2), (3,3), etc. until either the number of rows or columns is exhausted. In this case, the number of columns (2) was exhausted before the number of rows (3), Page 10-13 so the main diagonal included only the elements in positions (1,1) and (2,2). Thus, only the first two elements of the vector were required to form the main diagonal. Function VANDERMONDE Function VANDERMONDE generates the Vandermonde matrix of dimension n based on a given list of input data. The dimension n is, of course, the length of the list. If the input list consists of objects {x]f x2/... xn}, then, a Vandermonde matrix in the calculator is a matrix made of the following elements: 1 1 1 1 x„ 4 ■ •■ x"~ For example, the following command in ALG mode for the list {1,2,3,4}: :VRHDERM0HDEC{1 2 3 4» [1 1 1 1 1 1 2 4 1 3 9 27 .1 4 16 64J In RPN mode, enter < 3. ;i £? 3? 4> (^D VANDERMONDE. Function HUBERT Function HUBERT creates the Hilbert matrix corresponding to a dimension n. By definition, the nxn Hilbert matrix is Hn = [hjk]nXn, so that Page 10-14 The Hilbert matrix has application in numerical curve fitting by the method of linear squares. A program to build a matrix out of a number of lists In this section we provide a couple of UserRPL programs to build a matrix out of a number of lists of objects. The lists may represent columns of the matrix (program H333) or rows of the matrix (program B333). The programs are entered with the calculator set to RPN mode, and the instructions for the keystrokes are given for system flag 1 17 set to SOFT menus. This section is intended for you to practice accessing programming functions in the calculator. The programs are listed below showing, in the left-hand side, the keystrokes necessary to enter the program steps, and, in the right-hand side, the characters entered in the display as you perform those keystrokes. First, we present the steps necessary to produce program CRMC. Lists represent columns of the matrix The program 13339 allows you to put together a pxn matrix (i.e., p rows, n columns) out of n lists of p elements each. To create the program enter the following keystrokes: Keystroke sequence: Produces: Q=T] _«o> THEN M + ROLL END « < OBJ^ ^ARRY IF DUP ^ n 1 SWAP FOR n Page 10-15 05?G_i3aaa 11:111 mm NEXT C535?c_liaaa III lilii IF S ED® C^DCD n 1 rgnfflG nan bum > C5D^_!!l !! nan THEN 1 (alpha) C^3CDC3 n 1 - L*~l J ^ iJi:!:!.L!!!! ILiMJJj!! FOR i n + rgn^ siaaa r^nsm ROLL J , ::.:::.:.::::•.:.:: ::.:::::::.:.:••• NEXT (jTJ^G mm fTI! Pi i ill END [alpha) ( <n j (n\ jspcj n r<T)MTH mum llSEll bct-» COL^ (^) Program is displayed in level 1 To save the program: ^^(a^(a^(Q(^(m\(c](a^ha) {sfo>) Note: if you save this program in your HOME directory it will be available from any other sub-directory you use. To see the contents of the program use L^J C5DB333. The program listing is the following: ■:!:: D! IP _» !■■ 1 !.=.! H P PHP i i_> -^HPPV TP i n •( TI-IPN i 1 ■■!■■ ROLL END NEXT IF n l' >""tHEN 1 n'f- FOR A j 1 ' h- "ROLL." !■■.!!»"':■:'"!'' !" !■■.!!"■■ \"\"\\ To use this program, in RPN mode, enter the n lists in the order that you want them as columns of the matrix, enter the value of n, and press ESS. As an example, try the following exercise: ■;; 1 , v, 3, 4> (enter) i :!. :: 4, 9, 16> (enter) ■:; 1 :s 8:5 27, 64 } (enter) 3 (enter) m$\m The following screen shots show the RPN stack before and after running program illlH: J- 4: {1 2 3 4} 3: {14 9 16) £: {1 S 27 64) l: 3 l: [1 1 1 " £43 3 9 27 .4 16 64. Page 10-16 To use the program in ALG mode, press ill!!! followed by a set of parentheses (1*1 YJ. ). Within the parentheses type the lists of data representing the columns of the matrix, separated by commas, and finally, a comma, and the number of columns. The command should look like this: ■ ::-:!:: : ■: : ■ .. ::.:. .. .. : :-. The ALG screen showing the execution of program CRMC is shown below: :CRMC(U 2 3 4M1 4 9 16>,> [111 2 4 S 3 9 27 .4 16 64. HYP | H 'I ij L" 2 1 H L" I Tl □ | H L" I Tl 2 1 H T M Tl 2 1 H H L F T Lists represent rows of the matrix The previous program can be easily modified to create a matrix when the input lists will become the rows of the resulting matrix. The only change to be performed is to change COL^ for ROW^ in the program listing. To perform this change use: OS 3D 3D 3D [alpha) [alpha] (r\ (q\ (wj [alpha] (enter) List program CRMC in stack Move to end of program Delete COL Type in ROW, enter program To store the program use: ^^(^h^(^ha)(c)(r\(m\(r\(^ha) C^D ■;; 1 , v, 3, 4> (enter) •; 1 |S 4:; 9S 16> (enter) •; 1 i5 S, 27 j 64 > [enter] 3 (enter] MEM The following screen shots show the RPN stack before and after running program lajiLLu: 4: 3: 2: l: U. 2. 3. 4-> {1. 2- 9. 16. > {1. 3. 27. 64. > 3. l: 2. 3. 4- i 0: 2. 9. 16. 1 3. 27. 64. J These programs can be useful for statistical applications, specifically to create the statistical matrix ZDAT. Examples of the use of these program are shown in a latter chapters. Page 10-17 Manipulating matrices by columns The calculator provides a menu with functions for manipulating matrices by operating in their columns. This menu is available through the MTH/MATRIX/COL. sequence: (C5D^- ) shown in the figure below with system flag 1 1 7 set to CHOOSE boxes: HATH HEnU i . VECTOR.. i 3. LIST.. i H. HYPERBOLIC. 5 . REAL.. 6. BASE.. HATRIK HEnU i.HAHE.. ij. a.nORHALIZE.. 3.FACT0RS.. I 5. R0H.. 6. LSG or through the MATRICES/CREATE/COLUMN sub-menu: HATRICES HEnU a.OPERATIOnS.. 3. FACTORISATION. H . QUADRATIC FORH.. 5 . LIREAR SYSTEHS.. 6 . LIREAR APFL.. HATRIK CREATE HEMJ a.ROH.. 1 3 . AUGHEnT H.IDn 5. con c.-hhag Droaches will show the same unctions: CREATE COL HEMJ CREATE COL HEHU [ 3.C0L+ H.COL- 5.CSHP fi. HATRIK.. 3.C0L+ H.COL- 5.CSHP fi. CREATE.. When system flag 1 1 7 is set to SOFT menus, the COL menu is accessible through [jhJmth WmMMIISM W32M , or through rfT\ matrices flMIi lllllSulll Both approaches will show the same set o c:<nHi]aHi]aH]gKiiii!Tiit functions: The operation of these functions is presented below. Function -^COL Function -^COL takes as argument a matrix and decomposes it into vectors corresponding to its columns. An application of function ->COL in ALG mode is shown below. The matrix used has been stored earlier in variable A. The matrix is shown in the figure to the left. The figure to the right shows the matrix Page 10-18 decomposed in columns. To see the full result, use the line editor (triggered by pressing ^7 ). :fl -2.5 4.2 2. .3 1.92.81 _ 2. -.1 .5 : +COLCFI) <[-2.5 .3 2.] [4.2 1. T .5 .9 - To I 2. -.1 -^coLcni tt-2.5 .3 2.] [4.2 1 £[-2.5? .3,2. ]? [4.2, 1.9,-. 1], [ 2 . ,2.3, .511, 3. y , ffaitiiHitiieEgiiigiqi'JiMtua In RPN mode, you need to list the matrix in the stack, and the activate function ->COL, i.e., IIIIIIII ->COL. The figure below shows the RPN stack before and after the application of function ->COL. 4: 3: 2: l: -2.5 4.2 2. .3 1.92.31 2. -.1 .5 P1 £: 5: 4: [-2.5.32.] 3: [4.21.9-.1] 2: [2. 2.3 .5] 1 ' 3 In this result, the first column occupies the highest stack level after decomposition, and stack level 1 is occupied by the number of columns of the original matrix. The matrix does not survive decomposition, i.e., it is no longer available in the stack. Function COL^ Function COL^ has the opposite effect of Function -^COL, i.e., given n vectors of the same length, and the number n, function COL-> builds a matrix by placing the input vectors as columns of the resulting matrix. Here is an example in ALG mode. The command used was: COL -> ( L I ■■■ !■::! ■■■ 3 1 » L 4 ■■■ 3 ■■■ 6 J » L 7 S 9 J 3 ) :C0L-K[1. 2. 3.]I4. s! 6. In RPN mode, place the n vectors in stack levels n+1, n, n-l,...,2, and the number n in stack level 1 . With this set up, function COL-> places the vectors Page 10-19 as columns in the resulting matrix. The following figure shows the RPN stack before and after using function COL->. 4: [1. 2. 3.] 3: [4. 5. 6.] 2: [7. 3. 9.] l: 3. 2: l: 4. 5. 3. 1 L3. 6. 9j Function COL+ Function COL+ takes as argument a matrix, a vector with the same length as the number of rows in the matrix, and an integer number n representing the location of a column. Function COL+ inserts the vector in column n of the matrix. For example, in ALG mode, we'll insert the second column in matrix A with the vector [-1,-2,-3], i.e., In RPN mode, enter the matrix first, then the vector, and the column number, before applying function COL+. The figure below shows the RPN stack before 4: 2: l: [-2.5 4-2 2. 1 ■ 3 1-92.3 . 2. -.1 .5J C-l. -2. -3.] 2. 4: 3: 2: l: [-2.5 -1. 4.2 2. 1 .3 -2. 1.9 2. Si . 2. -3. -.1 .5j Function COL- Function COL- takes as argument a matrix and an integer number representing the position of a column in the matrix. Function returns the original matrix minus a column, as well as the extracted column shown as a vector. Here is an example in the ALG mode using the matrix stored in A: :C0L-CR,3.) 1-2.5 4.2 [[-2.5 4.2] I || ^3 l.|j [2. 2.3 .5]j Page 1 0-20 In RPN mode, place the matrix in the stack first, then enter the number representing a column location before applying function COL-. The following figure shows the RPN stack before and after applying function COL- Function CSWP Function CSWP (Column SWaP) takes as arguments two indices, say, i and j, (representing two distinct columns in a matrix), and a matrix, and produces a new matrix with columns i and j swapped. The following example, in ALG mode, shows an application of this function. We use the matrix stored in L Z. -. 1 . !D J [-2.5 2. 4.21 1 2.S 1.9 .2? .5 -.lJ In RPN mode, function CSWP lets you swap the columns of a matrix listed in stack level 3, whose indices are listed in stack levels 1 and 2. For example, the following figure shows the RPN stack before and after applying function CSWP to matrix A in order to swap columns 2 and 3: As you can see, the columns that originally occupied positions 2 and 3 have been swapped. Swapping of columns, and of rows (see below), is commonly used when solving systems of linear equations with matrices. Details of these operations will be given in a subsequent Chapter. Manipulating matrices by rows The calculator provides a menu with functions for manipulating matrices by operating in their rows. This menu is available through the Page 10-21 MTH/MATRIX/ROW. . sequence: (QD^™- ) shown in the figure below with system f ^9 1 1 7 set to CHOOSE boxes: HATH HEMJ i.VECTOR.. 1 \2 . HATRI mm 3. LIST.. H. HYPERBOLIC. ? S . REAL.. G . EASE.. L or through the MATRICES/CREATE/ROW sub-menu HATRIK HEnU i.HAHE.. 1 a.nORHALISE.. 3. FACTORS.. > H.COL.. G.LSG HATRICES HEnU a.OPERATIOnS.. 3. FACTORIZATION. H. QUADRATIC FORM.. S . LIREAR SYSTEHS.. G.LinEAR AFPL.. Both approaches will show the same HATRIK CREATE HEMJ 3 . AUGHEhT H.IDn 5. con G.-4IAG I CREATE ROM HEHU a.ROH-n 3.R0H+ H.ROH- 5.RCI G.RCIJ unctions: CREATE RON HEHU 3.R0H-* 3.R0H+ H.ROH- 5.RCI G.RCIJ When system flag 1 1 7 is set to SOFT menus, the ROW menu is accessible through [jT}mw ••H!:!::"""n" iiFlv"""::::: iillr:5i-"i"i"ii !.s j.-.l JL-Jll II: J.! j.illli IHII.lIlslsLi-lll or through [^matrices Both approaches will show the same set of functions: The operation of these functions is presented below. Function -^ROW Function ^ROW takes as argument a matrix and decomposes it into vectors corresponding to its rows. An application of function ->ROW in ALG mode is shown below. The matrix used has been stored earlier in variable A. The matrix is shown in the figure to the left. The figure to the right shows the matrix decomposed in rows. To see the full result, use the line editor (triggered by pressing ^3? ). Page 10-22 :fl f-2.5 4. 2 2. 1 ■3 1. 9 2.8 l 2. -. 1 .5] : +RCMfl) {[-2.5 4.2 2.] [.3 1 .9 2. ► I 2. -.1 .5 ■*ROH(fl) {[-2.5 4.2 2.] [. 3 1.9 2. H 4C-2.5i4.2i2.], [.3, 1.9,2.8], [2. ,-. 1, .5], 3. > In RPN mode, you need to list the matrix in the stack, and the activate function ^ROW, i.e., ill ^ROW. The figure below shows the RPN stack before and after the application of function ->ROW. [-2.5 4.2 2.] C.3 1.9 2.3] [2. -.1 .5] 3 In this result, the first row occupies the highest stack level after decomposition, and stack level 1 is occupied by the number of rows of the original matrix. The matrix does not survive decomposition, i.e., it is no longer available in the stack. Function ROW-> Function ROW^ has the opposite effect of the function -^ROW, i.e., given n vectors of the same length, and the number n, function ROW-> builds a matrix by placing the input vectors as rows of the resulting matrix. Here is an example in ALG mode. The command used was: : : _V :" ■■ "": ": :" .■: ■::" .■" ": : ? sS s": ": "": "■. !":. !■'■! ~7 s-. !.. .!. ;■ ;■ ..! ;■ !.. ~v ;■ ..J ;■ D ..! !.. ;■ O ji ::;! ..I Z- .-! :R0N+(C1. 2. 3.] 14. 5. 6* 1. 2. 3.1 4. 5. 6. .7. 3. 9. J In RPN mode, place the n vectors in stack levels n+1, n, n-l,...,2, and the number n in stack level 1 . With this set up, function ROW-> places the vectors as rows in the resulting matrix. The following figure shows the RPN stack before and after using function ROW->. Page 10-23 4: 3: 2: l: CI. 2. 3.] C4. 5. 6.] [7. 3. 9.] 3. 1- §! II; 3. Function ROW+ Function ROW+ takes as argument a matrix, a vector with the same length as the number of rows in the matrix, and an integer number n representing the location of a row. Function ROW+ inserts the vector in row n of the matrix. For example, in ALG mode, we'll insert the second row in matrix A with the vector [-1 ,-2,-3], i.e., :R0N+(FI,[-1 . -2. -3.],2.:i -2.5 4.2 2. -1. -2. -3. .3 1.92.3 . 2. -.1 .5. In RPN mode, enter the matrix first, then the vector, and the row number, before applying function ROW+. The figure below shows the RPN stack before and after applying function ROW+. 4-- 3: 2: l: [-2.5-1. 4.2 2. 1 .3 -2. 1.92.81 . 2. -3. -. 1 Function ROW- Function ROW- takes as argument a matrix and an integer number representing the position of a row in the matrix. The function returns the original matrix, minus a row, as well as the extracted row shown as a vector. Here is an example in the ALG mode using the matrix stored in A: R0N-CR.3.) -2.5 ^.2 2. 1[2 _ t > ■ 3 1.9 2. SJ " 1 " - In RPN mode, place the matrix in the stack first, then enter the number representing a row location before applying function ROW-. The following figure shows the RPN stack before and after applying function ROW-. Page 1 0-24 Function RSWP Function RSWP (Row SWaP) takes as arguments two indices, say, i and j, (representing two distinct rows in a matrix), and a matrix, and produces a new matrix with rows i and j swapped. The following example, in ALG mode, shows an application of this function. We use the matrix stored in variable A for the example This matrix is listed first. . J [-£.54.2 2. 2. -.1 -5 .3 1.92. In RPN mode, function CSWP lets you swap the rows of a matrix listed in stack level 3, whose indices are listed in stack levels 1 and 2. For example, the following figure shows the RPN stack before and after applying function CSWP to matrix A in order to swap rows 2 and 3: As you can see, the columns that originally occupied positions 2 and 3 have been swapped. Function RCI Function RCI stands for multiplying Row I by a Constant value and replace the resulting row at the same location. The following example, written in ALG mode, takes the matrix stored in A, and multiplies the constant value 5 into row number 3, replacing the row with this product. .3 1.92. S| 2. -.1 .5. :RCI(fl,5.,3.:i "-2.54.2 2. .3 1.92. S| 10. -.52. Page 1 0-25 This same exercise done in RPN mode is shown in the next figure. The left- hand side figure shows the setting up of the matrix, the factor and the row number, in stack levels 3, 2, and 1 . The right-hand side figure shows the resu Iti ng matrix after function RCI is activated. Function RCIJ Function RCIJ stands for "take Row I and multiplying it by a constant C and then add that multiplied row to row J, replacing row J with the resulting sum/' This type of row operation is very common in the process of Gaussian or Gauss-Jordan elimination (more details on this procedure are presented in a subsequent Chapter). The arguments of the function are: (1) the matrix, (2) the constant value, (3) the row to be multiplied by the constant in(2), and (4) the row to be replaced by the resulting sum as described above. For example, taking the matrix stored in variable A, we are going to multiply column 3 times 1 .5, and add it to column 2. The following example is performed in ALG mode: :kUlJU-l,l ■ -Z' i3 ■ i2 ■ J [-^.5 4.2 2. 1 3.3 1.753.55 .2. -.1 .5 J In RPN mode, enter the matrix first, followed by the constant value, then by the row to be multiplied by the constant value, and finally enter the row that will be replaced. The following figure shows the RPN stack before and after applying function RCIJ under the same conditions as in the ALG example shown at Dove: 4: [-2.5 4.2 2. 1 .3 1.92.8 I 2. -.1 .5] 3: 1.5 2: 3. l: 2. 3 = 4: 3: 2: l: [-2.5 4.2 2. 1 1.75 3.55 -.1 .5 J Page 1 0-26 Chapter 1 1 Matrix Operations and Linear Algebra In Chapter 10 we introduced the concept of a matrix and presented a number of functions for entering, creating, or manipulating matrices. In this Chapter we present examples of matrix operations and applications to problems of linear algebra. Operations with matrices Matrices, like other mathematical objects, can be added and subtracted. They can be multiplied by a scalar, or among themselves. An important operation for linear algebra applications is the inverse of a matrix. Details of these operations are presented next. To illustrate the operations we will create a number of matrices that we will store in variables. The generic name of the matrices will be A// and B//, where / represents the number of rows and / the number of columns of the matrices. The matrices to be used are generated by using function RANM (random matrices). If you try this exercise in your calculator you will get different matrices than the ones listed herein, unless you store them into your calculator exactly as shown below. Here are the matrices A22, B22, A23, B23, A32, B32, A33 and B33 created in ALG mode: :RAnH(£a 2YMH22 Lli a J \? -si L-s sJ In RPN mode, the steps to follow are: ■; 2=: £} (enter) RflNM ; fl££ E (TroT) { £ == 3 y [enter] RflHM ': fl£3 E (stq>J { 3 :e 2} [enter] RflHM 5 H3£ 5 { 3 :e 3} [enter] RflNM 5 A3 3 5 ; .;■ [ENTER] ; } [enter) ! } [enter] \ ';■ [enter] Rfli-iH 5 RflNM 5 (sToyj '* [STOtJ 1:3 3 £ 5 [sTQtJ B33 5 [sjo>) Page 11-1 Addition and subtraction Consider a pair of matrices A = [ajj]mXn and B = [bjj]mXn. Addition and subtraction of these two matrices is only possible if they have the same number of rows and columns. The resulting matrix, C = A ± B = [Cjj]mXn has elements c^ = a^ ± bjj. Some examples in ALG mode are shown below using the matrices stored above (e.g., EBl(^fJ lllillil) Translating the ALG examples to RPN is straightforward, as illustrated here. The remaining examples of matrix operations will be performed in ALG mode only. Multiplication There are different multiplication operations that involve matrices. These are described next. Multiplication by a scalar Multiplication of the matrix A = [ajj]mXn by a scalar k results in the matrix C = kA = [Cjj]mXn = [kajj]mXn. In particular, the negative of a matrix is defined by the operation -A =(-1 )A = [-a^] mXn. Some examples of multiplication of a matrix by a scalar are shown below. :fi23+B23 In RPN mode, the steps to follow are: fl££ {enter) B££LflV7^JL + J fl££ G^D B££G^^G3 fl£3 [enter) B2.3[enter)1 + j fl£3 [enter) B2.3[enter)1_ — ) R3£ [enter) B3£Qa^GD H3£ (enter) B3£SGED Page 11-2 By combining addition and subtraction with multiplication by a scalar we can form linear combinations of matrices of the same dimensions, e.g., In a linear combination of matrices, we can multiply a matrix by an imaginary number to obtain a matrix of complex numbers, e.g., S-?.6-i I 1 1H--H>6>i lG--5>G>i 1 -2-6-6-i s-a-e-i J f-tie-an-i) -(6,6) 1 (iH.aH) (16..30) ia-na-i s-ia-i J Matrix-vector multiplication Matrix-vector multiplication is possible only if the number of columns of the matrix is equal to the length of the vector. This operation follows the rules of matrix multiplication as shown in the next section. A couple of examples of matrix-vector multiplication follow: Page 1 1-3 Vector-matrix multiplication, on the other hand, is not defined. This multiplication can be performed, however, as a special case of matrix multiplication as defined next. Matrix multiplication Matrix multiplication is defined by CmXn = AmXp-BpXn, where A = [ajj]mXp/ B = [bjj]pXn/ and C = [Cjj]mXn. Notice that matrix multiplication is only possible if the number of columns in the first operand is equal to the number of rows of the second operand. The general term in the product, is defined as p cij=Yaaik -bkJ, for i = 1,2,... ,m; j = 1,2,... ,n. k=\ This is the same as saying that the element in the i-th row and j-th column of the product, C, results from multiplying term-by-term the i-th row of A with the j- th column of B, and adding the products together. Matrix multiplication is not commutative, i.e., in general, AB ^ B A. Furthermore, one of the multiplications may not even exist. The following screen shots show the results of multiplications of the matrices that we stored earlier: :fi33-B33 " 16 31 -63 -103 3 11? -HH 3H 36 &33.fi33 ?H 13 IS 33 -35 -13 IPS 6? Pfliittllttliittllttl B32-A23 The matrix-vector multiplication introduced in the previous section can be thought of as the product of a matrix mxn with a matrix nxl (i.e., a column vector) resulting in an mxl matrix (i.e., another vector). To verify this assertion check the examples presented in the previous section. Thus, the vectors defined in Chapter 9 are basically column vectors for the purpose of matrix multiplication. Page 1 1 -4 The product of a vector with a matrix is possible if the vector is a row vector, i.e., a Ixm matrix, which multiplied with a matrix mxn produces a lxn matrix (another row vector). For the calculator to identify a row vector, you must use double brackets to enter it, e.g., ■ l?-2 1-5 -331 :&23 [0 H -HI U -6 -SJ = ii 3i-flns(i) lis -in -asi Term-by-term multiplication Term-by-term multiplication of two matrices of the same dimensions is possible through the use of function HADAMARD. The result is, of course, another matrix of the same dimensions. This function is available through Function catalog (CB^ ), or through the MATRICES/OPERATIONS sub-menu :HH[ihMhF;[ii:h??,E:??:i -3 asi -HO HZ 1-35 -6 3 J :Hh[ihHhF;[m:h22,E:22:i -56 0 1 [ 0 id :Hh[ihMHR[ii:E:?2,h?2:i -isi -na ho o J :Hh[ihMhF;[ii:E:27,h27:i -aoi 1-13 -2H -hoJ The identity matrix In Chapter 9 we introduce the identity matrix as the matrix I = [5jj]nXn, where 8^ is the Kronecker's delta function. Identity matrices can be obtained by using function IDN described in Chapter 9. The identity matrix has the property that A I = I- A = A. To verify this property we present the following examples using the matrices stored earlier on: Page 1 1-5 The inverse matrix The inverse of a square matrix A is the matrix A"1 such that A A1 = A1 -A = I, where I is the identity matrix of the same dimensions as A. The inverse of a matrix is obtained in the calculator by using the inverse function, INV (i.e., the L '/* J key). An example of the inverse of one of the matrices stored earlier is presented next: -15 -H 35 3H5 3H5 3H5 -1 _26_ zll 2H3 3H3 3H3 H? 23 H3 To verify the properties of the inverse matrix, we present the following multiplications: IlI 1 Ll| Lli o iJ ri oi Lli iJ :flaa-inv(flaa) ri oi Lli iJ Characterizing a matrix (The matrix NORM menu) The matrix NORM (NORMALIZE) menu is accessed through the keystroke sequence Ij^Jmth_ (system flag 1 1 7 set to CHOOSE boxes): HHTH HERU i . VECTOR.. H. HYPERBOLIC. 5 . REAL.. 6. EASE.. This menu contains the following functions: HATRIK RORH HETll a.snRH 3 . F; Ti F; M H.CnRH 5.SRAD e.conD HATRIK HERU i.HAKE.. a . AORHALIZE.. 3. FACTORS. . H.C0L.. 5 . RON.. 6. LSG HATRIK nORH HERU c.cord [ ? . RARK E . DET 5 . TRACE iO.TRAA I ™ ^^^^1 Page 1 1-6 These functions are described next. Because many of these functions use concepts of matrix theory, such as singular values, rank, etc., we will include short descriptions of these concepts intermingled with the description of functions. Function ABS Function ABS calculates what is known as the Frobenius norm of a matrix. For a matrix A = [a^] mXn, the Frobenius norm of the matrix is defined as If the matrix under consideration in a row vector or a column vector, then the Frobenius norm , | |A| |F , is simply the vector's magnitude. Function ABS is accessible directly in the keyboard as UjJ^bs_ . Try the following exercises in ALG mode (using the matrices stored earlier for matrix operations): : IA22I 2--JT7 : IA23I ■J170 : IB32I J95 : IE33I : IA33I 2-J70 : IA32I ■J227 Function SNRM Function SNRM calculates the Spectral NoRM of a matrix, which is defined as the matrix's largest singular value, also known as the Euclidean norm of the matrix. For example, SNRMCFI22) SNRMCFI32) SNRMCFI33) 8. 14.7146399549 14. 1367419471 Page 11-7 Singular value decomposition To understand the operation of Function SNRM, we need to introduce the concept of matrix decomposition. Basically, matrix decomposition involves the determination of two or more matrices that, when multiplied in a certain order (and, perhaps, with some matrix inversion or transposition thrown in), produce the original matrix. The Singular Value Decomposition (SVD) is such that a rectangular matrix AmXn is written as AmXn = UmXm -SmXn -V TnXn, Where U and V are orthogonal matrices, and S is a diagonal matrix. The diagonal elements of S are called the singular values of A and are usually ordered so that S; > si+1, for i = 1 , 2, n-1 . The columns [Uj] of U and [Vj] of V are the corresponding singular vectors. (Orthogonal matrices are such that U- UT = I. A diagonal matrix has non-zero elements only along its main diagonal). The rank of a matrix can be determined from its SVD by counting the number of non-singular values. Examples of SVD will be presented in a subsequent section. Functions RNRM and CNRM Function RNRM returns the Row NoRM of a matrix, while function CNRM returns the Column NoRM of a matrix. Examples, : RNRMCR22) : CHRMCA22J : RHRMCR33J 8 8 21 CHRMCR33) RHRMCA23) : CHRMCR23) ~2I 26 19 16 bnaMMna;iiana;iMna;iMffnaMand bn=«iana;iiana;iMna;iiaffnaMand Row norm and column norm of a matrix The row norm of a matrix is calculated by taking the sums of the absolute values of all elements in each row, and then, selecting the maximum of these sums. The column norm of a matrix is calculated by taking the sums of the absolute values of all elements in each column, and then, selecting the maximum of these sums. Page 1 1-8 Function SRAD Function SRAD determines the Spectral RADius of a matrix, defined as the largest of the absolute values of its eigenvalues. For example, SRFlD(Fl22) SRFlD(Fl33) E SRFlD(B22) 8. 8.8339 1257969 15.5156097709 Definition of eigenvalues and eigenvectors of a matrix The eigenvalues of a square matrix result from the matrix equation Ax = Xx. The values of X that satisfy the equation are known as the eigenvalues of the matrix A. The values of x that result from the equation for each value of I are known as the eigenvectors of the matrix. Further details on calculating eigenvalues and eigenvectors are presented later in the chapter. Function COND Function COND determines the condition number of a matrix. Examples, : C0HDCR22) : C0HDCB33) c :CQND(Fl33f 9.83617386179 6.73714359438 Condition number of a matrix The condition number of a square non-singular matrix is defined as the product of the matrix norm times the norm of its inverse, i.e., cond(A) = | | A | | x | | A1 | | . We will choose as the matrix norm, | | A | | , the maximum of its row norm (RNRM) and column norm (CNRM), while the norm of the inverse, | | A1 | |, will be selected as the minimum of its row norm and column norm. Thus, | | A| | = max(RNRM(A),CNRM(A)), and | | A1 | | = minlRNRMlA1), CNRMJA1)). Page 11-9 The condition number of a singular matrix is infinity. The condition number of a non-singular matrix is a measure of how close the matrix is to being singular. The larger the value of the condition number, the closer it is to singularity. (A singular matrix is one for which the inverse does not exist). Try the following exercise for matrix condition number on matrix A33. The condition number is COND(A33) , row norm, and column norm for A33 are shown to the left. The corresponding numbers for the inverse matrix, INV(A33), are shown to the right: C0NDCFI33) 6.78714859433^ :RHRMCn333 21. CNRMCFI33) 20. i i ni ■ in ■ i ■ ■ ■ ni ■ iTii ii ;-■ ■ ii ajmi£i^ 2^71 C0ND(INV(fl33H 6.73714359437 :RNRM(INV(fl33H .261044176707 CNRM(INV(fl33H . 339357429719 iirii'Jii.ii^i.rii'aiiTiiiiiiiiiiiiiiiMiajj Since RNRM(A33) > CNRM(A33), then we take | | A33 | | = RNRM(A33) = 21. Also, since CNRM(INV(A33)) < RNRM(INV(A33)), then we take ||INV(A33)|| = CNRM(INV(A33)) = 0.261044... Thus, the condition number is also calculated as CNRM(A33)*CNRM(INV(A33)) = COND(A33) = 6.7871485... Function RANK Function RANK determines the rank of a square matrix. Try the following examples: RflHKCn223 RAHKCE223 The rank of a matrix The rank of a square matrix is the maximum number of linearly independent rows or columns that the matrix contains. Suppose that you write a square matrix AnXn as A = [c} c2 ... cn], where c; (i = 1 , 2, n) are vectors representing the columns of the matrix A, then, if any of those columns, say ck, can be written as Ck = *c7 ? j*k,jG{l,2,...,n} Page 11-10 where the values dj are constant, we say that ck is linearly dependent on the columns included in the summation. (Notice that the values of j include any value in the set {1 , 2, n}, in any combination, as long as j^k.) If the expression shown above cannot be written for any of the column vectors then we say that all the columns are linearly independent. A similar definition for the linear independence of rows can be developed by writing the matrix as a column of row vectors. Thus, if we find that rank(A) = n, then the matrix has an inverse and it is a non-singular matrix. If, on the other hand, rank(A) < n, then the matrix is singular and no inverse exist. For example, try finding the rank for the matrix: You will find that the rank is 2. That is because the second row [2,4,6] is equal to the first row [1,2,3] multiplied by 2, thus, row two is linearly dependent of row 1 and the maximum number of linearly independent rows is 2. You can check that the maximum number of linearly independent columns is 3. The rank being the maximum number of linearly independent rows or columns becomes 2 for this case. Function DET Function DET calculates the determinant of a square matrix. For example, DETCB33) DETCR33) -246 -498 DETCE22) : DETCR22) -8 -16 Page 11-11 The determinant of a matrix The determinant of a 2x2 and or a 3x3 matrix are represented by the same arrangement of elements of the matrices, but enclosed between vertical lines, i.e., a, *21 *12 *22 a\3 a 21 a3l a32 A 2x2 determinant is calculated by multiplying the elements in its diagonal and adding those products accompanied by the positive or negative sign as indicated in the diagram shown below. / all ai2 a21 a22 0 © The 2x2 determinant is, therefore, ^^21 ^"22 Q^i * ^^22 ^"12 * ^^21 A 3x3 determinant is calculated by augmenting the determinant, an operation that consists on copying the first two columns of the determinant, and placing them to the right of column 3, as shown in the diagram below. The diagram also shows the elements to be multiplied with the corresponding sign to attach to their product, in a similar fashion as done earlier for a 2x2 determinant. After multiplication the results are added together to obtain the determinant. Page 11-12 ail ai2 ai3 a21 a22 a23 A 4 / a ail ai2 21 22 X X \ . a31 a32 a33 . t/ \/ t/ \\ © © © © © © For square matrices of higher order determinants can be calculated by using smaller order determinant called cofactors. The general idea is to " expand" a determinant of a nxn matrix (also referred to as a nxn determinant) into a sum of the cofactors, which are (n-l)x(n-l) determinants, multiplied by the elements of a single row or column, with alternating positive and negative signs. This "expansion" is then carried to the next (lower) level, with cofactors of order (n- 2)x(n-2), and so on, until we are left only with a long sum of 2x2 determinants. The 2x2 determinants are then calculated through the method shown above. The method of calculating a determinant by cofactor expansion is very inefficient in the sense that it involves a number of operations that grows very fast as the size of the determinant increases. A more efficient method, and the one preferred in numerical applications, is to use a result from Gaussian elimination. The method of Gaussian elimination is used to solve systems of linear equations. Details of this method are presented in a later part of this chapter. To refer to the determinant of a matrix A, we write det(A). A singular matrix has a determinant equal to zero. Function TRACE Function TRACE calculates the trace of square matrix, defined as the sum of the elements in its main diagonal, or tr(X) = % i=\ Examples: Page 11-13 TRnCECfl223 TRflCECB223 -6 15 |: TRFlCE(Fl33) TRFlCE(B33) 4 -7 Function TRAN Function TRAN returns the transpose of a real or the conjugate transpose of a complex matrix. TRAN is equivalent to TRN. The operation of function TRN was presented in Chapter 10. Additional matrix operations (The matrix OPER menu) The matrix OPER (OPERATIONS) is available through the keystroke sequence CfTl matrices (system flag 1 1 7 set to CHOOSE boxes): The OPERATIONS menu includes the HATRICES HEnU 1 . CREATE.. | r.FACTORIZATIOn.. H . QUADRATIC FORM.. S . LiriEHF; SVSTEHS.. B fi.LinEAR AFFL.. | HATRIX OFERATIOnJ MEHU 2.AKL ?■ . AKH H.CnRH F.LiiriD fi.DET ollowing functions: HATRIK OFERATIOnS HEMJ ? . HADAHARD [ S.LS4 5. HAD j! ID . RARK ii.RnRH HATRIK OFERATIOnS HEHU 13.si:e iH.SnRH IS. S RAD 1G . TRACE 1? . TRAR Functions ABS, CNRM, COND, DET, RANK, RNRM, SNRM, TRACE, and TRAN are also found in the MTH/MATRIX/NORM menu (the subject of the previous section). Function SIZE was presented in Chapter 10. Function HADAMARD was presented earlier in the context of matrix multiplication. Functions LSQ , MAD and RSD are related to the solution of systems of linear equations and will be presented in a subsequent section in this Chapter. In this section well discuss only functions AXL and AXM Page 11-14 Function AXL Function AXL converts an array (matrix) into a list, and vice versa. For examples, E32 nXLCE323 0 3 5 -61 -4 -3\ E33 nXLCE333 -4 1 71 -4 -5 7 -7 6 2] {{0 3> <5 -6> {-4 -3» H-4 1 7> {-4 -5 7> {-7 6 2> Note: the latter operation is similar to that of the program CRMR presented in Chapter 1 0. Function AXM Function AXM converts an array containing integer or fraction elements into its corresponding decimal, or approximate, form. For example, I I — 1 Q — ^rr — v=n I 1 -A- 1 -■ >- 1 -■ >- 1 -■ 249 249 249 -1 26 -33 249 249 249 47 23 43 .493 493 493^ ■■■■IMIMKHlita flXMtflNSUH -7. 6305220SS35E-2 -1 . ^ -4.01606425703E-3 . > 9.43775100402E-2 4.6 Function LCXM Function LCXM can be used to generate matrices such that the element aij is a function of i and j. The input to this function consists of two integers, n and m, representing the number of rows and columns of the matrix to be generated, and a program that takes i and j as input. The numbers n, m, and the program occupy stack levels 3, 2, and 1, respectively. Function LCXM is accessible through the command catalog LeD_^z; . For example, to generate a 2 '3 matrix whose elements are given by = (i+j)2, first, store the following program into variable PI in RPN mode. This is the way that the RPN stack looks before pressing [sto>) . 3 • 2: * + i j * ' (i+j>^2 ' EVflL * * l: 'PI Page 11-15 The implementation of function LCXM for this case requires you to enter: czd(^ctd(^codi Lcm (enter) The following figure shows the RPN stack before and after applying function LCXM: 3: £. 1: * ■* i j ■£ 1 <i+j)Aa! ' EVRL * * , 3: 1" [4- 9. 16.1 19- 16. £5. J n ALG mode, this example can be obtained by using: :LCXM(2./3.,RCL('Pn) I [4. 9. 16.1 19. 16. 25 .j The program PI must still have been created and stored in RPN mode. Solution of linear systems A system of n linear equations in m variables can be written as dirxi +a12-x2 + a13-x3 + ...+ a1/m.rx m_i + a1/fn-x m =bu a2rxi + a22-x2 + a23-x3 + ...+ a2/m.rx m.} + a2m-x m = b2/ a3rxi + a32-x2 + a33-x3 + ...+ a3/m.rx m.} + a3Vx m = b3/ an-l,l'Xl + Qn-l,2*X2 + an-l,3*X3 + •••+ an-l,m-rX m-1 + an-l,m'X m ~ ^n.i, an1-X]+ an2-x2 + an3-x3 + ...+ an/m-rx m-i + an,m*x m - bn. This system of linear equations can be written as a matrix equation, AnXm-xmXl = bnxi, if we define the following matrix and vectors: an an ■ xx V A = a2l i X = i b = an2 ■ ^nm _ nxm _Xm_ mxl nxl Page 11-16 Using the numerical solver for linear systems There are many ways to solve a system of linear equations with the calculator. One possibility is through the numerical solver [^Jnumslv . From the numerical solver screen, shown below (left), select the option 4. Solve I'm sys.v and press iiiiiii The following input form wi I be provide (right): i.SoLu* equation.. 3. So Luc diFF 3.£olug pol.^.. 5.SoLu« Finance.. 6.HSLV To solve the linear system Ax = b, enter the matrix A, in the format [[ all7 a12/ ... ], ... [••••]] in the A: field. Also, enter the vector b in the B: field. When the X: field is highlighted, press [SOLVE]. If a solution is available, the solution vector x will be shown in the X: field. The solution is also copied to stack level 1 . Some examples follow. A square system The system of linear equations 2x] + 3x2 -5x3 = 1 3, X] - 3x2 + 8x3 = -1 3, 2x} - 2x2 + 4x3 = -6, can be written as the matrix equation A-x = b, if 2 3-5 1 -3 8 2-2 4 x = and b = 13 -13 -6 This system has the same number of equations as of unknowns, and will be referred to as a square system. In general, there should be a unique solution to the system. The solution will be the point of intersection of the three planes in the coordinate system (x^ x2, x3) represented by the three equations. Page 11-17 To enter matrix A you can activate the Matrix Writer while the A: field is selected. The following screen shows the Matrix Writer used for entering matrix A, as well as the input form for the numerical solver after entering matrix A (press (enter} in the Matrix Writer): 1. -3. 2- -2. B. 4. H'HII'JWOiWHgK'HlMfln SOLVE SYSTEH ftK=E= .,-5-] CI.,-., Enter coefficients Hatrix ft EDIT CHOOS Press <y^? to select the B: field. The vector b can be entered as a row vector with a single set of brackets, i.e., L 13? 13? 61 111!!!:!!! . After entering matrix A and vector b, and with the X: field highlighted, we can press B3E9 to attempt a solution to this system of equations: SOLVE SVSTEH H ■ K=E [[2. ,3. ,-5. ] CI.,-, C13.i-13.i6-] Enter solutions or press SOLVE A solution was found as shown next. SOLVE SVSTEH HK=E fl= C C2. j 3. j -5. ] C 1 . j -„ *: C13. i-13. i-6. ] CI. ,2. i-l. ] Enter solutions or press SOLVE To see the solution in the stack press (enter) . The solution is x = [1 ,2,-1 ]. Solutions:Cl. 2. -1.] To check that the solution is correct, enter the matrix A and multiply times this solution vector (example in algebraic mode): Page 11-18 Solut ions:[l. 2. -1.] Under-determined system The system of linear equations 2xt + 3x2 -5x3 = -10, x} - 3x2 + 8x3 = 85, can be written as the matrix equation Ax = b, if 2 3-5 -10 A = x = and b = 1 -3 8 85 x '3 This system has more unknowns than equations, therefore, it is not uniquely determined. We can visualize the meaning of this statement by realizing that each of the linear equations represents a plane in the three-dimensional Cartesian coordinate system (xl7 x2, x3). The solution to the system of equations shown above will be the intersection of two planes in space. We know, however, that the intersection of two (non-parallel) planes is a straight line, and not a single point. Therefore, there is more than one point that satisfy the system. In that sense, the system is not uniquely determined. Let's use the numerical solver to attempt a solution to this system of equations: E» EH . Enter matrix A and vector b as illustrated in the previous example, and press l!ii!!I!I;ll when the X: field is highlighted: Page 11-19 ■X"X"X"X"X"X"X "7 f 1 1 IIC C '■' C T r H M ■ V ~ C" X'X'X'X'X'X'X1 x-x-x-x-x-x-x- -•■■■l 1 1 1 1 Ln n n-c- -x-x-x-x-x-x-x fl= CC2- ,3. ,-5. ] [1. Enter folutionf or prgff SOLVE To see the details of the solution vector, if needed, press the Ollili button. This will activate the Matrix Writer. Within this environment, use the right- and left-arrow keys to move about the vector, e.g., Thus, the solution is x = [15.373, 2.4626, 9.6268]. To return to the numerical solver environment, press (enter} . The procedure that we describe next can be used to copy the matrix A and the solution vector X into the stack. To check that the solution is correct, try the following: • Press ^ ^ , to highlight the A: field. • Press [nxtJ MSM(ENm)f to copy matrix A onto the stack. • Press li!!!!!:!!!!:!!!!!!! to return to the numerical solver environment. • Press ^? ^3? [enter) , to copy solution vector X onto the stack. • Press ECU to return to the numerical solver environment. • Press (enter) to return to the stack. In ALG mode, the stack will now look like this: Page 11-20 Bo 1 ut i ons : [ 1 5^ 373 1 3^3^ Let's store the latest result in a variable X, and the matrix into variable A, as follows: Press [^)[alpha}(x) [enter] to store the solution vector into variable X Press CS (3D to clear three levels of the stack Press [s^{Ai^(^[BfER) to store the matrix into variable A Now, let's verify the solution by using: IIIIIIII CX3 Kill [enter), which results in (press ^3? to see the vector elements): [-9.99999999999 85. ], close enough to the original vector b = [-1 0 85]. Try also this JIIECZD [15* 10^3? 10] (enter) {J+J^num [enter) f i.e., :fl(l5^10] -3S. 255. " 3 3 :+NUM(flNS(lH " " ' C-10. 85.] OQEaEaEaEa This result indicates that x = [15,10/3,10] is also a solution to the system, confirming our observation that a system with more unknowns than equations is not uniquely determined (under-determined). How does the calculator came up with the solution x = [1 5.37... 2.46... 9.62...] shown earlier? Actually, the calculator minimizes the distance from a point, which will constitute the solution, to each of the planes represented by the equations in the linear system. The calculator uses a leost-squore method, i.e., minimizes the sum of the squares of those distances or errors. Over-determined system The system of linear equations X] + 3x2 = 1 5, 2x} - 5x2 = 5, -Xt + x2 = 22, Page 11-21 can be written as the matrix equation Ax = b, if A = 1 3 2 -5 -1 1 X = , and b = 15 5 22 This system has more equations than unknowns (an over-determined system). The system does not have a single solution. Each of the linear equations in the system presented above represents a straight line in a two-dimensional Cartesian coordinate system (xl7 x2). Unless two of the three equations in the system represent the same equation, the three lines will have more than one intersection points. For that reason, the solution is not unique. Some numerical algorithms can be used to force a solution to the system by minimizing the distance from the presumptive solution point to each of the lines in the system. Such is the approach followed by the HP 49 G numerical solver. Let's use the numerical solver to attempt a solution to this system of equations: [TnNUM.sLv MM . Enter matrix A and vector b as illustrated in the previous example, and press when the X: field is highlighted: SOLVE SVSTEH HK=E fl= CC1- ,3. ] C2. ?-5. ] E= [15. ,5. ,22. ] . 02054794 Enter solutions or preff SOLVE To see the details of the solution vector, if needed, press the ilillil! button. This will activate the Matrix Writer. Within this environment, use the right- and left-arrow keys to move about the vector, e.c Page 11-22 Press [enter] to return to the numerical solver environment. To check that the solution is correct, try the following: • Press ^ ^ , to highlight the A: field. • Press [nxt) mW[§NTER)/ to copy matrix A onto the stack. • Press IB to return to the numerical solver environment. • Press ^z? ^3? EEQ3 [enter) f to copy solution vector X onto the stack. • Press llllllliLiilllllll to return to the numerical solver environment. • Press [enter) to return to the stack. In ALG mode, the stack will now look like this: Let's store the latest result in a variable X, and the matrix into variable A, as follows: Press \jj^[Ai^0[EtfrER) to store the solution vector into variable X Press (3D L*J L*J to clear three levels of the stack Press [^(alp^(a][enter} to store the matrix into variable A Now, let's verify the solution by using: ixj ililllll [enter) f which results in the vector [8.6917... -3.4109... -1.1301...], which is not equal to [15 5 22], the original vector b. The ''solution'' is simply the point that is closest to the three lines represented by the three equations in the system, and not an exact Least-square solution (function LSQ) The LSQ function returns the minimum-norm least-square solution of a linear system Ax = b, according to the following criteria: Solut ions: [3. 02054794^ solution. Page 11-23 • If A is a square matrix and A is non-singular (i.e., it's inverse matrix exist, or its determinant is non-zero), LSQ returns the exact solution to the linear system. • If A has less than full row rank (underdetermined system of equations), LSQ returns the solution with the minimum Euclidean length out of an infinity number of solutions. • If A has less than full column rank (over-determined system of equations), LSQ returns the "solution" with the minimum residual value e = Ax - b. The system of equations may not have a solution, therefore, the value returned is not a real solution to the system, just the one with the smallest residual. Function LSQ takes as input vector b and matrix A, in that order. Function LSQ can be found in Function catalog (Lr>J cat ). Next, we use function LSQ to repeat the solutions found earlier with the numerical solver: Square system Consider the system wi ith 2x} + 3x2 -5x3 = 1 3, X] - 3x2 + 8x3 = -1 3, 2x} - 2x2 + 4x3 = -6, A = 2 3 -5" " 13 1 -3 8 , x = x2 , and b = -13 2 -2 4 x3 -6 The solution using LSQ is shown next: 12 -2 -5 o I -2 4 1 [13-13-6] 2 3 -51 1 -3 3 2-2 4 [13 -13 -61 11 -y y L2-2 4 [13 -13 -61 [13 -13 -63 : LSQ(flNSm,flNS(2H CI. 2. -1 Page 11-24 Under-determined system Consider the system 2xt + 3x2 -5x3 = -10, x} - 3x2 + 8x3 = 85, wi ith A = 2 3-5 1 -3 8 x = and b = The solution using LSQ is shown next: -10 85 11 -a y j [2 3 -sj li -3 s J :[-10 35] C-10 35] LSQ(FlNSm,FlNS(£H [-10 353 1 1 5 . 373 1 343234 2 . 46263 > +£KIF 5KIF-H +4EL DEL* DEL LI I Til" ■ Over-determined system Consider the system wi ith X] + 3x2 = 1 5, 2x} - 5x2 = 5, -Xt + x2 = 22, 3 . -5 1 1 x = and b = 15 5 22 The solution LSQ is shown next: :[15 5 22] [15 5 22] LSQ(FlNSm,FlNS(2H 13.02054794521 1 .39041* Page 11-25 Compare these three solutions with the ones calculated with the numerical solver. Solution with the inverse matrix The solution to the system Ax = b, where A is a square matrix is x = A1- b. This results from multiplying the first equation by A1, i.e., A1 -A-x = A]-b. By definition, A1 -A = I, thus we write l-x = A1 b. Also, l-x = x, thus, we have, x = A] b For the example used earlier, namely, 2x} + 3x2 -5x3 = 1 3, X] - 3x2 + 8x3 = -1 3, 2xt - 2x2 + 4x3 = -6, we can find the solution in the calculator as follows: [2 3 -5] : 1 1 -3 8 L2-2 4 J m\ >|1 "5 O I A 1 12-2 4 J [2 3 -51 1-3 3 12-2 4 J :C13-13-6] f C13 -13 -6] ^» 1-3 8 12-2 4 J :[13 -13 -6] [13 -13 -61 :IHVCnHSC2)™SCl) CI 2 -1] which is the same result found earlier. Solution by "division" of matrices While the operation of division is not defined for matrices, we can use the calculator's L±J key to "divide" vector b by matrix A to solve for x in the matrix equation A-x = b. This is an arbitrary extension of the algebraic division operation to matrices, i.e., from A-x = b, we dare to write x = b/A (Mathematicians would cringe if they see this!) This, of course is interpreted as (l/A)-b = A^-b, which is the same as using the inverse of A as in the Page 11-26 previous section. The procedure for the case of "dividing" b by A is illustrated below for the case 2x] + 3x2 -5x3 = 1 3, X] - 3x2 + 8x3 = -1 3, 2x] - 2x2 + 4x3 = -6, The procedure is shown in the following screen shots: [i-pc — 5 o 1 — i 12-2 4 1 [13 -13 -61 \2 3 -51 1 -3 S 12-2 4, [13 -13 -61 [13 -13 -6] flHS(l) AHSC2) \2~4%\ [13 -13 -61 [1 2 -1] The same solution as found above with the inverse matrix. Solving multiple set of equations with the same coefficient matrix Suppose that you want to solve the following three sets of equations: X +2Y+3Z =14, 2X +4Y+6Z = 9, 2X +4Y+6Z = -2, 3X -2Y+ Z = 2, 3X -2Y+ Z = -5, 3X -2Y+ Z = 2, 4X +2Y -Z = 5, 4X +2Y -Z = 1 9, 4X +2Y -Z = 1 2. We can write the three systems of equations as a single matrix equation: AX = B, where "1 2 3 X(D X(2) X(3) A = 3 -2 1 X = *0) *(2) 7 J(3) ' 4 2 -1 7 _ (i) 7 ^(2) 7 ^(3) _ "14 9 -2" B = 2 -5 2 5 19 12 Page 11-27 The sub-indices in the variable names X, Y, and Z, determine to which equation system they refer to. To solve this expanded system we use the following procedure, in RPN mode, I" I" I 4 :: 4 :: — >' j :: j !■ CCli 2", 3 iTubV , ■■"D « i:::!..! , ID, iy, I'd A ..! {enter} ~2, 1] , [4,2,-1]] (^GED The result of this operation is: X = 1 2 2 2 5 1 3 -1 -2 Gaussian and Gauss-Jordan elimination Gaussian elimination is a procedure by which the square matrix of coefficients belonging to a system of n linear equations in n unknowns is reduced to an upper-triangular matrix (echelon form) through a series of row operations. This procedure is known as forward elimination. The reduction of the coefficient matrix to an upper-triangular form allows for the solution of all n unknowns, utilizing only one equation at a time, in a procedure known as backward substitution. Example of Gaussian elimination using equations To illustrate the Gaussian elimination procedure we will use the following system of 3 equations in 3 unknowns: 2X+4Y+6Z=14, 3X -2Y+ Z = -3, 4X+2Y -Z = -4. We can store these equations in the calculator in variables El, E2, and E3, respectively, as shown below. For backup purposes, a list containing the three equations was also created and stored into variable EQS. This way, if a mistake is made, the equations will still be available to the user. Page 11-28 :2-X+4-Y+6-Z=14^1 2- X+4-Y+6-Z=14 : 3-X-2-Y+Z=-3^2 3- X-(2-Y-Z)=-3 : 4-X+2-Y-Z=-4^3 4-X+2-Y-Z=-4 El :E2 E3 2- X+4-Y+6-Z=14 3- x-i:2-y-z:i=-3 4-X+2-Y-Z=-4 To start the process of forward elimination, we divide the first equation (El ) by 2, and store it in El, and show the three equations again to produce: :^E1 :E2 :E3 X+2-Y+3-Z-7 3-X-(2-Y-Z)=-3 4-X+2-Y-Z=-4 Next, we replace the second equation E2 by (equation 2 - 3xequation 1, i.e., E1-3xE2), and the third by (equation 3 - 4xequation 1 ), to get E2-3-E^E2 E3-4'E1*E3 -CS-Y+S-Z-24) -E6-Y+13-Z-32) :E1 E2 E3 X+2-Y+3-Z-7 -CS-Y+S-Z-24) -C6-Y+13-Z-32) Next, divide the second equation by -8, to get = ^E2 Y+Z-3 :E1 :E2 :E3 X+2-Y+3-Z-7 Y+Z-3 -C6-Y+13-Z-32) Next, replace the third equation, E3, with (equation 3 + 6xequation 2, i.e., E2+6xE3), to get E3+6■E2^E3 -C7-Z-14) El :E2 E3 X+2-Y+3-Z-7 Y+Z-3 -C7-Z-14) Notice that when we perform a linear combination of equations the calculator modifies the result to an expression on the left-hand side of the equal sign, i.e., an expression = 0. Thus, the last set of equations is interpreted to be the following equivalent set of equations: X+2Y+3Z = 7, Page 11-29 Y+ 1 = 2, -71 = A A. The process of backward substitution in Gaussian elimination consists in finding the values of the unknowns, starting from the last equation and working upwards. Thus, we solve for Z :E2 :E3 : S0LVE(E3,'Z') X+2-Y+3-Z-7 Y+Z-3 -C7-Z-14) Z=2 irst: E3 : S0LVE(E3,'Z'} SUBST(E2,FlNSm^E2 t+Z=3 -C7-Z-14) Z=2 Y+2-3 Next, we substitute 1=2 into equation 2 (E2), and solve E2 for Y: 1 -C7-Z-I4:i : S0LVE(E3,'Z') :SUBST(E2,flNS(l)»E2 : S0LVE(E2,'Y') Z=2 Y+2-3 Y=l Next, we substitute Z=2 and Y = 1 into El, and solve El for X: :SUESTCE1,Y=13 X+2-1+3-Z-7 : SUBST(FlNSm..Z=2) X+2-1+3-2-7 :FlNS(l^El X+2-1+3-2-7 X+2-1+3-Z- : SUBST(FlNSm,Z=2) X+2- 1+3-2-71 flNS(l>El X+2-1+3-2-7^ iSOLVECflHSClVX'J X=-l The solution is, therefore, X = -1 , Y = 1 , Z = 2. Example of Gaussian elimination using matrices The system of equations used in the example above can be written as a matrix equation Ax = b, if we use: (2 4 ~X' "14 A = 3 -2 1 , x = Y , b = -3 ^4 2 Z -4 To obtain a solution to the system matrix equation using Gaussian elimination, we first create what is known as the augmented matrix corresponding to A, i.e., Page 1 1-30 (2 4 6 14 ^ A - aug 3 -2 1 -3 V4 2 -1 -4J The matrix Aaug is the same as the original matrix A with a new row, corresponding to the elements of the vector b, added (i.e., augmented) to the right of the rightmost column of A. Once the augmented matrix is put together, we can proceed to perform row operations on it that will reduce the original A matrix into an upper-triangular matrix. For this exercise, we will use the RPN mode {j^^op^l^-jmM), with system flag 117 set to SOFT menu. In your calculator, use the following keystrokes. First, enter the augmented matrix, and make an extra copy of the same in the stack (This step is not necessary, except as an insurance that you have an extra copy of the augmented matrix saved in case you make a mistake in the forward elimination procedure that we are about to undertake.): C C 2 , 4 , 6 , 1 4 ] , C 3 , -2 , 1 , -3 J , C 4 , 2 , ■■■■■ 1 , 4 J "I (enter) (enter) Save augmented matrix in variable AAUG: CZIDS^S^(3(3(9(S1S™) I™*) With a copy of the augmented matrix in the stack, press [j^Jmth_ EEHjjg 033 to activate the ROW operation menu. Next, perform the following row operations on your augmented matrix. Multiply row 1 by Vr. CD CD CD IS3 Multiply row 1 by -3 add it to row 2, replacing it: CDCD CD Multiply row 1 by -4 add it to row 3, replacing it: GD CD Cz3 CD Cz3 CD Illiiliiililiililii Multiply row 2 by -1/8: □DCDCDCD Multiply row 2 by 6 add it to row 3, replacing it: CDCDCDCDCD 13513! Page 11-31 If you were performing these operations by hand, you would write the following: A A ~ Aaug ~ 2 4 6 3 -2 1 4 2-1 2 3 J 0 -8 0 -6 -8 -13 A_„ = aug 14 -3 -4 7 -24 -32 y v 1 2 3 0 1 1 0 0-7 2 -2 2 2 1 -6 7 3 -14 3 1 -1 3 1 -13 7 -3 -4 J 1 3 -32 The symbol = (" is equivalent to") indicates that what follows is equivalent to the previous matrix with some row (or column) operations involved. The resulting matrix is upper-triangular, and equivalent to the set of equations X +2Y+3Z = 7, Y+ Z = 3, -71 = -14, which can now be solved, one equation at a time, by backward substitution, as in the previous example. Gauss-Jordan elimination using matrices Gauss-Jordan elimination consists in continuing the row operations in the upper-triangular matrix resulting from the forward elimination process until an identity matrix results in place of the original A matrix. For example, for the case we just presented, we can continue the row operations as follows: Multiply row 3 by -1/7: CZDGtDQD CD EH Multiply row 3 by -1, add it to row 2, replacing it: C7~)[ +/- J lspc) I 3 J Page 11-32 Multiply row 3 by -3, add it to row 1, replacing it: CD CD CD CD CD CD IHB Multiply row 2 by -2, add it to row 1, replacing it: CDCDCDCDCDCD Writing this process by hand will result in the following steps: fl 2 3 7 > (\ 2 3 7^ fl 2 3 ?1 A - 0 1 1 3 0 1 1 3 0 1 1 1 v° 0 -7 ~l4J v° 0 1 2J 1° 0 1 2, fl 2 0 1] (\ 0 0 _1) Aug = 0 1 0 1 0 1 0 1 1° 0 1 V 0 1 2J Pivoting If you look carefully at the row operations in the examples shown above, you will notice that many of those operations divide a row by its corresponding element in the main diagonal. This element is called a pivot element, or simply, a pivot. In many situations it is possible that the pivot element become zero, in which case we cannot divide the row by its pivot. Also, to improve the numerical solution of a system of equations using Gaussian or Gauss-Jordan elimination, it is recommended that the pivot be the element with the largest absolute value in a given column. In such cases, we exchange rows before performing row operations. This exchange of rows is called partial pivoting. To follow this recommendation is it often necessary to exchange rows in the augmented matrix while performing a Gaussian or Gauss-Jordan elimination. While performing pivoting in a matrix elimination procedure, you can improve the numerical solution even more by selecting as the pivot the element with the largest absolute value in the column and row of interest. This operation may require exchanging not only rows, but also columns, in some Page 1 1-33 pivoting operations. When row and column exchanges are allowed in pivoting, the procedure is known as full pivoting. When exchanging rows and columns in partial or full pivoting, it is necessary to keep track of the exchanges because the order of the unknowns in the solution is altered by those exchanges. One way to keep track of column exchanges in partial or full pivoting mode, is to create a permutation matrix P = lnXn, at the beginning of the procedure. Any row or column exchange required in the augmented matrix Aaug is also registered as a row or column exchange, respectively, in the permutation matrix. When the solution is achieved, then, we multiply the permutation matrix by the unknown vector x to obtain the order of the unknowns in the solution. In other words, the final solution is given by P-x = b', where b' is the last column of the augmented matrix after the solution has been found. Example of Gauss-Jordan elimination with full pivoting Let's illustrate full pivoting with an example. Solve the following system of equations using full pivoting and the Gauss-Jordan elimination procedure: X+2Y + 3Z = 2, 2X+ 3Z = -1, 8X+16Y-Z = 41. The augmented matrix and the permutation matrix are as follows: "1 2 3 2 " "1 0 0" A - 2 0 3 -1 , P = 0 1 0 8 16 -1 41 0 0 1 Store the augmented matrix in variable AAUG, then press ll!i!!!i!!I!3 to get a copy in the stack. We want to keep the CSWP (Column Swap) command readily available, for which we use: CS_cat (al^(al^(c](s}(alp^} (find CSWP), ■39. You'll get an error message, press jQN J, and ignore the message. Next, get the ROW menu available by pressing: [^matrices EEMi 1393. Now we are ready to start the Gauss-Jordan elimination with full pivoting. We will need to keep track of the permutation matrix by hand, so take your notebook and write the P matrix shown above. Page 11-34 First, we check the pivot au. We notice that the element with the largest absolute value in the first row and first column is the value of a31 = 8. Since we want this number to be the pivot, then we exchange rows 1 and 3, by using: UJL^LiJt^lJ EKH. The augmented matrix and the permutation matrix now are: 8 16 -1 41 0 0 1 2 0 3-1 010 12 3 2 0 0 1 Checking the pivot at position (1,1) we now find that 16 is a better pivot than 8, thus, we perform a column swap as follows: LiJC^JCDLr^J—^z; EDI 16 8 -1 41 0 2 3 -1 2 1 3 2 0 0 1 1 0 0 0 1 0 Now we have the largest possible value in position (1,1), i.e., we performed full pivoting at (1,1). Next, we proceed to divide by the pivot: CD CD CD CD CD . The permutation matrix does not change, but the augmented matrix is now: 1 1/2 -1/16 41/16 0 2 3-1 2 13 2 0 0 1 1 0 0 0 1 0 The next step is to eliminate the 2 from position (3,2) by using: CD CD CD CD CD CD IHB 1 1/2 -1/16 41/16 0 2 3-1 0 0 25/8 -25/8 0 0 1 1 0 0 0 1 0 Having filled up with zeros the elements of column 1 below the pivot, now we proceed to check the pivot at position (2,2). We find that the number 3 in position (2,3) will be a better pivot, thus, we exchange columns 2 and 3 by using: CD CD CD GD-^i; ilSlI 1 -1/16 1/2 41/16 0 1 0] Page 1 1-35 0 3 2-1 0 25/8 0 -25/82 1 0 0 0 0 1 Checking the pivot at position (2,2), we now find that the value of 25/8, at position (3,2), is larger than 3. Thus, we exchange rows 2 and 3 by using: CDGDCD_CD 1 0 0 -1/16 25/8 3 1/2 0 2 41/16 -25/8 -1 0 0 1 1 0 0 0 1 0 Now, we are ready to divide row 2 by the pivot 25/8, by using CD CD CD CD CD 0> CD CD (W)I35 1 -1/16 1/2 41/16 0 1 0 0 10-1 001 0 3 2-1 10 0 Next, we eliminate the CD CD CD CD CD CD ESS 1 -1/16 1/2 0 1 0 0 0 2 3 from position (3,2) by using: 41/16 -1 2 0 0 0 1 0 Having filled with zeroes the position below the pivot, we proceed to check the pivot at position (3,3). The current value of 2 is larger than V2 or 0, thus, we keep it unchanged. We do divide the whole third row by 2 to convert the pivot to 1 , by using: CDCDCDi 0 1 0 0 0 1 1 0 0 1 -1/16 1/2 41/16 0 10-1 0 0 1 1 Next, we proceed to eliminate the V2 in position (1,3) by using: CD CD CD® CD CD CD ESS 1 0 0 -1/16 1 0 0 0 1 33/16 -1 1 0 0 1 1 0 0 1 0 0 Page 1 1-36 Finally, we eliminate the -1/16 from position (1 ,2) by using: 0 1 0 0 1 0 0 2 0 1 0 -1 0 0 1 1 0 0 0 We now have an identity matrix in the portion of the augmented matrix corresponding to the original coefficient matrix A, thus we can proceed to obtain the solution while accounting for the row and column exchanges coded in the permutation matrix P. We identify the unknown vector x, the modified independent vector b' and the permutation matrix P as: Y " 2 " "0 1 0" X Y , b'= -1 , P = 0 0 1 Z 1 1 0 0 The solution is given by P x=b', or "0 1 0 0 0 1 1 0 0 Which results in X 3 Y -1 Z 1 ~Y~ ' 3 " Z -1 X 1 Step-by-step calculator procedure for solving linear systems The example we just worked is, of course, the step-by-step, user-driven procedure to use full pivoting for Gauss-Jordan elimination solution of linear equation systems. You can see the step-by-step procedure used by the calculator to solve a system of equations, without user intervention, by setting the step-by-step option in the calculator's CAS, as follows: Page 11-37 _CflS MODEL" HoduU: 13 _nuH«ric _flppfOX _COHpUX _Y«rbos« ^St«p^St«p _Incr Foh ^ Rigorous ^SiHp non-Rational Enter injgp gnjgnt uari abjj nam Then, for this particular example, in RPN mode, use: C 2 , 1 1 4 1 3 [enter} [ [ l - 2 - 3 "I , C 2 , 8 , 3 "I , C 8 16,-1]] (enter) [^J The calculator shows an augmented matrix consisting of the coefficients matrix A and the identity matrix I, while, at the same time, showing the next procedure to calculate: _2=L2-2-Ll 1 2 3 1 0 0] 2 0 3 0 1 0 S 16 -1 0 0 1 L2 = L2-2-L1 stands for " replace row 2 (L2) with the operation L2 - 2-L1 . If we had done this operation by hand, it would have corresponded to: [^[^iJ^CD(JK)CD^^- Press 11, and follow the operations in your calculator's screen. You will see the following operations performed: L3=L3-8-Ll, LI = 2-L1--U2, LI =25-Ll--3 L3, L2 = 25-L2-3-L3, and finally a message indicating "Reduction result" showing: deduction result 50 0 0 -24 25 3" 0 -100 0 -26 25-3 0 0 -25 -S 0 1 When you press EEH, the calculator returns the final result [1 2-1]. Calculating the inverse matrix step-by-step The calculation of an inverse matrix can be considered as calculating the solution to the augmented system [A | I ]. For example, for the matrix A used in the previous example, we would write this augmented matrix as aug(I) 1 2 3 3 -2 1 4 2-1 1 0 0 0 1 0 0 0 1 Page 1 1-38 To see the intermediate steps in calculating and inverse, just enter the matrix A from above, and press LAJ, while keeping the step-by-step option active in the calculator's CAS. Use the following: c c i , 2 , 3 ::i , c 3 , -2 , l ::i , c 4 , 2 , ■■■■■ i :i ::i (^cs After going through the different steps, the solution returned is: - . . What the calculator showed was not exactly a Gauss-Jordan elimination with full pivoting, but a way to calculate the inverse of a matrix by performing a Gauss-Jordan elimination, without pivoting. This procedure for calculating the inverse is based on the augmented matrix (Aaug)nXn = [AnXn | lnXn]. The calculator showed you the steps up to the point in which the left-hand half of the augmented matrix has been converted to a diagonal matrix. From there, the final step is to divide each row by the corresponding main diagonal pivot. In other words, the calculator has transformed (Aaug)nXn = [AnXn | lnXn], into [I | A1]. Inverse matrices and determinants Notice that all the elements in the inverse matrix calculated above are divided by the value 56 or one of its factors (28, 7, 8, 4 or 1). If you calculate the determinant of the matrix A, you get c/e/(A) = 56. We could write, A1 = C/c/ef(A), where C is the matrix 0 8 8 C = 7 -13 8 14 6 -8 The result (A1)^ = CnXn /c/e/(AnXn), is a general result that applies to any non- singular matrix A. A general form for the elements of C can be written based on the Gauss-Jordan algorithm. Page 11-39 Based on the equation A"1 = A"1, is not defined if c/e/(A) singular matrix. C/det(A), sketched above, the inverse matrix, = 0. Thus, the condition c/e/(A) = 0 defines also a Solution to linear systems using calculator functions The simplest way to solve a system of linear equations, Ax = b, in the calculator is to enter b, enter A, and then use the division function /. If the system of linear equations is over-determined or under-determined, a "solution" can be produced by using Function LSQ (Least-SQuares), as shown earlier. The calculator, however, offers other possibilities for solving linear systems of equations by using Functions included in the MATRICES' LINEAR SYSTEMS., menu accessible through [^matrices (Set system flag 1 1 7 to CHOOSE boxes): MHTRIlEl" METiU i. CREATE.. a.OFERATIOnS.. 3. FACTORIZATION. H. QUADRATIC FORM.. S . LInEAR SVSTEn: G.LinEAR HFFL.. HATRIK LinEAR SYS. HERU a.REF 3.rr«F H.RREF S . SVST2HAT C.HATRICES.. The functions included are LINSOLVE, REF, rref, RREF, and SYST2MAT. Function LINSOLVE Function LINSOLVE takes as arguments an array of equations and a vector containing the names of the unknowns, and produces the solution to the linear system. The following screens show the help-facility entry (see Chapter 1 ) for function LINSOLVE, and the corresponding example listed in the entry. The right-hand side screen shows the result using the line editor (press to activate): -IHSOLVE: So lues a system of . inear equations .INSOLVEt [X+Y=3? X-Y=l ] [X=2 Y=l] See: SOLVE HELP LINS0LVE(EX+Y=3 X-Y=l> «[X+Y=3 X-Y=l] [X Y]> Spe> K[X+Y=3,X-Y=1]? [X? Y]>? :Specif ic: £2? -2,2, 1, >,IX=2,Y=1]> Here is another example in ALG mode. Enter the following: I T N i "! ! v F ( \ x ■■■■■ '? * V ■■!■■ 7 === ■■■■■ ft , '? * x + V ■■■■■ * 7 ==: ft == s:::i * x ■■■■■ :":s * V + 7 ^ ■■■■■ I :":s "I == "CX, V,Z]> Page 1 1-40 to produce the solution: C X=— 1 Y=2 ? Z Function LINSOLVE works with symbolic expressions. Functions REF, rref, and RREF, work with the augmented matrix in a Gaussian elimination approach. Functions REF, rref, RREF The upper triangular form to which the augmented matrix is reduced during the forward elimination part of a Gaussian elimination procedure is known as an "echelon" form. Function REF (Reduce to Echelon Form) produces such a matrix given the augmented matrix in stack level 1 . Consider the augmented matrix, 1 -2 1 0 A - 2 1 -2 -3 5 -2 1 12 Representing a linear system of equations, Ax = b, where A_ r r -j „ .....p.. -j "i „ r v.. 1 .. -■■P"i .. ri:::;.. - v.. I "! "I and b = \ Enter the augmented matrix, and save it into variable AAUG, in ALG mode: c c i , -2 , i , e ::i , c 2 , i , "2 , -3 ::i c 5 , -2 , 1 , 1 2 ::i ::i ► rrug Application of function REF produces: A. I >— 1 = ^"1 I5-2 1 iz[ : REFCRRUG) 1-2 1 0 0 1 1 .0 0 1 7 ^ fiTiTEII^lgi^ll^lIiHM^a The result is the upper triangular (echelon form) matrix of coefficients resulting from the forward elimination step in a Gaussian elimination procedure. Page 11-41 The diagonal matrix that results from a Gauss-Jordan elimination is called a row-reduced echelon form. Function RREF ( Row-Reduced Echelon Form) The results of this function call is to produce the row-reduced echelon form so that the matrix of coefficients is reduced to an identity matrix. The extra column in the augmented matrix will contain the solution to the system of equations. As an example, we show the result of applying function RREF to matrix AAUG in ALG mode: : RREFCRRUG) 0 I .0 0 1 i ■_■ ■ 5 5 1 7 J [1 0 0 31 0 10 5 .0 0 1 7] The result is final augmented matrix resulting from a Gauss-Jordan elimination without pivoting. A row-reduced echelon form for an augmented matrix can be obtained by using function rref. This function produces a list of the pivots and an equivalent matrix in row-reduced echelon form so that the matrix of coefficients is reduced to a diagonal matrix. For example, for matrix AAUG, function rref produces the following result: 1 rref(RRUG) Piyots:{3 1.4 1.5 £.> ^ r 4 1. ^1 Z.> *3, 1. ,4,1., t :Piuots 5.2. }» [[£0,0,0,60] [0, 15,0,75] [0,0, 12,84]] y The second screen above is obtained by activating the line editor (press <s^?). The result shows pivots of 3, 1,4, 1,5, and 2, and a reduced diagonal matrix. Function SYST2MAT This function converts a system of linear equations into its augmented matrix equivalent. The following example is available in the help facility of the calculator: Page 11-42 : HELP : SYST2MRTCCX+Y X-Y=2]lH 3VST2MflT<CX+V,X-V=2iP HELP : SYST2MRTCCX+Y X-Y=2],l>> The result is the augmented matrix corresponding to the system of equations: X+Y = 0 X-Y =2 Residual errors in linear system solutions (Function RSD) Function RSD calculates the ReSiDuals or errors in the solution of the matrix equation Ax=b, representing a system of n linear equations in n unknowns. We can think of solving this system as solving the matrix equation: f(x) = b - Ax = 0. Suppose that, through a numerical method, we produce as a first approximation the solution x(0). Evaluating f(x(0)) = b - A-x(0) = e ^ 0. Thus, e is a vector of residuals of Function for the vector x = x (0). To use Function RSD you need the terms b, A, and x(0), as arguments. The vector returned is e = b - A-x(0). For example, using A = C C 2 , - 1 J C 0 , 2 J J , x(0) = C 1 . 8 , 2 . 7 J , and b = C 1 , 6 J , we can find the vector of residuals as follows: RSD<Cl,6]i [[2,-l][0? 211, [1.8,2.7]^ RSd[[1 6H,[| 21],H1.S 2.7> [-1 .6] The result is e = b - A-x(0) = C "I , Note: If we let the vector Ax = x - x (0), represent the correction in the values of x (0), we can write a new matrix equation for Ax, namely A-Ax = e. Solving for Ax we can find the actual solution of the original system as x = x(0) + Ax. Page 1 1 -43 Eigenvalues and eigenvectors Given a square matrix A, we can write the eigenvalue equation Ax = ^-x, where the values of X that satisfy the equation are known as the eigenvalues of matrix A. For each value of X, we can find, from the same equation, values of x that satisfy the eigenvalue equation. These values of x are known as the eigenvectors of matrix A. The eigenvalues equation can be written also as (A - X-I)x = 0. This equation will have a non-trivial solution only if the matrix (A - ^-1) is singular, i.e., if det(A - ^-1) = 0. The last equation generates an algebraic equation involving a polynomial of order n for a square matrix AnXn. The resulting equation is known as the characteristic polynomial of matrix A. Solving the characteristic polynomial produces the eigenvalues of the matrix. The calculator provides a number of functions that provide information regarding the eigenvalues and eigenvectors of a square matrix. Some of these functions are located under the menu MATRICES/EIGEN activated through [^matrices . HATRICES HEHU 3. FACTORIZATION. H . QUADRATIC FORH.. S . LIREAR SYSTEHS.. e.LinEAR HFFL.. 3 . VECTOR.. HATRIK EIGEJWECT. HEHU 2. EGY ! 3. EGVL | H.JORDAn ! 5. PCAR | C.PHini ! Function PCAR Function PCAR generates the characteristic polynomial of a square matrix using the contents of variable VX (a CAS reserved variable, typically equal to 'X') as the unknown in the polynomial. For example, enter the following matrix in ALG mode and find the characteristic equation using PCAR: ■■■ ■- ■■ ■::: : "■ r ■■ .-■ "■ ■ : ■:::■ "■ "■ l :.. .!. n ~j \i ■■ ■.::> ..: :.. :» ~ .!. \i st ..! :■ !.. :■ .J :■ ..! ..! Page 1 1 -44 I 13 5 2 J A ] 13 5 2 1 :PCflR(flHS(lH Using the variable X to represent eigenvalues, this characteristic polynomial is to be interpreted as X 3-2X 2-22X +2 1 =0. Function EGVL Function EGVL (EiGenVaLues) produces the eigenvalues of a square matrix. For example, the eigenvalues of the matrix shown below are calculated in ALG mode using function EGVL: The eigenvalues X = [ -Vl 0, Vl 0 ]. Note: In some cases, you may not be able to find an 'exact' solution to the characteristic polynomial, and you will get an empty list as a result when using Function EGVL. If that were to happen to you, change the calculation mode to Approx in the CAS, and repeat the calculation. For example, in exact mode, the following exercise produces an empty list as the solution: 15 -2 lJ -2 11 B -1 2 -2 lJ :EGVL(flHS(lH Page 11-45 Change mode to Approx and repeat the entry, to get the following eigenvalues: L \ 1 » Jo :: d ■,. ) E-. 1 » JH —'d !S dd ) 5-. — 1 » r'b ;: U .i5 ..! . Function EGV Function EGV (EiGenValues and eigenvectors) produces the eigenvalues and eigenvectors of a square matrix. The eigenvectors are returned as the columns of a matrix, while the corresponding eigenvalues are the components of a vector. For example, in ALG mode, the eigenvectors and eigenvalues of the matrix listed below are found by applying function EGV: ±L> 1 ■ CJCJ -1.00 5.00 3.00 1.00 3.00 4.00 TTWTTWl 3. 4. 00 00] -1.00 5.00 1.00 3.00 :EGVCRHSC1.00i) ^1.00 1.00 "0.031 0.79 -0.51 1.00 [0 -0 .91 0.65 0.34 J ta[fiiH[fiEEgiiigiqNi«tiiaj The result shows the eigenvalues as the columns of the matrix in the result list. To see the eigenvalues we can use: GET(ANS(1 ),2), i.e., get the second element in the list in the previous result. The eigenvalues are: 1 i.lh- — o.yy 4.uu| EGV(flNS(1.00H 1.00 1.00 -0.03 0.79 -0.51 1.00 | C0. H -0.91 0.65 0.84 :GET(FINS(1.00),£.00) [0.29 3. 16 7.54] bi:tiaH^cc»ii.»oi.]«in(M] I In summary, X} = 0.29, Xt = [ 1. 00,0.79,-0.91 ]T, ^2 = 3.16, x2 = [1.00,-0.51, 0.65] T, ^3 = 7.54, Xt = [-0.03, 1 .00, 0.84] T. Note: A symmetric matrix produces all real eigenvalues, and its eigenvectors are mutually perpendicular. For the example just worked out, you can check that Xt »x2 = 0, Xt »x3 = 0, and x2 oc3 = 0. Page 1 1 -46 Function JORDAN Function JORDAN is intended to produce the diagonalization or Jordan-cycle decomposition of a matrix. In RPN mode, given a square matrix A, function JORDAN produces four outputs, namely: • The minimum polynomial of matrix A (stack level 4) • The characteristic polynomial of matrix A (stack level 3) • A list with the eigenvectors corresponding to each eigenvalue of matrix A (stack level 2) • A vector with the eigenvectors of matrix A (stack level 4) For example, try this exercise in RPN mode: C C4, 1,-2], Li , 2, 1 , 0]] JORDAN The output is the following: 'XA3+-6*xA2+2*X+8' 'XA3+-6*xA2+2*X+8' {} {} The same exercise, in ALG mode, looks as in the following screen shots: i-^ -i o J 4 1-2 1 2 -1 -2-1 0 JORDflHCflHSC133 CX-A-3-6*XA2+2*X+83 X^3-6 *XA2+2*X+B,0,0> I 1 2 -1| 1-2 -1 0 J : JORDFMflNS(l)) t XA3-6*ttA2+2*X+S, X^3-ej *XA2+2*X+B,OiO> 4X-A-3-6*X^2+2*X+8! X^3- 6*XA2+2*X+B,0,0> Function MAD This function, although not available in the EIGEN menu, also provides information related to the eigenvalues of a matrix. Function MAD is available through the MATRICES OPERATIONS sub-menu (^matrices ) and is intended to produce the adjoint matrix of a matrix. Page 11-47 In RPN mode, function MAD generate a number of properties of a square matrix, namely: • the determinant (stack level 4) • the formal inverse (stack level 3), • in stack level 2, the matrix coefficients of the polynomial p(x) defined by (x-l-A) •p(x)=m(x)-l/ • the characteristic polynomial of the matrix (stack level 1) Notice that the equation (x-l-A)-p(x)=m(x)-l is similar, in form, to the eigenvalue equation Ax = A,-x. As an example, in RPN mode, try: cc 4, i,-2] ci , --i ::i --:!. mad The result is: -8. [[ 0.1 3 -0.25 -0.38][-0.25 0.50 -0.25][-0.38 -0.25 -0.88]] {[[1 0 0][0 1 0][0 0 1]] [[-2 1 -2][1 -4-l][-2-l -6] [[-1 2 3] [2 -4 2][3 2 7]]} 'XA3+-6*xA2+2*X+8' The same exercise, in ALG mode, will look as follows: [t . rj rj a. i . rjrj i. . cjrj ■ 1-00 2.00 -1-001 -2.00 -1.00 0.00 J :MRDCRHSC1.003) "0.13 -0.25-0.3 -3.00 1-0.25 0.50 -0.> -0.33 -0.25 -0.3 [[. 125,-. 25,-. 375] [-.25,. 5,-. 25] [-.375?-.25?-.S75]]? [[1,0,0] [0, 1,0] Matrix factorization Matrix factorization or decomposition consists of obtaining matrices that when multiplied result in a given matrix. We present matrix decomposition through the use of Functions contained in the matrix FACT menu. This menu is accessed through l<n J matrices . Page 1 1-48 HHTRIlEl" HEHU i. CREATE.. a.OFERRTIOnS.. 3.FHCT0RIZflTI0n.. H . QUADRATIC FORH.. S . LiriEHF; SVSTEHS.. H.LiriEHF; HFFL.. HflTRIK FACTOR. HERU a.m ?-.ar, H.gr S . l'lHUF; c.svd MhTRI!-! FACTOR. HERU 3.GR H.qr S . l'lHUF; c.svd Function contained in this menu are: LQ, LU, QR,SCHUR, SVD, SVL Function LU Function LU takes as input a square matrix A, and returns a lower-triangular matrix L, an upper triangular matrix U, and a permutation matrix P, in stack levels 3, 2, and 1, respectively. The results L, U, and P, satisfy the equation PA = LU. When you call the LU function, the calculator performs a Crout LU decomposition of A using partial pivoting. For example, in RPN mode: C C - 1 , 2 , 5 "I C 3 , 1 , -2 "I C 7 , 6 , 5 "I J LU produces: 3:[[7 0 0][-l 2.86 0][3 -1.57-1] 2: [[1 0.86 0.71][0 1 2][0 0 1]] 1: [[0 0 1][1 0 0] [0 1 0]] In ALG mode, the same exercise will be shown as follows: 3-00 1.00-2.00 7.00 6.00 5.00 LUCRHSCl . 00)3 7.00 0.00 0.00 -1.00 2. 36 0.00 3.00 -1.57 -1.00J 1. 0. 0. [[7. ?0. ?0. ] [-1. ?2. 85714285714,0 [3. ?-l. 57142357143,- [[1. ? .357142357143, .7 [0. ? 1. ?2. ] [0. ,0. ,1,]] taitiimtiCE'nii'Hqi'n«tuaj Orthogonal matrices and singular value decomposition A square matrix is said to be orthogonal if its columns represent unit vectors that are mutually orthogonal. Thus, if we let matrix U = [V] v2 ... vn] where the Vj, i = 1 , 2, n, are column vectors, and if Vj«Vj = 8^ where SS| is the Kronecker's delta function, then U will be an orthogonal matrix. This conditions also imply that U- UT = I. Page 11-49 The Singular Value Decomposition (SVD) of a rectangular matrix AmXn consists in determining the matrices U, S, and V, such that AmXn = U mXm S mXn -V T nXn/ where U and V are orthogonal matrices, and S is a diagonal matrix. The diagonal elements of S are called the singular values of A and are usually ordered so that s, >si+lf for / = 1 , 2, n-1 . The columns [Uj] of U and [Vj] of V are the corresponding singular vectors. Function SVD In RPN, function SVD (Singular Value Decomposition) takes as input a matrix AnXm/ and returns the matrices UnXn/ VmXm, and a vector s in stack levels 3, 2, and 1, respectively. The dimension of vector s is equal to the minimum of the values n and m. The matrices U and V are as defined earlier for singular value decomposition, while the vector s represents the main diagonal of the matrix S used earlier. For example, in RPN mode: C C 5 , 4 , - 1 ] , C 2 , -3 , 5 "! , C 7 , 2 , 8 "I "I SVD 3: [[-0.27 0.81 -0.53][-0.37 -0.59 -0.72][-0.89 3.09E-3 0.46]] 2: [[ -0.68 -0.14 -0.72][ 0.42 0.73 -0.54][-0.60 0.67 0.44]] 1: [ 12.15 6.88 1.42] Function SVL Function SVL (Singular VaLues) returns the singular values of a matrix AnXm as a vector s whose dimension is equal to the minimum of the values n and m. For example, in RPN mode, C C 5 , 4 , - 1 ] , L 2 , -3 , 5 J , C 7 , 2 , 8 "I "I SVL produces [ 12.15 6.88 1.42]. Function SCHUR In RPN mode, function SCHUR produces the Schur decomposition of a square matrix A returning matrices Q and T, in stack levels 2 and 1, respectively, such that A = Q T QT, where Q is an orthogonal matrix, and T is a triangular matrix. For example, in RPN mode, c c 2 , 3 , ■■■■■ i ::i c 5 , 4 , ■-2 ::i c 7 , 5 , 4 ::i ::i schur results in: 2: [[0.66 -0.29 -0.70][-0.73 -0.01 -0.68][ -0.1 9 -0.96 0.21 ]] Page 1 1-50 1 : [[-1 .03 1 .02 3.86 ][ 0 5.52 8.23 ][ 0 -1 .82 5.52]] Function LQ The LQ function produces the LQ factorization of a matrix AnXm returning a lower LnXm trapezoidal matrix, a QmXm orthogonal matrix, and a PnXn permutation matrix, in stack levels 3, 2, and 1 . The matrices A, L, Q and P are related by PA = LQ. (A trapezoidal matrix out of an nxm matrix is the equivalent of a triangular matrix out of an nxn matrix). For example, EC 1, -2, ill 2, 1, -2]E 5, -2, ill LQ produces 3: [[-5.48 0 0][-l .1 0 -2.79 0][-l .83 1 .43 0.78]] 2: [[-0.91 0.37-0.18] [-0.36-0.50 0.79] [-0.20-0.78 -0.59]] 1: [[0 0 1][0 1 0][1 0 0]] Function QR In RPN, function QR produces the QR factorization of a matrix AnXm returning a QnXn orthogonal matrix, a RnXm upper trapezoidal matrix, and a PmXm permutation matrix, in stack levels 3, 2, and 1 . The matrices A, P, Q and R are related by A P = Q R. For example, EC 1,-2, ill 2, 1,-2]E 5,-2, ill QR produces 3: [[-0.18 0.39 0.90][-0.37 -0.88 0.30][-0.91 0.28-0.30]] 2: [[ -5.48 -0.37 1 .83][ 0 2.42 -2.20][0 0 -0.90]] 1: [[1 0 0][0 0 1][0 1 0]] Note: Examples and definitions for all functions in this menu are available through the help facility in the calculator. Try these exercises in ALG mode to see the results in that mode. Matrix Quadratic Forms A quadratic form from a square matrix A is a polynomial expression originated from x-AxT. For example, if we use A = [[2,1,-1][5,4,2][3,5,- 1 ]], and x = [X Y Z]T, the corresponding quadratic form is calculated as Page 11-51 Finally, x • A • xr = [X Y Z] = [X Y z\ x-AxT 2 1 -1 X 5 4 2 • Y 3 5-1 Z 2X+Y-Z ' 5X + 4Y + 2Z 3X + 5Y-Z 2X2+4Y2-Z2+6XY+2XZ+7ZY The QUADF menu The HP 49 G calculator provides the QUADF menu for operations related to QUADratic Forms. The QUADF menu is accessed through C+T) matrices . matrices hehu 1. CREATE.. 2. OPERATION.. 3 . FACTORIZATION. H . QUADRATIC FORH.. S . LiriEHF; SYSTEHS.. e.LinEAR hffl.. HflTRIK yUHC. FORM HERU 3.GHUSS H . GKR 5. SYLVESTER fi.HHTRICES.. This menu includes functions AXQ, CHOLESKY, GAUSS, QXA, and SYLVESTER. Function AXQ In RPN mode, function AXQ produces the quadratic form corresponding to a matrix AnXn in stack level 2 using the n variables in a vector placed in stack level 1 . Function returns the quadratic form in stack level 1 and the vector of variables in stack level 1 . For example, c c 2 1 1 1 ■■■■■ i ::i i c 5 1 4 , 2 ::i , c 3 , 5 *. ■■■■■ 1 ::i ::i ^ c 5 x 5 , 5 v 5 , 5 z 5 ::i ^ rxq returns 2: '2*XA2+(6*Y+2*Z)*X+4*YA2+7*Z*y-ZA2' 1 : [X 'Y' T] Page 11-52 Function QXA Function QXA takes as arguments a quadratic form in stack level 2 and a vector of variables in stack level 1, returning the square matrix A from which the quadratic form is derived in stack level 2, and the list of variables in stack level 1 . For example, 5 !::! 2 + Y ""■ — Z """ 2 + s4 * !::! * Y — 1 6 * !::! * Z 5 [enter) c 5 x 5 , 5 y 5 , 5 z 5 ::i [enter} QXA returns 2: [[1 2-8][2 1 0][-8 0-1]] 1 : [X 'Y' 'Z'] Diagonal representation of a quadratic form Given a symmetric square matrix A, it is possible to "diagonalize" the matrix A by finding an orthogonal matrix P such that PT A P = D, where D is a diagonal matrix. If Q = x A xT is a quadratic form based on A, it is possible to write the quadratic form Q so that it only contains square terms from a variable y, such that x = P y, by using Q = x AxT = (P y) A (P-y)T = y(PTAP)y=yDyT Function SYLVESTER Function SYLVESTER takes as argument a symmetric square matrix A and returns a vector containing the diagonal terms of a diagonal matrix D, and a matrix P, so that PT A P = D. For example, c c 2 , i , ■-■ i ::i , c i , 4 , 2 ::i , c ■■■■■ 1 , 2 , ■■■■■ 1 ::i ::i svl vester produces 2: [ 1/2 2/7-23/7] 1: [[2 1 -1][0 7/2 5/2][0 0 1]] Function GAUSS Function GAUSS returns the diagonal representation of a quadratic form Q = x-A-xT taking as arguments the quadratic form in stack level 2 and the vector of variables in stack level 1 . The result of this function call is the following: • An array of coefficients representing the diagonal terms of D (stack level 4) • A matrix P such that A = PT-D-P (stack level 3) • The diagonalized quadratic form (stack level 2) Page 1 1-53 • The list of variables (stack level 1 ) For example, c 5 x 5 , 5 v 5 , 5 z 5 ::i ^ gruss returns 4 3 2 1 [1 -0.333 20.333] [[1 2 -8] [0-3 16][0 0 1]] ,61/3*ZA2+-l/3*(16*Z+-3*Y)A2+(-8*z+2*Y+X)A2/ [X 'Y' T] Linear Applications HflTRICES HEHU r.FHCTORIIfiTIOn.. H.GURDRRTIC FORH.. S . LiriEHF: SYSTEHS.. I m hi 1 1 ■ 1 1 IM F.EIGEnVECTORS.. S . VECTOR.. LiriEHF; HFFL METiU a.isoH ?■ . KEF; H.HKISOH 5. MATRICES.. menu is presented below by i calculator's own help facility. The figures show the help facility entry and the attached examples. Function IMAGE IMAGE: Image of a linear ap- plication of matrix M IMAGED [1,2, 3], [4,5,6] {[1 0] [0 1]} See: KER BRSIS HELP ™»fli§ID {[1 0] [0 1]> Function ISOM Finds elements of a 2-d or 3-d linear isometry ISOM<CC0,-13, Cli0]]> See: MKISQM Page 11-54 Function KER Kernel of a linear ap- plication of matrix M <ER<CCl,2,3]i C4,5,6]]> See: IMAGE Function MKISOM MKISOM: I Make an isometry giuen its elements MKISOM<tt, 1) [C-1,0], C0?-1]] See: ISOM : HELP {[-1 2 -1]> :HELP :MKIS0M(tt,1) Page 1 1-55 Chapter 1 2 Graphics In this chapter we introduce some of the graphics capabilities of the calculator. We will present graphics of functions in Cartesian coordinates and polar coordinates, parametric plots, graphics of conies, bar plots, scatterplots, and a variety of three-dimensional graphs. Graphs options in the calculator To access the list of graphic formats available in the calculator, use the keystroke sequence LjnJi^ (GD ) Please notice that if you are using the RPN mode these two keys must be pressed simultaneously to activate any of the graph functions. After activating the 2D/3D function, the calculator will produce the PLOT SETUP window, which includes the TYPE field as illustrated below. woooooooooooooooooow F L V T _■ E T U F .; TMD*:liH.L.UlJ.« Eft: Ind«p = K _SiHUl.t ^Connect H-TiCh:10. Y-TiCh:10. Choos* typ« of put Right in front of the TYPE field you will, most likely, see the option Function highlighted. This is the default type of graph for the calculator. To see the list of available graph types, press the soft menu key labeled BIHSE3. This will produce a drop down menu with the following options (use the up- and down- arrow keys to see all the options): Page 12-1 These graph options are described briefly next. Function: for equations of the form y = f(x) in plane Cartesian coordinates Polar: for equations of the from r = f(0) in polar coordinates in the plane Parametric: for plotting equations of the form x = x(t), y = y(t) in the plane Diff Eq: for plotting the numerical solution of a linear differential equation Conic: for plotting conic equations (circles, ellipses, hyperbolas, parabolas) Truth: for plotting inequalities in the plane Histogram: for plotting frequency histograms (statistical applications) Bar: for plotting simple bar charts Scatter: for plotting scatter plots of discrete data sets (statistical applications) Slopefield: for plotting traces of the slopes of a function f(x,y) = 0. Fast3D: for plotting curved surfaces in space Wireframe: for plotting curved surfaces in space showing wireframe grids Ps-Contour: for plotting contour plots of surfaces Y- Slice: for plotting a slicing view of a function f(x,y). Gridmap: for plotting real and imaginary part traces of a complex function Pr-Surface: for parametric surfaces given by x = x(u,v), y = y(u,v), z = z(u,v). Plotting an expression of the form y = f(x) In this section we present an example of a plot of a function of the form y = f(x). In order to proceed with the plot, first, purge the variable x, if it is defined in the current directory (x will be the independent variable in the calculator's PLOT feature, therefore, you don't want to have it pre-defined). Create a sub-directory called TPLOT' (for test plot), or other meaningful name, to perform the following exercise. As an example, let's plot the function, • First, enter the PLOT SETUP environment by pressing, CSDi^D . Make sure that the option Function is selected as the TYPE, and that 'X' is selected as the independent variable (INDEP). Press C^^D i!!!ii!i!Ll:!iiiiii to Page 1 2-2 return to normal calculator display. The PLOT SET UP window should look similar to this: wmmmrw setups wmmm TyP"2:|i'liL-k+lJiB Eft: Ind«p = K _SiHU(.t ^Connect H-TiCh=iD. V-TiCh:iD. ^Pixels Choose type of put • Note: You will notice that a new variable, called PPAR, shows up in your soft menu key labels. This stands for Plot PARameters. To see its contents, press LrD 13233. A detailed explanation of the contents of PPAR is provided later in this Chapter. Press L + J to drop this line from the stack. Enter the PLOT environment by pressing Ij^JJ^ (press them simultaneously if in RPN mode). Press lul!!! to get you into the equation writer. You will be prompted to fill the right-hand side of an equation Yl (x) = ■. Type the function to be plotted so that the Equation Writer shows the following: Yl00=- J2T Press (enter} to return to the PLOT SETUP window. The expression 'Yl(X) = EXP(-XA2/2)/V(2*7i)/ will be highlighted. Press to return to normal calculator display. Note: Two new variables show up in your soft menu key labels, namely EQ and Yl . To see the contents of EQ, use CSBSIli. The content of EQ is simply the function name 'Yl(X)'. The variable EQ is used by the calculator to store the equation, or equations, to plot. To see the contents of Yl press (j^J defined as the program: You will get the function Y1(X) Page 1 2-3 « 'EXP (-XA2/2) / V(2*7t) ' ». Press C3D/ twice, to drop the contents of the stack. • Enter the PLOT WINDOW environment by entering CSDJ^L (press them simultaneously if in RPN mode). Use a range of -4 to 4 for H- VI EW, then press EEQ3 to generate the V-VIEW automatically. The PLOT WINDOW screen looks as follows: ^»FL0T HiriDOH - FunaiongBK H. Indcp Loh: DflFouU Hish: Default _PiX« If Enter HiniHUH horizontal. ual.u« • Plot the graph: Q3SH3 E33I] (wait till the calculator finishes the graphs) • To see labels: DEED (nxT\ PI3II!!! EHIILl • To recover the first graphics menu: [nxtJ [nxtJ llllli! • To trace the curve: IIIIiLiillilCllLEil iSllllill! . Then use the right- and left-arrow keys (CD CD) to move about the curve. The coordinates of the points you trace will be shown at the bottom of the screen. Check that for x = 1.05 , y = 0.231. Also, check that for x = -1.48 , y = 0.134. Here is picture of the graph in tracing mode: v:i.eoE-i • To recover the menu, and return to the PLOT WINDOW environment, press (NxTjBMa, then (W)B0i. Page 1 2-4 Some useful PLOT operations for FUNCTION plots In order to discuss these PLOT options, we'll modify the function to force it to have some real roots (Since the current curve is totally contained above the x axis, it has no real roots.) Press OBI to list the contents of the function Yl on the stack: « ->X /EXP(-XA2/2)/ V(2*ti) ' ». To edit this expression use: (3D (3D (3D OCX3QCX3 [enter] Launches the line editor Moves cursor to the end of the line Modifies the expression Returns to calculator display Next, store the modified expression into variable y by using C5D RPN mode, or [jT]^ (TroT) KB in ALG mode. if in 1 x2 The function to be plotted is now, / (x) = . exp( ) - 0.1 V2;r 2 Enter the PLOT WINDOW environment by entering CSDJ^L (press them simultaneously if in RPN mode.) Keep the range of -4 to 4 for H-VIEW, press ^ HUH to generate the V-VIEW. To plot the graph, press EMI Once the graph is plotted, press iillll!!! to access the function menu. With this menu you can obtain additional information about the plot such as intersects with the x-axis, roots, slopes of the tangent line, area under the curve, etc. For example, to find the root on the left side of the curve, move the cursor near that point, and press III31I You will get the result: ROOT: -1.6635.... Press [nxt) to recover the menu. Here is the result of "553 Page 1 2-5 • If you move the cursor towards the right-hand side of the curve, by pressing the right-arrow key ((T)), and press IlliSlijl, the result now is ROOT: 1.6635... The calculator indicated, before showing the root, that it was found through SIGN REVERSAL Press (W) to recover the menu. • Pressing lllllllj! will give you the intersection of the curve with the x- axis, which is essentially the root. Place the cursor exactly at the root and press You will get the same message as before, namely SIGN REVERSAL, before getting the result l-SECT: 1.6635.... The EllIS! function is intended to determine the intersection of any two curves closest to the location of the cursor. In this case, where only one curve, namely, Y1(X), is involved, the intersection sought is that of f(x) with the x-axis, however, you must place the cursor right at the root to produce the same result. Press LnxtJ to recover the menu. • Place the cursor on the curve at any point and press illlill^ to get the value of the slope at that point. For example, at the negative root, SLOPE: 0.16670.... Press [nxT) to recover the menu. • To determine the highest point in the curve, place the cursor near the vertex and press BSE The result is EXTRM: 0.. Press [nxtJ to recover the menu. • Other buttons available in the first menu are il3I!i!3 to calculate the area under the curve, and EEEEB to shade an area under the curve. Press [nxt) to see more options. The second menu includes one button called EHiiili that flashes for a few seconds the equation plotted. Press EBU Alternatively, you can press the button DEEQ (NEXt eQuation) to see the name of the function Yl (x). Press jNxrj to recover the menu. • The button gives the value of f(x) corresponding to the cursor position. Place the cursor anywhere in the curve and press The value will be shown in the lower left corner of the display. Press [nxtJ to recover the menu. • Place the cursor in any given point of the trajectory and press TANL to obtain the equation of the tangent line to the curve at that point. The equation will be displayed on the lower left corner of the display. Press (nxt) to recover the menu. • If you press IB 'III the calculator will plot the derivative function, f'(x) = df/dx, as well as the original function, f(x). Notice that the two Page 1 2-6 curves intercept at two points. Move the cursor near the left intercept point and press illl [SSI, to get l-SECT: (-0.6834... ,0.21 585). Press (nxt) to recover the menu. • To leave the FCN environment, press iilliii (or InxtJ'MMm). • Press B3IHI to return to the PLOT WINDOW environment. Then, press [nxtJ iiiiii=!=i~i:iiiiiil to return to normal calculator display. Note: the stack will show all the graph operations performed, properly identified. • Enter the PLOT environment by pressing, simultaneously if in RPN mode, (Jnjj^. Notice that the highlighted field in the PLOT environment now contains the derivative of Yl (X). Press [nxtJ IIIIIElI:!!!!!!! to return to return to normal calculator display. • Press Lr^J EI9I to check the contents of EQ. You will notice that it contains a list instead of a single expression. The list has as elements an expression for the derivative of Y1(X) and Y1(X) itself. Originally, EQ contained only Yl(x). After we pressed 1111 III! in the environment, the calculator automatically added the derivative of Yl (x) to the list of equations in EQ. Saving a graph for future use If you want to save your graph to a variable, get into the PICTURE environment by pressing CD . Then, press HHilW|(W)HHi-^. This captures the current picture into a graphics object. To return to the stack, »-::l:::»::;: :s ::"»:»■:=«:::■:■: DreSS il.ili:.:!:::!!.!! II=:ff.a,I.Lh::!.::I . In level 1 of the stack you will see a graphics object described as Graphic 131 x 64. This can be stored into a variable name, say, PIC 1 . To display your figure again, recall the contents of variable PIC1 to the stack. The stack will show the line: Graphic 131 x 64. To see the graph, enter the PICTURE environment, by pressing GD • Clear the current picture, IHiiiilil [nxtJ B3JB3. Page 1 2-7 Move the cursor to the upper left corner of the display, by using the GD and keys. To display the figure currently in level 1 of the stack press jNxrj REPL . To return to normal calculator function, press IllSjlul E3B31. Note: To save printing space, we will not include more graphs produced by following the instructions in this Chapter. The user is invited to produce those graphics on his or her own. Graphics of transcendental functions In this section we use some of the graphics features of the calculator to show the typical behavior of the natural log, exponential, trigonometric and hyperbolic functions. You will not see more graphs in this chapter, instead the user should see them in the calculator. Graph of ln(X) Press, simultaneously if in RPN mode, the left-shift key C3D and the J^d (f7T) ) key to produce the PLOT SETUP window. The field labeled Type will be highlighted. If the option Function is not already selected press the soft key labeled Ijliillllilll, use the up and down keys to select Function, and press IIEI3IIIII to complete the selection. Check that the field labeled Indep: contains the variable 'X'. If that is not so, press the down arrow key twice until the indep field is highlighted, press the soft key labeled III3II! and modify the value of the independent variable to read 'X'. Press iliilll when done. Press L^ZlJ !!!!ii!i!Ll:iii!i!i to return to normal calculator display. Next, well resize the plot window. First, press, simultaneously if in RPN mode, the left-shift key C3D and the (CjD ) key to produce the PLOT- FUNCTION window. If there is any equation highlighted in this window, press llliill as needed to clear the window completely. When the PLOT- FUNCTION window is empty you will get a prompt message that reads: No Equ., Press add. Press the soft key labeled 1333 . This will trigger the Page 1 2-8 equation writer with the expression Y1(X)=<4 . Type LN(X). Press [enter] to return to the PLOT-FUNCTION window. Press (W)KEB to return to normal calculator display. The next step is to press, simultaneously if in RPN mode, the left-shift key C5D and the J^L (GD ) key to produce the PLOT WINDOW - FUNCTION window. Most likely, the display will show the horizontal (H-View) and vertical (v-view) ranges as: H-View: -6.5 6.5, V-View:-3.1 3.2 These are the default values for the x- and y-range, respectively, of the current graphics display window. Next, change the H-View values to read: H-View: -1 10 by using ODt+D^BMCDUDBSM. Next, press the soft key labeled EEH9 to let the calculator determine the corresponding vertical range. After a couple of seconds this range will be shown in the PLOT WINDOW- FUNCTION window. At this point we are ready to produce the graph of ln(X). Press 1333:33 13333 to plot the natural logarithm function. To add labels to the graph press B39(W)[!SI3I!. Press HHHD to remove the menu labels, and get a full view of the graph. Press jNxrj to recover the current graphic menu. Press InxtJ 13333 to recover the original graphical menu. To determine the coordinates of points on the curve press 1133333 (the cursor moves on top of the curve at a point located near the center of the horizontal range). Next, press (X,Y) to see the coordinates of the current cursor location. These coordinates will be shown at the bottom of the screen. Use the right- and left-arrow keys to move the cursor along the curve. As you move the cursor along the curve the coordinates of the curve are displayed at the bottom of the screen. Check that when Y:l .00E0, X:2.72E0. This is the point (e, 7), since ln(e) = 7. Press LnxtJ to recover the graphics menu. Next, we will find the intersection of the curve with the x-axis by pressing iilllili IImII The calculator returns the value Root: l, confirming that ln(l) = 0. Press [Nxr)[NXT)mm mSm to return to the PLOT WINDOW - FUNCTION. Press [enter) to return to normal calculator display. You will notice that the root found in the graphics environment was copied to the calculator stack. Page 1 2-9 Note: When you press G^D , your variables list will show new variables called III!!! and illlilHI . Press CBHB to see the contents of this variable. You will get the program « -» X 'LN(X)' » , which you will recognize as the program that may result from defining the function 'Yl(X) = LN(X)' by using ( jnj PE . This is basically what happens when you 1339 a function in the PLOT - FUNCTION window (the window that results from pressing <-i Jh^, simultaneously if in RPN mode), i.e., the function gets defined and added to your variable list. Next, press L r> J 1151 to see the contents of this variable. A value of 1 0.275 is placed in the stack. This value is determined by our selection for the horizontal display range. We selected a range between -1 and 10 for X. To produce the graph, the calculator generates values between the range limits using a constant increment, and storing the values generated, one at a time, in the variable 111!!!!! as the graph is drawn. For the horizontal range ( -1,1 0), the increment used seems to be 0.275. When the value of X becomes larger than the maximum value in the range (in this case, when X = 10.275), the drawing of the graph stops. The last value of X for the graphic under consideration is kept in variable X. Delete X and Yl before continuing. Graph of the exponential function First, load the function exp(X), by pressing, simultaneously if in RPN mode, the left-shift key C5D and the (C^D) key to access the PLOT-FUNCTION window. Press illl!!! to remove the function LN(X), if you didn't delete Yl as suggested in the previous note. Press 1333 and type C5D^ [alpha}(x] [enter] to enter EXP(X) and return to the PLOT-FUNCTION window. Press \JkT\WBM to return to normal calculator display. Next, press, simultaneously if in RPN mode, the left-shift key LjnJ and the ML (<JD) key to produce the PLOT WINDOW - FUNCTION window. Change the H-View values to read: H-View: -8 2 by using (jTJ MaCZD MM. Next, press EED9. After the vertical range is calculated, press BjEEQ 13333 to plot the exponential function. Page 12-10 To add labels to the graph press IHJilil [nxtJ I3EH=H. Press CHIE to remove the menu labels, and get a full view of the graph. Press Inxt j (jvxr j to return to the PLOT WINDOW - FUNCTION. Press [enter} to return to normal calculator display. The PPAR variable Press G^D to recover your variables menu, if needed. In your variables menu you should have a variable labeled PPAR . Press C3BH3 to get the contents of this variable in the stack. Press the down-arrow key, , to launch the stack editor, and use the up- and down-arrow keys to view the full contents of PPAR. The screen will show the following values: U-3. 10797263231) 12* RPL> £ OS. ,-1. 107972632B1) <2. ,7-38905609893} X S. <B.,0.> FUNCTION Y PPAR stands for Plot PARameters, and its contents include two ordered pairs of real numbers, (-8.,-! .10797263281) and (2.,7.38905609893), which represent the coordinates of the lower left corner and the upper right corner of the plot, respectively. Next, PPAR lists the name of the independent variable, X, followed by a number that specifies the increment of the independent variable in the generation of the plot. The value shown here is the default value, zero (0.), which specifies increments in X corresponding to 1 pixel in the graphics display. The next element in PPAR is a list containing first the coordinates of the point of intersection of the plot axes, i.e., (0.,0.), followed by a list that specifies the tick mark annotation on the x- and y-axes, respectively {# lOd # 10d}. Next, PPAR lists the type of plot that is to be generated, i.e., FUNCTION, and, finally, the y-axis label, i.e., Y. The variable PPAR, if non-existent, is generated every time you create a plot. The contents of the function will change depending on the type of plot and on the options that you select in the PLOT window (the window generated by the simultaneous activation of the LjnJ and J^L (GD ) keys. Page 12-11 Inverse functions and their graphs Let y = f(x), if we can find a function y = g(x), such that, g(f(x)) = x, then we say that g(x) is the inverse function of f(x). Typically, the notation g(x) = f '](x) is used to denote an inverse function. Using this notation we can write: if y = f(x), then x = f ](y). Also, W ^x)) = x, and f ](f(x)) = x. As indicated earlier, the ln(x) and exp(x) functions are inverse of each other, i.e., In(exp(x)) = x, and exp(ln(x)) = x. This can be verified in the calculator by typing and evaluating the following expressions in the Equation Writer: LN(EXP(X)) and EXP(LN(X)). They should both evaluate to X. When a function f(x) and its inverse f ~](x) are plotted simultaneously in the same set of axes, their graphs are reflections of each other about the line y = x. Let's check this fact with the calculator for the functions LN(X) and EXP(X) by following this procedure: Press, simultaneously if in RPN mode, C53^ . The function Y1(X) = EXP(X) should be available in the PLOT - FUNCTION window from the previous exercise. Press IIII3SII , and type the function Y200 LhKX). Also, load the function Y3(X) = X. Press C^lIHW to return to normal calculator display. Press, simultaneously if in RPN mode, CSJ^L, and change the H-View range to read: H-View: -8 8 Press EUEQ to generate the vertical range. Press !l;!!jili§[=!! ![y!i:!!i!H to produce the graph of y = ln(x), y = exp(x), and y =x, simultaneously if in RPN mode. You will notice that only the graph of y = exp(x) is clearly visible. Something went wrong with the EED3 selection of the vertical range. What happens is that, when you press EEB3 in the PLOT FUNCTION - WINDOW screen, the calculator produces the vertical range corresponding to the first function in the list of functions to be plotted. Which, in this case, happens to be Y1(X) = EXP(X). We will have to enter the vertical range ourselves in order to display the other two functions in the same plot. Page 12-12 Press MSm to return to the PLOT FUNCTION - WINDOW screen. Modify the vertical and horizontal ranges to read: H-View: -8 8, V-View: -4 4 By selecting these ranges we ensure that the scale of the graph is kept 1 vertical to 1 horizontal. Press ESSEBEiEE! and you will get the plots of the natural logarithm, exponential, and y = x functions. It will be evident from the graph that LN(X) and EXP(X) are reflections of each other about the line y = X. Press HEH! to return to the PLOT WINDOW - FUNCTION. Press (enter) to return to normal calculator display. Summary of FUNCTION plot operation In this section we present information regarding the PLOT SETUP, PLOT- FUNCTION, and PLOT WINDOW screens accessible through the left-shift key combined with the soft-menu keys CjD through C2D • Based on the graphing examples presented above, the procedure to follow to produce a FUNCTION plot (i.e., one that plots one or more functions of the form Y = F(X)), is the following: C5Di^, simultaneously if in RPN mode: Access to the PLOT SETUP window. If needed, change type to function, and enter the name of the independent variable. Settings: • A check on _simult means that if you have two or more plots in the same graph, they will be plotted simultaneously when producing the graph. • A check on _Connect means that the curve will be a continuous curve rather than a set of individual points. • A check on Pixels means that the marks indicated by H-Tick and v- Tick will be separated by that many pixels. • The default value for both by H-Tick and v-Tick is 1 0. Soft key menu options: • Use ESS to edit functions of values in the selected field. • Use BlEEB to select the type of plot to use when the Type : field is highlighted. For the current exercises, we want this field set to FUNCTION. Page 12-13 Note: the soft menu keys DEED and mmm are not available at the same time. One or the other will be selected depending on which input field is highlighted. • Press the AXES soft menu key to select or deselect the plotting of axes in the graph. If the option 'plot axes' is selected, a square dot will appear in the key label: EEEBb . Absence of the square dot indicates that axes will not be plotted in the graph. • Use H3SEH to erase any graph currently existing in the graphics display window. • Use illilEIII to produce the graph according to the current contents of PPAR for the equations listed in the PLOT-FUNCTION window. • Press [nxtJ to access the second set of soft menu keys in this screen. • Use lllillil to reset any selected field to its default value. • Use EEEH! to cancel any changes to the PLOT SETUP window and return to normal calculator display. • Press llliillll to save changes to the options in the PLOT SETUP window and return to normal calculator display. C5D_^, simultaneously if in RPN mode: . Access to the PLOT window (in this case it will be called PLOT -FUNCTION window). Soft menu key options: • Use iilllilli! to edit the highlighted equation. • Use EISII to add new equations to the plot. Note: IIEEI3II or IIIHil will trigger the equation writer EQW that you can use to write new equations or edit old equations. • Use IIIIIII!! to remove the highlighted equation. • Use BUSES to add an equation that is already defined in your variables menu, but not listed in the PLOT - FUNCTION window. • Use iLiiu:!!!!!!::!!:!! to erase any graph currently existing in the graphics display window. • Use 13333 to produce the graph according to the current contents of PPAR for the equations listed in the PLOT-FUNCTION window. • Press [nxtJ to activate the second menu list. Page 12-14 • Use CEEQQI and CBEQQ to move the selected equation one location up or down, respectively. • Use EffiiEE! if you want to clear all the equations currently active in the PLOT - FUNCTION window. The calculator will verify whether or not you want to clear all the functions before erasing all of them. Select YES, and press 11311 to proceed with clearing all functions. Select NO, and press III31I!!!! to de-activate the option CLEAR. • Press iiiiii=i=ili:iiiiiil when done to return to normal calculator display. CSDJ^L, simultaneously if in RPN mode: Access to the PLOT WINDOW screen. Settings: • Enter lower and upper limits for horizontal view (H-View) and vertical view (V-View) ranges in the plot window. Or, • Enter lower and upper limits for horizontal view (H-View), and press II3IS13, while the cursor is in one of the V-View fields, to generate the vertical view (V-View) range automatically. Or, • Enter lower and upper limits for vertical view (V-View), and press EEBEI, while the cursor is in one of the H-View fields, to generate the horizontal view (H-View) range automatically. • The calculator will use the horizontal view (H-View) range to generate data values for the graph, unless you change the options Indep Low, (Indep) High, and (Indep) Step. These values determine, respectively, the minimum, maximum, and increment values of the independent variable to be used in the plot. If the option Default is listed in the fields Indep Low, (Indep) High, and (Indep) Step, the calculator will use the minimum and maximum values determined by H-View. • A check on _Pixels means that the values of the independent variable increments (Step:) are given in pixels rather than in plot coordinates. Soft menu key options: • Use BUS to edit any entry in the window. • Use ll!i!l]3il!l as explained in Settings, above. Page 12-15 • Use H3SEH to erase any graph currently existing in the graphics display window. • Use 13333 to produce the graph according to the current contents of PPAR for the equations listed in the PLOT-FUNCTION window. • Press jNxrj to activate the second menu list. • Use OSS to reset the field selected (i.e., where the cursor is positioned) to its default value. • Use IliiilSIiil to access calculator stack to perform calculations that may be necessary to obtain a value for one of the options in this window. When the calculator stack is made available to you, you will also have the soft menu key options 1133111 and 111311! . • Use IEiil!i![i!l!jj[!!l in case you want to cancel the current calculation and return to the PLOT WINDOW screen. Or, • Use liliiilill to accept the results of your calculation and return to the PLOT WINDOW screen. • Use llililli! to get information on the type of objects that can be used in the selected option field. • Use H3331 to cancel any changes to the PLOT WINDOW screen and return to normal calculator display. • Press liiilll to accept changes to the PLOT WINDOW screen and return to normal calculator display. [j^Jgraph f simultaneously if in RPN mode: Plots the graph based on the settings stored in variable PPAR and the current functions defined in the PLOT - FUNCTION screen. If a graph, different from the one you are plotting, already exists in the graphic display screen, the new plot will be superimposed on the existing plot. This may not be the result you desire, therefore, I recommend to use the 13333=11333]] soft menu keys available in the PLOT SETUP, PLOT-FUNCTION or PLOT WINDOW screens. Plots of trigonometric and hyperbolic functions The procedures used above to plot LN(X) and EXP(X), separately or simultaneously, can be used to plot any function of the form y = f(x). It is left as an exercise to the reader to produce the plots of trigonometric and hyperbolic functions and their inverses. The table below suggests the values to use for the vertical and horizontal ranges in each case. You can include Page 12-16 the function Y=X when plotting simultaneously a function and its inverse to verify their 'reflection' about the line Y = X. H-View range V-View range Function Minimum Maximum Minimum Maximum SIN(X) -3.15 3.15 AUTO ASIN(X) ■1.2 1.2 AUTO SIN & ASIN -3.2 3.2 -1.6 1.6 COS(X) -3.15 3.15 AUTO ACOS(X) ■1.2 1.2 AUTO COS & ACOS -3.2 3.2 ■1.6 1.6 TAN(X) -3.15 3.15 -10 10 ATAN(X) -10 10 -1.8 1.8 TAN & ATAN -2 -2 -2 -2 SINH(X) -2 2 AUTO ASINH(X) -5 5 AUTO SINH & ASINH -5 5 -5 5 COSH(X) -2 2 AUTO ACOSH(X) -1 5 AUTO COS & ACOS -5 5 -1 5 TANH(X) -5 5 AUTO ATANH(X) ■1.2 1.2 AUTO TAN & ATAN -5 5 -2.5 2.5 Generating a table of values for a function The combinations (GD ) and C3D J^i (C2D )/ pressed simultaneously if in RPN mode, let's the user produce a table of values of functions. For example, we will produce a table of the function Y(X) = X/(X+10), in the range -5 < X < 5 following these instructions: • We will generate values of the function f(x), defined above, for values of x from -5 to 5, in increments of 0.5. First, we need to ensure that the graph type is set to FUNCTION in the PLOT SETUP screen J^, , press them simultaneously, if in RPN mode). The field in front of the Type option Page 12-17 will be highlighted. If this field is not already set to FUNCTION, press the soft key llii!;!;!;!;!;!!::! and select the FUNCTION option, then press 111:1111. • Next, press to highlight the field in front of the option EQ, and type the function expression: 'X/(X+10)' • To accept the changes made to the PLOT SETUP screen press jNxrj EI9I. You will be returned to normal calculator display. • The next step is to access the Table Set-up screen by using the keystroke combinationCSDlMI (i.e., soft key (jD ) - simultaneously if in RPN mode. This will produce a screen where you can select the starting value (Start) and the increment (Step). Enter the following: L5JL!LJ ISllI CBCTGDWM CBCZJCS— (i.e., Zoom factor = 0.5). Toggle the IKIHiI!:! soft menu key until a check mark appears in front of the option Small Font if you so desire. Then press I!!!!!!!!!!!:!!!!. This will return you to normal calculator display. The TPAR variable After finishing the table set up, your calculator will create a variable called TPAR (Table PARameters) that store information relevant to the table that is to be generated. To see the contents of this variable, press C^iiililiEi. • To see the table, press LjnJi^i (i.e./ soft menu key CJL) ) ~ simultaneously if in RPN mode. This will produce a table of values of x = -5, -4.5, and the corresponding values of f(x), listed as Yl by default. You can use the up and down arrow keys to move about in the table. You will notice that we did not have to indicate an ending value for the independent variable x. Thus, the table continues beyond the maximum value for x suggested early, namely x = 5. Some options available while the table is visible are ES3S33, SIIII:!!!, and • The lililili], when selected, shows the definition of the independent variable. • The IlllISi key simply changes the font in the table from small to big, and vice versa. Try it. Page 12-18 • The key, when pressed, produces a menu with the options: In, Out, Decimal, Integer, and Trig. Try the following exercises: • With the option In highlighted, press I1I3I. The table is expanded so that the x-increment is now 0.25 rather than 0.5. Simply, what the calculator does is to multiply the original increment, 0.5, by the zoom factor, 0.5, to produce the new increment of 0.25. Thus, the zoom in option is useful when you want more resolution for the values of x in your table. • To increase the resolution by an additional factor of 0.5 press EIMlI, select In once more, and press HA The x-increment is now 0.01 25. • To recover the previous x-increment, press HIIIIII to select the option Un-zoom. The x-increment is increased to 0.25. • To recover the original x-increment of 0.5 you can do an un-zoom again, or use the option zoom out by pressing BM2 IEI3IIII. • The option Decimal in produces x-increments of 0.10. • The option Integer in BM2 produces x-increments of 1 . • The option Trig in produces increments related to fractions of n, thus being useful when plotting trigonometric functions. • To return to normal calculator display press (enter} . Plots in polar coordinates First of all, you may want to delete the variables used in previous examples (e.g., X, EQ, Yl, PPAR) using function PURGE ((roa) HHS). By doing this, all parameters related to graphics will be cleared. Press Cjjj j to check that the variables were indeed purged. We will try to plot the function f(0) = 2(l-sin(6)), as follows: • First, make sure that your calculator's angle measure is set to radians. • Press LjnJi^ , simultaneously if in RPN mode, to access to the PLOT SETUP window. • Change type to Polar, by pressing llliilllliliii ^3? mill. • Press ^3? and type: Page 12-19 • The cursor is now in the indep field. Press CZD(^^CS(3 IIEIIll to change the independent variable to 6. • Press [nxtJ liai III! to return to normal calculator display. • Press LjnJ ML , simultaneously if in RPN mode, to access the PLOT window (in this case it will be called PLOT -POLAR window). • Change the H-VIEW range to -8 to 8, by using CSJ^+tJMSMIZSJMM, and the V-VIEW range to -6 to 2 by using r~6~) llEillO-] 113111. Note: the H-VIEW and V-VIEW determine the scales of the display window only, and their ranges are not related to the range of values of the independent variable in this case. • Change the indep Low value to 0, and the High value to 6.28 2n), by using: QD MM (~6j CZD CD 11. • Press HSliEi EEECI to plot the function in polar coordinates. The result is a curve shaped like a hearth. This curve is known as a cardiod (cardios, Greek for heart). ftUilEffFlHIIfliM P"" T 1 HI 1 hi H • Press E5n(W) EHHDM] to see the graph with labels. Press ® to recover the menu. Press [nxt) Slljjy to recover the original graphics menu. • Press D33£i iliull to trace the curve. The data shown at the bottom of the display is the angle 0 and the radius r, although the latter is labeled Y (default name of dependent variable). • Press IWlECnH! to return to the PLOT WINDOW screen. Press (W)BEH to return to normal calculator display. In this exercise we entered the equation to be plotted directly in the PLOT SETUP window. We can also enter equations for plotting using the PLOT window, i.e., simultaneously if in RPN mode, pressing C5D_^ . For example, when you press LjnJ^^ after finishing the previous exercise, you Page 1 2-20 will get the equation /2*(1-SIN(0))' highlighted. Let's say, we want to plot also the function '2*(1 -COS(6))' along with the previous equation. • Press ESSM , and type CDQDE]^ CDCEJ C^^CSS^, to enter the new equation. • Press H333=! EEjjE] to see the two equations plotted in the same figure. The result is two intersecting cordioids. Press EEEH1 I on] to return to normal calculator display. Plotting conic curves The most general form of a conic curve in the x-y plane is: Ax2+By2+Cxy+Dx+Ey+F = 0. We also recognize as conic equations those given in the canonical form for the following figures: where xQ/ yQ, a, b, and /Care constant. The name conic curves follows because these figures (circles, ellipses, parabolas or hyperbolas) result from the intersection of a plane with a cone. For example, a circle is the intersection of a cone with a plane perpendicular to the cone's main axis. The calculator has the ability of plotting one or more conic curves by selecting Conic as the function TYPE in the PLOT environment. Make sure to delete the variables PPAR and EQ before continuing. For example, let's store the list of equations • circle: • ellipse: • parabola: • hyperbola: (x-x0)2+(y-y0)2 = r2 (x-x0)2/a2 + (y-y0)2/b2= 1 (y-b)2 = K(x-a) or (x-a)2 = K(y-b) (x-x0)2/a2 + (y-y0)2/b2= 1 or xy = K, Page 12-21 { '(X-1)A2+(Y-2)A2=3' , 'XA2/4+YA2/3=T } into the variable EQ. These equations we recognize as those of a circle centered at (1,2) with radius V3, and of an ellipse centered at (0,0) with semi-axis lengths a = 2 and b = V3. • Enter the PLOT environment, by pressing CfDJ^,, simultaneously if in RPN mode, and select Conic as the TYPE. The list of equations will be listed in the EQ field. • Make sure that the independent variable (indep) is set to 'X' and the dependent variable (Depnd) to 'Y'. • Press jNxr j lliljljliil to return to normal calculator display. • Enter the PLOT WINDOW environment, by pressing EDJ^L, simultaneously if in RPN mode. • Change the range for H-VIEW to -3 to 3, by using C^C^l:!:^ Also, change the V-VIEW range to -1 .5 to 2 by using en czd czd czd nacxi ■• • Change the Indep Low: and High: fields to Default by using jNxrj llliilllj while each of those fields is highlighted. Select the option Reset value after pressing lllillll Press (ECU to complete the resetting of values. Press jNxrj to return to the main menu. • riot the graph: . r 1 1 iii n ii^h Note: The H-view and v-view ranges were selected to show the intersection of the two curves. There is no general rule to select those ranges, except based on what we know about the curves. For example, for the equations shown above, we know that the circle will extend from -3+1 = -2 to 3+1 =4 in x, and from -3+2=-l to 3+2=5 in y. In addition, the ellipse, which is Page 1 2-22 centered at the origin (0,0), will extend from -2 to 2 in x, and from -V3 to V3 in y. Notice that for the circle and the ellipse the region corresponding to the left and right extremes of the curves are not plotted. This is the case with all circles or ellipses plotted using Conic as the type. • To see labels: illlilllil IE To recover the menu: C^C^IfflSi! To estimate the coordinates of the point of intersection, press the 11(313)1 menu key and move the cursor as close as possible to those points using the arrow keys. The coordinates of the cursor are shown in the display. For example, the left point of intersection is close to (-0.692, 1 .67), while the right intersection is near (1 .89,0.5). \ \ K:-6.53E-i 1 J v=i.e?ED V 1 ■: : 1 . SHEA 1 J V: .5 • To recover the menu and return to the PLOT environment, press (JW7JEEEH!!. • To return to normal calculator display, press (jv^IIIEEIII. Parametric plots Parametric plots in the plane are those plots whose coordinates are generated through the system of equations x = x(t) and y = y(t), where t is known as the parameter. An example of such graph is the trajectory of a projectile, x(t) = x0 + Vq-COS 90-t, y(t) = y0 + v0-sin 90-t - Vi-g-t2. To plot equations like these, which involve constant values x0, y0, v0, and 0O, we need to store the values of those parameters in variables. To develop this example, create a sub- directory called 'PROJM' for PROJectile Motion, and within that sub-directory store the following variables: X0 = 0, Y0 = 1 0, V0 = 1 0 , 90 = 30, and g = 9.806. Make sure that the calculator's angle measure is set to DEG. Next, define the functions (use l<n J?EF ): Page 1 2-23 X(t) = XO + VO*COS(GO)*t Y(t) = YO + VO*SIN(eO)*t - 0.5*g*tA2 which will add the variables and II : 10^0 : 10^0 :30M0 :9.S06^ : DEFIHEf ^X(t)=X0+V0-COS£E> HOVflL to the soft menu key labels. ■ lUFVU 30^0 :9.S0^Q DEF I NEFXCt )=X0+V0-COSteH DEF I HE[ YCt )= Y0+ V0-S I NEE* HOVflL To produce the graph itself, follow these steps: • Press CSDi^,, simultaneously if in RPN mode, to access to the PLOT SETUP window. • Change type to Parametric, by pressing mmuB ^P^PmMm. • Press ^3? and type 'X(t) + i*Y(t)/ llliiiilllll to define the parametric plot as that of a complex variable. (The real and imaginary parts of the complex variable correspond to the x- and y-coordinates of the curve.) • The cursor is now in the indep field. Press CZZ3^™)QJ(3 HEM to change the independent variable to t. • Press (jv^lIIEEii! to return to normal calculator display. • Press LtlJ ML , simultaneously if in RPN mode, to access the PLOT window (in this case it will be called PLOT -PARAMETRIC window). Instead of modifying the horizontal and vertical views first, as done for other types of plot, we will set the lower and upper values of the independent variable first as follows: • Select the indep Low field by pressing ^3? ^3?. Change this value to f^OjMSM. Then, change the value of High to CTDKEl. Enter QDCZD CZZZ) ii!lii!!=Ll:iilil!! for the step value (i.e., step = 0.1). Note: Through these settings we are indicating that the parameter t will take values of t = 0, 0.1, 0.2, etc., until reaching the value of 2.0. Press IISIIIl!!. This will generate automatic values of the H-View and V-View ranges based on the values of the independent variable t and the definitions of X(t) and Y(t) used. The result will be: Page 1 2-24 ^^PLOT HinDOH - PftRftHETRIC^^ H-'.'i>ZH:[j^^^| Indcp Loh= 0. Hiqh:2. St«p: .1 _ Pixels inter HiniHUH hori 2 ■:■ ri + i. ualufl • Press iLiiLlllii!!!::!!:!! iLliLlll!!!!!;!! to draw the parametric plot. • Press IIIlMii (W) EBjlD to see the graph with labels. The window parameters are such that you only see half of the labels in the x-axis. + \ — i — i — i — i — i — i — i — hi n 17 -^nqflflfl?1?? • Press [nxtJ to recover the menu. Press (jwrj 13333 to recover the original graphics menu. • Press IEEB3 ll(:!:P!lll!ll)ll to determine coordinates of any point on the graph. Use (T) and GD to move the cursor about the curve. At the bottom of the screen you will see the value of the parameter t and coordinates of the cursor as (X,Y). • Press (WjEHIH! to return to the PLOT WINDOW environment. Then, press C^D , or (JW7JB3BB, to return to normal calculator display. A review of your soft menu key labels shows that you now have the following variables: t, EQ, PPAR, Y, X, g, 00, V0, Y0, X0. Variables t, EQ, and PPAR are generated by the calculator to store the current values of the parameter, t, of the equation to be plotted EQ (which contains 'X(t) + l*Y(t)'), and the plot parameters. The other variables contain the values of constants used in the definitions of X(t) and Y(t). You can store different values in the variables and produce new parametric plots of the projectile equations used in this example. If you want to erase the current picture contents before producing a new plot, you need to access either the PLOT, PLOT WINDOW, or PLOT SETUP screens, by pressing, Ij^JJ^ , IJnJ ML , or C5D J^L (the two keys must be pressed simultaneously Page 1 2-25 if in RPN mode). Then, press GXSDXE]. Press BXH1 to return to the PLOT, PLOT WINDOW, or PLOT SETUP screen. Press C™], or (n^MM, to return to normal calculator display. Generating a table for parametric equations In an earlier example we generated a table of values (X,Y) for an expression of the form Y=f(X), i.e., a Function type of graph. In this section, we present the procedure for generating a table corresponding to a parametric plot. For this purpose, well take advantage of the parametric equations defined in the example above. • First, let's access the TABLE SETUP window by pressing , simultaneously if in RPN mode. For the independent variable change the Starting value to 0.0, and the Step value to 0.1 . Press Kill. • Generate the table by pressing, simultaneously if in RPN mode, w . The resulting table has three columns representing the parameter t, and the coordinates of the corresponding points. For this table the coordinates are labeled XI and Yl . .X1 Yl — 10 . BbbOESH 10 H50R7 .a 1.73E051 10 B03BB .3 E . 51B07G 11 05B73 . H 3.H6H10E 11 E1SSE . S H.3301EF 11 EFHE5 0- • Use the arrow keys, (3D CD , to move about the table. • Press I on j to return to normal calculator display. This procedure for creating a table corresponding to the current type of plot can be applied to other plot types. Plotting the solution to simple differential equations The plot of a simple differential equation can be obtained by selecting Diff Eq in the TYPE field of the PLOT SETUP environment as follows: suppose that we want to plot x(t) from the differential equation dx/dt = exp(-t2), with initial conditions: x = 0 at t = 0. The calculator allows for the plotting of the solution Page 1 2-26 of differential equations of the form Y'(T) = F(T,Y). For our case, we let Y->x and T-H therefore, F(T,Y)-»f(t,x) = exp(-t2). Before plotting the solution, x(t), for t = 0 to 5, delete the variables EQ and PPAR. • Press GDi^,, simultaneously if in RPN mode, to access to the PLOT SETUP window. • Change type to Dif f Eq. • Press ^3? and type CD ED ^^{alpha} CSDSCZDCZDKi™. • The cursor is now in the H-var field. It should show H-var : 0 and also v- vanl. This is the code used by the calculator to identify the variables to be plotted. H-var:0 means the independent variable (to be selected later) will be plotted in the horizontal axis. Also, v-var:i means the dependent variable (default name 'Y') will be plotted in the vertical axis. • Press ^3? . The cursor is now in the indep field. Press L r> JL 1 J{alpha) LjnJ 0 113111 to change the independent variable to t. • Press [nxtJ llllllij!!!!:!!!!!!! to return to normal calculator display. • Press LjnJ ML , simultaneously if in RPN mode, to access the PLOT window (in this case it will be called PLOT WINDOW - DIFF EQ). • Change the H-VIEW and V-VIEW parameters to read: H-VIEW: -1 5, V-VIEW:-1 1.5 • Change the init value to 0, and the Final value to 5 by using: L0J HHi L 5 J iiiiii=:=i-=:iiiiiii . • The values Step and Tol represent the step in the independent variable and the tolerance for convergence to be used by the numerical solution. Let's leave those values with their default settings (if the word default is not shown in the Step: field, use [nxtJ liliilljl to reset that value to its default value. Press jNxrj to return to the main menu.) Press . • The Init-Soln value represents the initial value of the solution to start the numerical result. For the present case, we have for initial conditions x(0) = 0, thus, we need to change this value to 0.0, by using LfijBBBIH. • Press lEIGIilH HEElD to plot the solution to the differential equation. • Press llliililii ® IE ilil !!! DUD to see the graph with labels. Page 1 2-27 • Press [nxtJ to recover the menu. Press [nxtJ mSm to recover the original graphics menu. • When we observed the graph being plotted, you'll notice that the graph is not very smooth. That is because the plotter is using a time step that is too large. To refine the graph and make it smoother, use a step of 0.1 . Try the following keystrokes: BXH1 ^^^CZDQ^!^ The plot will take longer to be completed, but the shape is definitely smoother than before. • Press G3BB (W) EE! EHUD, to see axes labels and range. Notice that the labels for the axes are shown as 0 (horizontal) and 1 (vertical). These are the definitions for the axes as given in the PLOT WINDOW screen (see above), i.e., H-VAR (t): 0, and V-VAR(x): 1 . • Press [NxT)[NxfJmmi to recover menu and return to PICT environment. • Press (:!:li!il) to determine coordinates of any point on the graph. Use (T) and GD to move the cursor in the plot area. At the bottom of the screen you will see the coordinates of the cursor as (X,Y). The calculator uses X and Y as the default names for the horizontal and vertical axes, respectively. • Press IWHSnH! to return to the PLOT WINDOW environment. Then, press ISEJ to return to normal calculator display. More details on using graphical solutions of differential equations are presented in Chapter 16. ,i -i. 5. -i. Page 1 2-28 Truth plots Truth plots are used to produce two-dimensional plots of regions that satisfy a certain mathematical condition that can be either true or false. For example, suppose that you want to plot the region for XA2/36 + YA2/9 < 1 , proceed as follows: • Press CSDi^,, simultaneously if in RPN mode, to access to the PLOT SETUP window. • Change TYPE to Truth. • Press ^3? and type {'(XA2/36+YA2/9 < 1 )','(XA2/1 6+YA2/9 > 1)'} iiiiiiiliLl:!!!!!!! to define the conditions to be plotted. • The cursor is now in the indep field. Leave that as 'X' if already set to that variable, or change it to 'X' if needed. • Press Q^IIIEEIII to return to normal calculator display. • Press (jij ML , simultaneously if in RPN mode, to access the PLOT window (in this case it will be called PLOT WINDOW - TRUTH window). Let's keep the default value for the window's ranges: H-view: -6.5 6.5, v-view : -3 . l 3 . 2 (To reset them use [nxt) iiliiiiui (select Reset all) IIIll (nxt)). Note: if the window's ranges are not set to default values, the quickest way to reset them is by using ®0BD (select Reset oil) Ul® . • Press EEEH3E333 to draw the truth plot. Because the calculator samples the entire plotting domain, point by point, it takes a few minutes to produce a truth plot. The present plot should produce a shaded ellipse of semi-axes 6 and 3 (in x and y, respectively), centered at the origin. • Press BHEiilWl lEiiliniini to see the graph with labels. The window parameters are such that you only see half of the labels in the x-axis. Press [nxtJ to recover the menu. Press (jwrj 15333 to recover the original graphics menu. • Press (:!l!i!i!) to determine coordinates of any point on the graph. Use the arrow keys to move the cursor about the region plotted. At the bottom of the screen you will see the value of the coordinates of the cursor as (X,Y). • Press IWHSnH! to return to the PLOT WINDOW environment. Then, press I on] , or jNxr j MM, to return to normal calculator display. Page 1 2-29 You can have more than one condition plotted at the same time if you multiply the conditions. For example, to plot the graph of the points for which X2/36 + Y2/9 < 1 , and X2/ 1 6 + Y2/9 > 1 , use the following: • Press CSDi^,, simultaneously if in RPN mode, to access to the PLOT SETUP window. • Press ^ and type /(XA2/36+YA2/9 < !)• (XA2/1 6+YA2/9 > 1 )H to define the conditions to be plotted. • Press B3333EEEI;] to draw the truth plot. Again, you have to be patient while the calculator produces the graph. If you want to interrupt the plot, press tjwj , once. Then press i[;!!Sii[;i!!j . Plotting histograms, bar plots, and scatter plots Histograms, bar plots and scatter plots are used to plot discrete data stored in the reserved variable ZDAT. This variable is used not only for these types of plots, but also for all kind of statistical applications as will be shown in Chapter 18. As a matter of fact, the use of histogram plots is postponed until we get to that chapter, for the plotting of a histogram requires to perform a grouping of data and a frequency analysis before the actual plot. In this section we will show how to load data in the variable ZDAT and how to plot bar plots and scatter plots. We will use the following data for plotting bar plots and scatter plots: x y z "3J 2.1 1.1 3.6 3.2 2.2 4.2 4.5 3.3 4.5 5.6 4.4 4.9 3.8 5.5 5.2 2.2 6.6 Bar plots First, make sure your calculator's CAS is in Exact mode. Next, enter the data shown above as a matrix, i.e., Page 1 2-30 [[3.1,2.1,1 .1],[3.6,3.2,2.2],[4.2,4.5,3.3], [4.5,5.6,4.4],[4.9,3.8,5.5],[5. 2,2.2,6.6]^ [enter} to store it in ZDAT, use the function STOZ (available in the function catalog, Lr>J cat ). Press VAR to recover your variables menu. A soft menu key labeled ZDAT should be available in the stack. The figure below shows the storage of this matrix in ALG mode: 4.2 4.5 3.3 4.5 5.6 4.4 4.9 3.3 5.5 .5.2 2.2 6.6. :ST02(FlNSm) HOVflL To produce the graph: • Press GDi^,, simultaneously if in RPN mode, to access to the PLOT SETUP window. • Change type to Bar. • A matrix will be shown at the SDAT field. This is the matrix we stored earlier into SDAT. • Highlight the Col: field. This field lets you choose the column of SDAT that is to be plotted. The default value is 1 . Keep it to plot column 1 in ZDAT. • Press (j^lIIEEIII to return to normal calculator display. • Press LjnJ ML , simultaneously if in RPN mode, to access the PLOT WINDOW screen. • Change the V-View to read, v-view: 0 5. • Press EEMi OlS to draw the bar plot. Page 12-31 • Press H3IH1 to return to the PLOT WINDOW environment. Then, press I on] , or jNxr j MB, to return to normal calculator display. The number of bars to be plotted determines the width of the bar. The H- and V-VIEW are set to 1 0, by default. We changed the V-VIEW to better accommodate the maximum value in column 1 of ZDAT. Bar plots are useful when plotting categorical (i.e., non-numerical) data. Suppose that you want to plot the data in column 2 of the SDAT matrix: • Press GDi^,, simultaneously if in RPN mode, to access to the PLOT SETUP window. • Press to highlight the Col: field and type 2 MB, followed by • Press CSDJ^L, simultaneously if in RPN mode, to access to the PLOT SETUP window. • Change V-View to read v-view: 0 6 • Press EEMi IMD. • Press BiEHl to return to the PLOT WINDOW screen, then Q^J to return to normal calculator display. Scatter plots We will use the same ZDAT matrix to produce scatter plots. First, we will plot the values of y vs. x, then those of y vs. z, as follows: • Press CSDi^,, simultaneously if in RPN mode, to access to the PLOT SETUP window. • Change TYPE to Scatter. Page 12-32 • Press ^?^? to highlight the Cols: field. Enter UJMM fZZjMM to select column 1 as X and column 2 as Y in the Y-vs.-X scatter plot. • Press (jw^IIIEEII! to return to normal calculator display. • Press (jnj ML , simultaneously if in RPN mode, to access the PLOT WINDOW screen. • Change the plot window ranges to read: H-View: 0 6, V-View: 0 6. • Press EmM Em to draw the bar plot. Press BSS ® JESS EMM to see the plot unencumbered by the menu and with identifying labels (the cursor will be in the middle of the plot, however): v !■! • Press (^QL^IIIliiji to leave the EDIT environment. • Press B3331 to return to the PLOT WINDOW environment. Then, press ioNj f or (jwrJIEM, to return to normal calculator display. To plot y vs. z, use: • Press GDi^,, simultaneously if in RPN mode, to access to the PLOT SETUP window. • Press to highlight the Cols: field. Enter CD! ^JJIW'JM to select column 3 as X and column 2 as Y in the Y-vs.-X scatter plot. • Press (jv^lIEEIIII to return to normal calculator display. • Press LjnJ ML , simultaneously if in RPN mode, to access the PLOT WINDOW screen. • Change the plot window ranges to read: H-View: 0 7, V-View: 0 7. • Press Em to draw the bar plot. Press HBO ® 0333! EMM to see the plot unencumbered by the menu and with identifying labels. -v !■! Page 12-33 • Press (jwf7j(W)|JHi to leave the EDIT environment. • Press B3331 to return to the PLOT WINDOW environment. Then, press ISEJ / or IjjXTjWESM, to return to normal calculator display. Slope fields Slope fields are used to visualize the solutions to a differential equation of the form y' = f(x,y). Basically, what is presented in the plot are segments tangential to the solution curves, since y' = dy/dx, evaluated at any point (x,y), represents the slope of the tangent line at point (x,y). For example, to visualize the solution to the differential equation y' = f(x,y) = x+y, use the following: • Press GDi^,, simultaneously if in RPN mode, to access to the PLOT SETUP window. • Change type to siopefieid. • Press ^r? and type 'X+Y' 11. • Make sure that 'X' is selected as the indep: and 'Y' as the Depnd: variables. • Press InxtJ ECEIII to return to normal calculator display. • Press CSDJI^L, simultaneously if in RPN mode, to access the PLOT WINDOW screen. • Change the plot window ranges to read: X-Left:-5, X-Right:5, Y-Near:-5, Y-Far: 5 • Press OQEBaOOm to draw the slope field plot. Press HHi |W| !IIIIi!ffl to see the plot unencumbered by the menu and with identifying labels. V / 1 II •///ii \ \ \ \ V \ \ \ A \ ----- • Press [Nxf^^NxfJmmi to leave the EDIT environment. Page 1 2-34 • Press B3331 to return to the PLOT WINDOW environment. Then, press ioNj f or C^iElli, to return to normal calculator display. If you could reproduce the slope field plot in paper, you can trace by hand lines that are tangent to the line segments shown in the plot. This lines constitute lines of y(x,y) = constant, for the solution of y' = f(x,y). Thus, slope fields are useful tools for visualizing particularly difficult equations to solve. Try also a slope field plot for the function y' = f(x,y) = - (y/x)2, by using: • Press C3Di^, simultaneously if in RPN mode, to access to the PLOT SETUP window. • Change type to siopefieid. • Press ^? and type '- (Y/X)A2' HI. • Press 0333 to draw the slope field plot. Press BSD ® lull!!!!!! to see the plot unencumbered by the menu and with identifying labels. - - \ \ i: Yi \ \ - - - \ 'l -5., ■ 'l \ - -— - . 'l 'l \ • Press (^QL^Iilllijl to leave the EDIT environment. • Press B333I to return to the PLOT WINDOW environment. Then, press {jmJ f or (j^rjIEM, to return to normal calculator display. Fast 3D plots Fast 3D plots are used to visualize three-dimensional surfaces represented by equations of the form z = f(x,y). For example, if you want to visualize z = f(x,y) = x2+y2, we can use the following: • Press CSDi^,, simultaneously if in RPN mode, to access to the PLOT SETUP window. • Change TYPE to Fast3D. • Press ^3? and type /XA2+YA2/ III!™ Page 1 2-35 • Make sure that 'X' is selected as the Indep: and 'Y' as the Depnd: variables. • Press InxtJ I!!!!!!:!!!!:!!!!!!! to return to normal calculator display. • Press EDJ^L/ simultaneously if in RPN mode, to access the PLOT WINDOW screen. • Keep the default plot window ranges to read: X-Left:-1, X-Right: 1 , Y-Near:-1, Y-Far: 1, Z-Low: -1, Z-High: 1, Step Indep: 10, Depnd: 8 Note: The Step Indep: and Depnd: values represent the number of gridlines to be used in the plot. The larger these number, the slower it is to produce the graph, although, the times utilized for graphic generation are relatively fast. For the time being well keep the default values of 1 0 and 8 for the Step data. Press IHSlsji EEECI to draw the three-dimensional surface. The result is a wireframe picture of the surface with the reference coordinate system shown at the lower left corner of the screen. By using the arrow keys (GO CD <\7? ) you can change the orientation of the surface. The orientation of the reference coordinate system will change accordingly. Try changing the surface orientation on your own. The following figures ram When done, press 153111 Press H3IH! to return to the PLOT WINDOW environment. Change the Step data to read: step indep: 20 Depnd: 16 Press IHSEEsB E3»D to see the surface plot. Sample views: Page 1 2-36 • When done, press ISillllil. • Press BEH1 to return to PLOT WINDOW. • Press I^onJ , or (jv^JBBBB, to return to normal calculator display. Try also a Fast 3D plot for the surface z = f(x,y) = sin (x2+y2) • Press C3D J^, , simultaneously if in RPN mode, to access the PLOT SETUP window. • Press ^? and type 'SIN(XA2+YA2)' MM. • Press EEMi IEI1S to draw the plot. • When done, press iilliliil • Press mm to return to PLOT WINDOW. • Press I^onJ , or (jv^jKEBI, to return to normal calculator display. Wireframe plots Wireframe plots are plots of three-dimensional surfaces described by z = f(x,y). Unlike Fast 3D plots, wireframe plots are static plots. The user can choose the viewpoint for the plot, i.e., the point from which the surface is seen. For example, to produce a wireframe plot for the surface z = x + 2y -3, use the following: • Press LjnJi^D f simultaneously if in RPN mode, to access to the PLOT SETUP window. • Change TYPE to Wireframe. • Press ^? and type 'X+2*Y-3' EB. • Make sure that 'X' is selected as the indep: and 'Y' as the Depnd: variables. • Press [nxtJ to return to normal calculator display. • Press LjnJ ML , simultaneously if in RPN mode, to access the PLOT WINDOW screen. • Keep the default plot window ranges to read: X-Left:-1, X-Right: 1 , Y-Near:-1, Y-Far: 1, Z-Low: -1, Z-High: 1 , XE:0,YE:-3, ZE:0, Step Indep: 10 Depnd: 8 Page 1 2-37 The coordinates XE, YE, ZE, stand for "eye coordinates/' i.e., the coordinates from which an observer sees the plot. The values shown are the default values. The Step Indep: and Depnd: values represent the number of gridlines to be used in the plot. The larger these number, the slower it is to produce the qraph. For the time beinq well keep the default values of 1 0 and 8 for the Step data. • Press iLiLi!!!!!!!;:!!;!! IIIi:!!i!E;3 to draw the three-dimensional surface. The result is a wireframe picture of the surface. • Press Em (W) HUB EMI to see the graph with labels and ranges. This particular version of the graph is limited to the lower part of the display. We can change the viewpoint to see a different version of the graph. .5 v • Press (W)(W)IIfil E3IH1 to return to the PLOT WINDOW environment. • Change the eye coordinate data to read : xe : 0 ye : -3 ze : 3 • Press [SEES I333II to see the surface plot. • Press 113111! to see the graph with labels and ranges. a. s v This version of the graph occupies more area in the display than the previous one. We can change the viewpoint, once more, to see another version of the graph. • Press [NxrJ[NXTjtSm MEM to return to the PLOT WINDOW environment. • Change the eye coordinate data to read : xe : 3 ye : 3 ze : 3 Page 12-38 • Press H3E=! EEEE] to see the surface plot. This time the bulk of the plot is located towards the right -hand side of the display. • Press BEH1 to return to the PLOT WINDOW environment. • Press L^J / or (j^IIIEBIII, to return to normal calculator display. Try also a Wireframe plot for the surface z = f(x,y) = x2+y2 • Press C3Di^, simultaneously if in RPN mode, to access the PLOT SETUP window. • Press ^? and type 'X^+rZH. • Press EEm EEM to draw the slope field plot. Press B3S IWUBflD D311I to see the plot unencumbered by the menu and with identifying labels. • Press [NxT)[Nxr)iMSM to leave the EDIT environment. • Press BEEQ to return to the PLOT WINDOW environment. Then, press QwJ r or (j^JIEEB, to return to normal calculator display. Ps-Contour plots Ps-Contour plots are contour plots of three-dimensional surfaces described by z = f(x,y). The contours produced are projections of level surfaces z = constant on the x-y plane. For example, to produce a Ps-Contour plot for the surface z = x2+y2, use the following: Page 1 2-39 • Press CSDi^, simultaneously if in RPN mode, to access to the PLOT SETUP window. • Change TYPE to Ps-Contour. • Press ^3? and type 'XA2+YA2' HI. • Make sure that 'X' is selected as the indep: and 'Y' as the Depnd: variables. • Press WBM to return to normal calculator display. • Press LjnJ ML , simultaneously if in RPN mode, to access the PLOT WINDOW screen. • Keep the default plot window ranges to read: X-Left:-2, X-Right:2, Y-Near:-1 Y-Far: 1, Step Indep: 10, Depnd: 8 • Press !L:!Li:!!i!!!::L:j! iLiiLi:!!!!!!;!! to draw the contour plot. This operation will take some time, so, be patient. The result is a contour plot of the surface. Notice that the contour are not necessarily continuous, however, they do provide a good picture of the level surfaces of the function. • Press H3HKW) lllllijilll lulilll to see the graph with labels and ranges. m \ \ \ \ \ \ \ / / / • Press (W)(W)IIfiH!nH! to return to the PLOT WINDOW environment. • Press L^J / or 111311, to return to normal calculator display. Try also a Ps-Contour plot for the surface z = f(x,y) = sin x cos y. • Press CSDi^, simultaneously if in RPN mode, to access the PLOT SETUP window. • Press ^7 and type ySIN(X)*COS(Y)' MM. Press IlEililllLMEllEji irjimiiTM to draw the slope field plot. Press E3ffl(W)l!SHI! HBBH to see the plot unencumbered by the menu and with identifying labels. — -— i. V1 ■ / — - -— — y / ■ \ \ . \ \ "^-.— — - Page 1 2-40 • Press [NxfJ[NxT)mMI to leave the EDIT environment. • Press to return to the PLOT WINDOW environment. Then, press ioNj , or (jv^jIBM, to return to normal calculator display. Y-Slice plots Y-Slice plots are animated plots of z-vs.-y for different values of x from the function z = f(x,y). For example, to produce a Y-Slice plot for the surface z = x3-xy3, use the following: • Press LjnJi^D f simultaneously if in RPN mode, to access to the PLOT SETUP window. • Change TYPE to Y-Slice. • Press ^? and type /XA3+X*YA3MIII™ • Make sure that 'X' is selected as the Indep: and 'Y' as the Depnd: variables. • Press [nxtJ I!!!!!!:!!!!:!!!!!!! to return to normal calculator display. • Press LjnJ ML , simultaneously if in RPN mode, to access the PLOT WINDOW screen. • Keep the default plot window ranges to read: X-Left:-1, X-Right: 1 , Y-Near:-1, Y-Far: 1, Z-Low:-l, Z-High:l, Step Indep: 10 Depnd: 8 • Press B3j]3jjl ItEiH to draw the three-dimensional surface. You will see the calculator produce a series of curves on the screen, that will immediately disappear. When the calculator finishes producing all the y-slice curves, then it will automatically go into animating the different curves. One of the curves is shown below. • Press LonJ to stop the animation. Press B3331 to return to the PLOT WINDOW environment. • Press IsaJ , or (jv^jKEBI, to return to normal calculator display. Try also a Ps-Contour plot for the surface z = f(x,y) = (x+y) sin y. Page 12-41 • Press C3D , simultaneously if in RPN mode, to access the PLOT SETUP window. • Press ^7 and type '(X+Y)*SIN(Y)' KB. • Press r32EE3=! ESSE! to produce the Y-Slice animation. • Press I on] to stop the animation. • Press BiEHi to return to the PLOT WINDOW environment. Then, press Loa/J , or C^DiEM, to return to normal calculator display. Gridmap plots Gridmap plots produce a grid of orthogonal curves describing a function of a complex variable of the form w =f(z) = f(x+iy), where z = x+iy is a complex variable. The functions plotted correspond to the real and imaginary part of w = 0(x,y) + i^x^), i.e., they represent curves ®(x,y) ^constant, and ^(x^) = constant. For example, to produce a Gridmap plot for the function w = sin(z), use the following: • Press (JnJ joflo , simultaneously if in RPN mode, to access to the PLOT SETUP window. • Change TYPE to Gridmap. • Press ^? and type 'SIN(X+i*Y)' WSM. • Make sure that 'X' is selected as the Indep: and 'Y' as the Depnd: variables. • Press InxtJ lEIl! to return to normal calculator display. • Press LjnJ ML , simultaneously if in RPN mode, to access the PLOT WINDOW screen. • Keep the default plot window ranges to read: X-Left:-1, X-Right: 1 , Y-Near:-1 Y-Far: 1, XXLeft:-! XXRight:l, YYNean-1, yyFar: 1, Step Indep: 10 Depnd: 8 • Press EEEEsB E33D to draw the gridmap plot. The result is a grid of functions corresponding to the real and imaginary parts of the complex function. • Press C^C^IM BXH1 to return to the PLOT WINDOW environment. Page 1 2-42 • Press I on J , or (JW7JB9IIB, to return to normal calculator display. Other functions of a complex variable worth trying for Gridmap plots are: (1 ) SIN((X,Y)) i.e., F(z) = sin(z) (2)(X,Y)A2 i.e., F(z) = z2 (3) EXP((X,Y)) i.e., F(z) = ez (4) SINH((X,Y)) i.e., F(z) = sinh(z) (5) TAN((X,Y)) i.e., F(z) = tan(z) (6) ATAN((X,Y)) i.e., F(z) = tan ^z) (7) (X,Y)A3 i.e., F(z) = z3 (8) 1/(X,Y) i.e., F(z) = 1/z (9) V (X,Y) i.e., F(z) = i}n Pr-Surface plots Pr-Surface (parametric surface) plots are used to plot a three-dimensional surface whose coordinates (x,y,z) are described by x = x(X,Y), y = y(X,Y), z=z(X,Y), where X and Y are independent parameters. Note: The equations x = x(X,Y), y = y(X,Y), z=z(X,Y) represent a parametric description of a surface. X and Y are the independent parameters. Most textbooks will use (u,v) as the parameters, rather than (X,Y). Thus, the parametric description of a surface is given as x = x(u,v), y = y(u,v), z=z(u,v). For example, to produce a Pr-Surface plot for the surface x = x(X,Y) = X sin Y, y = y(X,Y) = x cos Y, z=z(X,Y)=X, use the following: • Press C5DJ^, simultaneously if in RPN mode, to access to the PLOT SETUP window. Change TYPE to Pr-Surface. Press ^? and type /{X*SIN(Y), X*COS(Y), X}' EH. Make sure that 'X' is selected as the Indep: and 'Y' as the Depnd: variables. Press Q^IIIEEIII to return to normal calculator display. Press C5DJ^, simultaneously if in RPN mode, to access the PLOT WINDOW screen. Keep the default plot window ranges to read: X-Left:-1, X-Right: 1 , Y-Near:-1, Y-Far: 1, Z-Low: -1, Z-High:l, XE: 0, YE:-3, zE:0, Step Indep: 10, Depnd: 8 Press IH?EEB E33II to draw the three-dimensional surface. Press IIIjHil(W3 DEEH! EHEEI to see the graph with labels and ranges. Page 1 2-43 • Press (W)(W)iafil H3IH! to return to the PLOT WINDOW environment. • Press I on] , or to return to normal calculator display. The VPAR variable The VPAR (Volume Parameter) variable contains information regarding the "volume" used to produce a three dimensional graph. Therefore, you will see it produced whenever you create a three dimensional plot such as Fast3D, Wireframe, or Pr-Surface. Interactive drawing Whenever we produce a two-dimensional graph, we find in the graphics screen a soft menu key labeled illilllli!. Pressing lEIIIIii produces a menu that include the following options (press InxtJ to see additional functions): V -6.5 6.5 liHaiiMfllHiH a: V -6.5 6.5 liMfiHF7MTiV111 DEL |EF;hl"E| HEhU a: V -6.5 6.5 SUE | REPL |PICT-»j KjV^I | PICT Through the examples above, you have the opportunity to try out functions LABEL, MENU, PICT->, and REPL. Many of the remaining functions, such as DOT+, DOT-, LINE, BOX, CIRCL, MARK, DEL, etc., can be used to draw Page 1 2-44 points, lines, circles, etc. on the graphics screen, as described below. To see how to use these functions we will try the following exercise: First, we get the graphics screen corresponding to the following instructions: • Press LjnJi^D / simultaneously if in RPN mode, to access to the PLOT SETUP window. • Change type to Function, if needed • Change EQ to 'X' • Make sure that Indep: is set to 'X' also • Press [nxtJ iiiiii!i!G:liiiiii to return to normal calculator display. • Press C^DJm^L, simultaneously if in RPN mode, to access the PLOT window (in this case it will be called PLOT -POLAR window). • Change the H-VIEW range to -10 to 10, by using CDUD&*mCDUDJB?m, and the V-VIEW range to -5 to 5 by using CD CD KM CD BM. • Press EEMi MEM to plot the function. • Press IIIlMlQ^ IIIIHiiOII to add labels to the graph. Press Q^C*D (or {J^Jprev_ ) to recover the original EDIT menu. Next, we illustrate the use of the different drawing functions on the resulting graphics screen. They require use of the cursor and the arrow keys (C3DCD^>^3?) to move the cursor about the graphics screen. DOT+ and DOT- When DOT+ is selected, pixels will be activated wherever the cursor moves leaving behind a trace of the cursor position. When DOT- is selected, the opposite effect occurs, i.e., as you move the cursor, pixels will be deleted. For example, use the CD^b keys to move the cursor somewhere in the middle of the first quadrant of the x-y plane, then press lllillillllll. The label will be selected (IlililMi). Press and hold the CD key to see a horizontal line being traced. Now, press MSB, to select this option ( IIMIlHl! ). Press and hold the CT) key to see the line you just traced being erased. Press IIMII, when done, to deselect this option. Page 1 2-45 MARK This command allows the user to set a mark point which can be used for a number of purposes, such as: • Start of line with the LINE or TLINE command • Corner for a BOX command • Center for a CIRCLE command Using the MARK command by itself simply leaves an x in the location of the mark (Press {jwrj uMB to see it in action). LINE This command is used to draw a line between two points in the graph. To see it in action, position the cursor somewhere in the first quadrant, and press (j^Jprev_ HJJQ. A MARK is placed over the cursor indicating the origin of the line. Use the CD key to move the cursor to the right of the current position, say about 1 cm to the right, and press EES. A line is draw between the first and the last points. Notice that the cursor at the end of this line is still active indicating that the calculator is ready to plot a line starting at that point. Press ^3? to move the cursor downwards, say about another cm, and press EES again. Now you should have a straight angle traced by a horizontal and a vertical segments. The cursor is still active. To deactivate it, without moving it at all, press EES. The cursor returns to its normal shape (a cross) and the LINE function is no longer active. TUNE (Toggle LINE) Move the cursor to the second quadrant to see this function in action. Press DEES. A MARK is placed at the start of the toggle line. Move the cursor with the arrow keys away from this point, and press EBES. A line is drawn from the current cursor position to the reference point selected earlier. Pixels that are on in the line path will be turned off, and vice versa. To remove the most recent line traced, press EBES again. To deactivate TLINE, move the cursor to the original point where TLINE was activated, and press Page 1 2-46 BOX This command is used to draw a box in the graph. Move the cursor to a clear area of the graph, and press This highlights the cursor. Move the cursor with the arrow keys to a point away, and in a diagonal direction, from the current cursor position. Press IIIIIII again. A rectangle is drawn whose diagonal joins the initial and ending cursor positions. The initial position of the box is still marked with and x. Moving the cursor to another position and pressing lllillil will generate a new box containing the initial point. To deselect BOX, move the cursor to the original point where BOX was activated, then press mm mm. CIRCL This command produces a circle. Mark the center of the circle with a MARK command, then move the cursor to a point that will be part of the periphery of the circle, and press IS339. To deactivate CIRCL, return the cursor to the MARK position and press IIIIiB. Try this command by moving the cursor to a clear part of the graph, press CESS. Move the cursor to another point, then press IsjEHS. A circle centered at the MARK, and passing through the last point will be drawn. LABEL Pressing IIII3II!!! places the labels in the x- and y-axes of the current plot. This feature has been used extensively through this chapter. DEL This command is used to remove parts of the graph between two MARK positions. Move the cursor to a point in the graph, and press CESS. Move the cursor to a different point, press ICESEI again. Then, press lliiE!!!!!. The section of the graph boxed between the two marks will be deleted. Page 1 2-47 ERASE The function ERASE clears the entire graphics window. This command is available in the PLOT menu, as well as in the plotting windows accessible through the soft menu keys. MENU Pressing ILiliiilili will remove the soft key menu labels to show the graphic unencumbered by those labels. To recover the labels, press [nxt) . SUB Use this command to extract a subset of a graphics object. The extracted object is automatically placed in the stack. Select the subset you want to extract by placing a MARK at a point in the graph, moving the cursor to the diagonal corner of the rectangle enclosing the graphics subset, and press IliOIl. This feature can be used to move parts of a graphics object around the graph. REPL This command places the contents of a graphic object currently in stack level 1 at the cursor location in the graphics window. The upper left corner of the graphic object being inserted in the graph will be placed at the cursor position. Thus, if you want a graph from the stack to completely fill the graphic window, make sure that the cursor is placed at the upper left corner of the display. PICT^ This command places a copy of the graph currently in the graphics window on to the stack as a graphic object. The graphic object placed in the stack can be saved into a variable name for storage or other type of manipulation This command copies the coordinates of the current cursor position, in user coordinates, in the stack. Page 1 2-48 Zooming in and out in the graphics display Whenever you produce a two-dimensional FUNCTION graphic interactively, the first soft-menu key, labeled BSIiEl, lets you access functions that can be used to zoom in and out in the current graphics display. The ZOOM menu includes the following functions (press Lnxt J to move to the next menu): We present each of these functions following. You just need to produce a graph as indicated in Chapter 1 2, or with one of the programs listed earlier in this Chapter. ZFACT, ZIN, ZOUT, and ZLAST Pressing BEES produces an input screen that allows you to change the current X- and Y-Factors. The X- and Y-Factors relate the horizontal and vertical user- defined unit ranqes to their corresponding pixel ranqes. Chanqe the H- Fadorjoread e! and press 5L change the vLtor to read 2^ press lllllMll:lllll. Check off the option ^Recenter on cursor, and press IIIiJM Back in the graphics display, press EE! . The graphic is re-drawn with the new vertical and horizontal scale factors, centered at the position where the cursor was located, while maintaining the original PICT size (i.e., the original number of pixels in both directions). Using the arrow keys, scroll horizontally or vertically as far as you can of the zoomed-in graph. To zoom out, subjected to the H- and V-Factors set with ZFACT, press B333 BEES. The resulting graph will provide more detail than the zoomed-in graph. You can always return to the very last zoom window by using BES1. Page 1 2-49 BOXZ Zooming in and out of a given graph can be performed by using the soft- menu key BOXZ. With BOXZ you select the rectangular sector (the "box") that you want to zoom in into. Move the cursor to one of the corners of the box (using the arrow keys), and press III!!!:!:!:!!!. Using the arrow keys once more, move the cursor to the opposite corner of the desired zoom box. The cursor will trace the zoom box in the screen. When desired zoom box is selected, press EEEd. The calculator will zoom in the contents of the zoom box that you selected to fill the entire screen. If you now press il:;il!il!3iji, the calculator will zoom out of the current box using the H- and V-Factors, which may not recover the graph view from which you started the zoom box operation. ZDFLT, ZAUTO Pressing iliiiiSiillj! re-draws the current plot using the default x- and y-ranges, i.e., -6.5 to 6.5 in x, and -3.1 to 3.1 in y. The command l!:;:l!l!i]3ili!l, on the other hand, creates a zoom window using the current independent variable (x) range, but adjusting the dependent variable (y) range to fit the curve (as when you use the function MM in the PLOT WINDOW input form (CSDJ^L, simultaneously in RPN mode). HZIN, HZOUT, VZIN and VZOUT These functions zoom in and out the graphics screen in the horizontal or vertical direction according to the current H- and V-Factors. CNTR Zooms in with the center of the zoom window in the current cursor location. The zooming factors used are the current H- and V-Factors. ZDECI Zooms the graph so as to round off the limits of the x-interval to a decimal value. Page 1 2-50 ZINTG Zooms the graph so that the pixel units become user-define units. For example, the minimum PICT window has 131 pixels. When you use ZINTG, with the cursor at the center of the screen, the window gets zoomed so that the x-axis extends from -64.5 to 65.5. ZSQR Zooms the graph so that the plotting scale is maintained at 1:1 by adjusting the x scale, keeping the y scale fixed, if the window is wider than taller. This forces a proportional zooming. ZTRIG Zooms the graph so that the x scale incorporates a range from about — 3ti to +37i, the preferred range for trigonometric functions. Note: None of these functions are programmable. They are only useful in an interactive way. Do not confuse the command EQESQ in the ZOOM menu with the function ZFACTOR, which is used for gas dynamic and chemistry applications (see Chapter 3). The SYMBOLIC menu and graphs The SYMBOLIC menu is activated by pressing the Lsymb J key (fourth key from the left in fourth row from the top of the keyboard). This menu provides a list of menus related to the Computer Algebraic System or CAS, these are: SYHBOLIC HEHU 2 . HRITHHETK.. 3. CALCULUS.. H. GRAPH.. S . SOLVER.. G.TRIGOnOHETRIC. SYHBOLIC HEHU 2 . HRITHHETK.. 3 . CALCULUS.. H . GRAPH.. 5. SOLVER.. C.TRIGOnOHETRIC. All but one of these menus are available directly in the keyboard by pressing the appropriate keystroke combination as follows. The Chapter of the user manual where the menus are described is also listed: Page 12-51 ALGEBRA.. (the (3D key) Ch. 5 ARITHMETIC. (the CD key) Ch. 5 CALCULUS.. (J=T)CALC_ (the CD key) Ch. 13 SOLVER.. (the CD key) Ch. 6 TRIGONOMETRIC. (the CD key) Ch. 5 EXP&LN.. (the CD key) Ch. 5 The SYMB/GRAPH menu The GRAPH sub-menu within the SYMB menu includes the following functions: SYHBOLIC GRAPH HEHU a.GROP-ftDD 3. PLOT H . PLuTflDD 5.PUt setup.. G . L" I 'j Tl T H E= SYHBOLIC GRHPH HEHU H.PLOTflDD 5. PUt setup.. G.SIGnTflE ?.TflP-VflL E . T h E= '.' H F; 3 . L" i M E= N L I . . DEFINE: same as the keystroke sequence l<n JPEF (the L 2 j key) GROBADD: pastes two GROBs first over the second (See Chapter 22) PLOT(function): plots a function, similar to LjnJi^D PLOTADD(function): adds this function to the list of functions to plot, similar to (J^J 2D/3D^ Plot setup..: same as C3D J^, SIGNTAB(function): sign table of given function showing intervals of positive and negative variation, zero points and infinite asymptotes TABVAL: table of values for a function TABVAR: variation table of a function Examples of some of these functions are provided next. PLOT(XA2-l ) is similar to EDi^D with EQ: XA2 -1 . Using EEMi Em produces the plot: X"X"X"X"X"X"X"X"X"X"X" F L V T E T U F ■X"X"X"X"X"X"X"X"X"X"X TMD*:liH.L.UlJ.« E4:xa-i In44p:X SiHULt H-TicR : 10 . V-TicR:iD. Choose type of plot ^Connect ^Fixe Is Page 1 2-52 PLOTADD(XA2-X) is similar to J^£. but adding this function to EQ: XA2 I kinn ll-ili-lMiiiiiiliriliT;!:] nmr\nre l; : F; ■ j Ind-sp = !■: SiHuLt H-TiCh:iD. V-TiCh=iD. Chooj* type of plot ^Connect ^Pixels IijiiM | i::, Vj |TF;hlE| FCn I EDIT IlhnlL TABVAL(XA2-1 ,{1 , 3}) produces a list of {min max} values of the function in the interval {1,3}, while SIGNTAB(XA2-1 ) shows the sign of the function in the interval (-oo,+), with f(x) > 0 in (-co,-l), f(x) <0, in (-1,1), and f(x) > 0 in (1,+ oo). F HLLK J ~ TRBVRI_(x2-l,U 3>) {x2-l {{1 3> {0 S» signtrb(x2-i) {-■:■:■ + -1 - 1 + +*> TABVAR(LN(X)/X) produces the following table of variation: L -r ■■-■■-■I LNL4J I I TRBVRR^ x C 'LhKXVX' C C f?' '0+0' + 'EXPaV - '+«■' > £ '?' '?' t ■l^EXPav i +: 0 y y Graphic 113 x 131 > A detailed interpretation of the table of variation is easier to follow in RPN mode: F=: F' = X X^-LN(X) SQ(X) -II klfV^i-ll . Wari F'=: ->: X^-LN(X) SQ(X) -(LH(X)-l) I toumananaaiamBanHniH at ion table: 1 -w ? 0+0 + e - +w X ? ? * t-j-l-+:0F Page 1 2-53 The output is in a graphical format, showing the original function, F(X), the derivative F'(X) right after derivation and after simplification, and finally a table of variation. The table consists of two rows, labeled in the right-hand side. Thus, the top row represents values of X and the second row represents values of F. The question marks indicates uncertainty or non-definition. For example, for X<0, LN(X) is not defined, thus the X lines shows a question mark in that interval. Right at zero (0+0) F is infinite, for X = e, F = 1/e. F increases before reaching this value, as indicated by the upward arrow, and decreases after this value (X=e) becoming slightly larger than zero (+:0) as X goes to infinity. A plot of the graph is shown below to illustrate these observations: -K- Function DRAW3DMATRIX This function takes as argument a nxm matrix, Z, = [ Zjj], and minimum and maximum values for the plot. You want to select the values of vmin and vmax so that they contain the values listed in Z. The general call to the function is, therefore, DRAW3DMATRIX(Z,vmin,vmax). To illustrate the use of this function we first generate a 6x5 matrix using RANM({6,5}), and then call function DRAW3DMATRIX, as shown below: [-6 -3 -6 -6 3 - 7 -5 0 0 3 5 -6 -H -3 -3 -3 H 7 3 6 5 -i H -H i .7 -H -5 7 -?. EDIT | VIEH | RCL | £Tut |PURGE|CLERR -h, -c- -h. -h, 3 7-5 0 0 3 5 -6 -H -3 -3 -3 H 7 3 6 5 -i H -H i .7 -H -5 7 -7. :DRAH3DHATRIK(HnS(i).-i0.iO) HOVRL EDIT | VIEH | RCL | 3 TO* |F UF;'jE|lLEhF; The plot is in the style of a FAST3DPLOT. Different views of the plot are shown below: T Page 1 2-54 Chapter 1 3 Calculus Applications In this Chapter we discuss applications of the calculator's functions to operations related to Calculus, e.g., limits, derivatives, integrals, power series, etc. The CALC (Calculus) menu Many of the functions presented in this Chapter are contained in the calculator's CALC menu, available through the keystroke sequence {^Jcalc_ (associated with the LU key). The CALC menu shows the following entries: CALC METlU li.DERIY. & HUE'] . .. I 2. LIMIT:- SERIES.. 3 . DIFFERENTIAL EGH.S.. H. GRAPH.. 5.DERVK fi.inTVK I ! 1 icsncLl ok The first four options in this menu are actually sub-menus that apply to (1) derivatives and integrals, (2) limits and power series, (3) differential equations, and (4) graphics. The functions in entries (1) and (2) will be presented in this Chapter. Differential equations, the subject of item (3), are presented in Chapter 16. Graphic functions, the subject of item (4), were presented at the end of Chapter 12. Finally, entries 5. DERVX and 6.INTVX are the functions to obtain a derivative and a indefinite integral for a function of the default CAS variable (typically, 'X'). Functions DERVX and INTVX are discussed in detail later. Limits and derivatives Differential calculus deals with derivatives, or rates of change, of functions and their applications in mathematical analysis. The derivative of a function is defined as a limit of the difference of a function as the increment in the independent variable tends to zero. Limits are used also to check the continuity of functions. Page 13-1 Function lim The calculator provides function lim to calculate limits of functions. This function uses as input an expression representing a function and the value where the limit is to be calculated. Function lim is available through the command catalog (0_w {alpha}[^J(l} ) or through option 2. LIMITS & SERIES... of the CALC menu (see above). Note: The functions available in the LIMITS & SERIES menu are shown next: LIMIT:" SERIES HERU a. Uh 3. SERIES H . TflYLORO 5 . TflVLR 6. CALCULUS.. Function DIVPC is used to divide two polynomials producing a series expansion. Functions DIVPC, SERIES, TAYLORO, and TAYLOR are used in series expansions of functions and discussed in more detail in this Chapter. Function lim is entered in ALG mode as 1 x=a) to calculate the limit lim f{x) . In RPN mode, enter the function first, then the expression x^>a 'x=a', and finally function lim. Examples in ALG mode are shown next, including some limits to infinity. The keystrokes for the first example are as follows (using Algebraic mode, and system flag 1 1 7 set to CHOOSE boxes): (jT) calc_ (X) BBI CX3 IISl (gGDCDCB i (g CB ^ CD (enter) : limCX+1) X+l 2 : lim(x£-2) X+l -1 CftSCM HELP The infinity symbol is associated with the L 0 J key, i.e.., j00 . Page 1 3-2 Derivatives The derivative of a function f(x) at x = a is defined as the limit g.A,)-lin/<' + *>-/M dx h->0 h Some examples of derivatives using this limit are shown in the following screen shots: x+h x : lim e -e 1 h J X e Functions DERIV and DERVX The function DERIV is used to take derivatives in terms of any independent variable, while the function DERVX takes derivatives with respect to the CAS default variable VX (typically X). While function DERVX is available directly in the CALC menu, both functions are available in the DERIV.&INTEG sub- menu within the CALCL menu ( C3D$^- )• Function DERIV requires a function, say f(t), and an independent variable, say, t, while function DERVX requires only a function of VX. Examples are shown next in ALG mode. Recall that in RPN mode the arguments must be entered before the function is applied. DERIvtt-eSt) DERIV(SIH(s),s) t . t COS(s)l : DERVXtJX -X) -[[-l+2-Jx)-Jx) 2-X The DERIV&INTEG menu The functions available in this sub-menu are listed below: Page 1 3-3 DERI1.1 . ft IP.TE'] . HEnU 3.DERYK 1 H.DIY 5 . FOURIER 6. HESS PER I'.' . iriTEG. HEHU S.inTVK 5 . LflPL iLi . FRE'.'hL ii.RISCH ia.SIGHfl DERI'.' . iriTEG. HERU 3. LflPL ill . FRE'.'hL ii.RISCH ia.SIGHfl i? . l'ighh1.1:-: Out of these functions DERIV and DERVX are used for derivatives. The other functions include functions related to anti-derivatives and integrals (IBP, INTVX, PREVAL, RISCH, SIGMA, and SIGMAVX), to Fourier series (FOURIER),and to vector analysis (CURL, DIV, HESS, LAPL). Next we discuss functions DERIV and DERVX, the remaining functions are presented either later in this Chapter or in subsequent Chapters. Calculating derivatives with d The symbol is available as § (the jcosj key). This symbol can be used to enter a derivative in the stack or in the Equation Writer (see Chapter 2). If you use the symbol to write a derivative into the stack, follow it immediately with the independent variable, then by a pair of parentheses enclosing the function to be differentiated. Thus, to calculate the derivative d(sin(r),r), use, in ALG mode: C3 ^S™)QDOED^ C^@^GD(3(£wir) In RPN mode, this expression must be enclosed in quotes before entering it into the stack. The result in ALG mode is: COSCr) In the Equation Writer, when you press LxU § , the calculator provides the following expression: Page 1 3-4 The insert cursor (^) will be located right at the denominator awaiting for the user to enter an independent variable, say, s: [alpha) }(s\ . Then, press the right-arrow key (CD) to move to the placeholder between parentheses: Next, enter the function to be differentiated, say, s*ln(s): RlTTlgJTmi:WrP|^J;T|J;T4f.]i^j:iJ To evaluate the derivative in the Equation Writer, press the up-arrow key <^>, four times, to select the entire expression, then, press HEED. The derivative will be evaluated in the Equation Writer as: en Note: The symbol d is used formally in mathematics to indicate a partial derivative, i.e., the derivative of a function with more than one variable. However, the calculator does not distinguish between ordinary and partial Page 1 3-5 derivatives, utilizing the same symbol for both. The user must keep this distinction in mind when translating results from the calculator to paper. The chain rule The chain rule for derivatives applies to derivatives of composite functions. A general expression for the chain-rule is d{f[g(x)]}/dx = (df/dg)- (dg/dx). Using the calculator, this formula results in: dlg(x>dlf[g(x) EaaEnaoaiBEiMfliHEBini EaaEnaBgaBanMHiHEBini The terms dl in front of g(x) and f(g(x)) in the expression above are abbreviations the calculator uses to indicate a first derivative when the independent variable, in this case x, is clearly defined. Thus, the latter result is interpreted as in the formula for the chain rule shown above. Here is another example of a chain rule application: EDIT CURL" GIG - E'.'hL FACTO SIHP M EDIT CURS RIG ■ E'.'HL FACTO SIHP Derivatives of equations You can use the calculator to calculate derivatives of equations, i.e., expressions in which derivatives will exist in both sides of the equal sign. Some examples are shown below: dix(t)=2-(siH(e(tH-die(t)] : ^(yCx)=x2-3-x) dly(x)=2-x-3 :DERIv(h(t)=LH(t -lit) dlhCti=-|r^ t -1 Page 1 3-6 DERVX(Y(X)=TfMXH f 2 ^ ^ — |- _ — _ 1 1 .■ i j ■. . dlVCXHTRHCXr+1 : DERVX(G(X)=X-LN(XH dlGCXJ-CLHCXHll Notice that in the expressions where the derivative sign (d) or function DERIV was used, the equal sign is preserved in the equation, but not in the cases where function DERVX was used. In these cases, the equation was re-written with all its terms moved to the left-hand side of the equal sign. Also, the equal sign was removed, but it is understood that the resulting expression is equal to zero. Implicit derivatives Implicit derivatives are possible in expressions such as: Bx(t>dix(t)=a.(i+x(t».dixO) EDIT CURS GIG ■ E'.'hL FACTO SIHP M EDIT CURS BIG E'.'HL FACTO SIHP Application of derivatives Derivatives can be used for analyzing the graphs of functions and for optimizing functions of one variable (i.e., finding maxima and minima). Some applications of derivatives are shown next. Analyzing graphics of functions In Chapter 1 1 we presented some functions that are available in the graphics screen for analyzing graphics of functions of the form y = f(x). These functions include (X,Y) and TRACE for determining points on the graph, as well as functions in the ZOOM and FCN menu. The functions in the ZOOM menu allow the user to zoom in into a graph to analyze it in more detail. These functions are described in detail in Chapter 1 2. Within the functions of the FCN menu, we can use the functions SLOPE, EXTR, F', and TANL to determine the slope of a tangent to the graph, the extrema (minima and Page 1 3-7 maxima) of the function, to plot the derivative, and to find the equation of the tangent line. Try the following example for the function y = tan(x). • Press CfDJ^i, simultaneously in RPN mode, to access to the PLOT SETUP window. • Change TYPE to FUNCTION, if needed, by using [ECEGB]. • Press ^3? and type in the equation /TAN(X)/. • Make sure the independent variable is set to 'X'. • Press [nxtJ i!ii!!>M-I:Siiliii to return to normal calculator display. • Press LtiJ ML , simultaneously, to access the PLOT window • Change H-VIEW range to -2 to 2, and V-VIEW range to -5 to 5. • Press iLiiLi:!!!!!!:!!!:!! EEEIII to plot the function in polar coordinates. The resulting plot looks as follows: / rcimnnfifflff / an • Notice that there are vertical lines that represent asymptotes. These are not part of the graph, but show points where TAN(X) goes to ± oo at certain values of X. • Press MSm 11(311)11, and move the cursor to the point X: 1 .08E0, Y: 1.86E0. Next, press (W)fflieHB. The result is Slope: 4.45010547846. • Press [nx^[nxt)MSM. This operation produces the equation of the tangent line, and plots its graph in the same figure. The result is shown in the figure below: / Ton Lin*: Y=H.H50j / 3HS Page 1 3-8 • Press InxtJ lllilu! EEKHS IonJ to return to normal calculator display. Notice that the slope and tangent line that you requested are listed in the stack. Function DOMAIN Function DOMAIN, available through the command catalog (LxD_^z; ), provides the domain of definition of a function as a list of numbers and specifications. For example, DOMfllHCLH(X)) {-w ? 0 + +«} indicates that between -go and 0, the function LN(X) is not defined (?), while from 0 to +oo, the function is defined (+). On the other hand, domfiin(Ji-x£) <-»?-! + !? +■»> indicates that the function is not defined between -oo and -1, nor between 1 and +oo. The domain of this function is, therefore, -1 <X<1 . Function TABVAL This function is accessed through the command catalog or through the GRAPH sub-menu in the CALC menu. Function TABVAL takes as arguments a function of the CAS variable, f(X), and a list of two numbers representing a domain of interest for the function f(X). Function TABVAL returns the input values plus the range of the function corresponding to the domain used as input. For example, 1 rRBVRL {<->{##}}} Page 1 3-9 This result indicates that the range of the function f(X) = \4i V26] corresponding to the domain D = { -1 ,5 } is R = ^ f • Function SIGNTAB Function SIGNTAB, available through the command catalog (Lr>J cat )f provides information on the sign of a function through its domain. For example, for the TAN(X) function, :SIGHTRBCTflHCX)3 {-«■ ? -| - 0 + ^ ? +«■} SIGNTAB indicates that TAN(X) is negative between -n/2 and 0, and positive between 0 and n/2. For this case, SIGNTAB does not provide information (?) in the intervals between -00 and -n /2, nor between +71 /2 and 00. Thus, SIGNTAB, for this case, provides information only on the main domain of TAN(X), namely -n /2 < X < +71 /2. A second example of function SIGNTAB is shown below: SIGNTAB X+l 1 + +.v.> For this case, the function is negative for X<-1 and positive for X> -1 . Function TABVAR This function is accessed through the command catalog or through the GRAPH sub-menu in the CALC menu. It uses as input the function f(VX), where VX is the default CAS variable. The function returns the following, in RPN mode: • Level 3: the function f(VX) Page 13-10 • Two lists, the first one indicates the variation of the function (i.e., where it increases or decreases) in terms of the independent variable VX, the second one indicates the variation of the function in terms of the dependent variable. • A graphic object showing how the variation table was computed. Example: Analyze the function Y = X3-4X2-1 1X+30, using the function TABVAR. Use the following keystrokes, in RPN mode: 5 x-'-3 4*XA2-1 1*X+3S 5 (^CB^ (select TABVAR) MM This is what the calculator shows in stack level 1 : l: Graphic 113 x 95 F=:(x3-4-X£-ll-X+30) F'=:(3-X£-4-2-X-ll) ->:((3-X-llXX+lX) ■■■■ -.L- ■; ■; 4- -.I-, i .-. ■ This is a graphic object. To be able to the result in its entirety, press ^3? . The variation table of the function is shown as follows: Variation table: + -1 - 4^ + +« X -» t 36 i Z|P t +» F -mm1 Press L^J to recover normal calculator display. Press to drop this last result from the stack. Two lists, corresponding to the top and bottom rows of the graphics matrix shown earlier, now occupy level 1 . These lists may be useful for programming purposes. Press CS to drop this last result from the stack. Page 13-11 The interpretation of the variation table shown above is as follows: the function F(X) increases for X in the interval (-00, -1), reaching a maximum equal to 36 at X = -1. Then, F(X) decreases until X= 1 1/3, reaching a minimum of -400/27. After that F(X) increases until reaching +c». Also, at X = ±00, F(X)= ±00. Using derivatives to calculate extreme points "Extreme points," or extrema, is the general designation for maximum and minimum values of a function in a given interval. Since the derivative of a function at a given point represents the slope of a line tangent to the curve at that point, then values of x for which f'(x) =0 represent points where the graph of the function reaches a maximum or minimum. Furthermore, the value of the second derivative of the function, f"(x), at those points determines whether the point is a relative or local maximum [f"(x)<0] or minimum [f"(x)>0]. These ideas are illustrated in the figure below. In this figure we limit ourselves to determining extreme points of the function y = f(x) in the x-interval [a,b]. Within this interval we find two points, x = xm and x = xM, where f'(x)=0. The point x = xm, where f"(x)>0, represents a local minimum, while the point x = xM, where f"(x)<0, represents a local maximum. From the graph of y = f(x) it follows that the absolute maximum in the interval [a,b] occurs at x = a, while the absolute minimum occurs at x = b. Page 13-12 For example, to determine where the critical points of function 'XA3-4*XA2- x3- -ll-X+30 :flNS(l)*F -ll-X+36 : DERVXCF) (3-X- 11MX+1) X -4-X -1 l-X+3^ DERVXCF) (3-X-llMX+l)| S0LVEVXCRHSCD3 We find two critical points, one at x = 11/3 and one at x the second derivative at each point use: 1= L'LKV.".!.!- J I C3-X-11HX+1) :SOLVEVX(flNS(lH -1 . To evaluate : DERVXCDERVXtF^FPP C3-X-4)-a : SUESt(fPPjX=-^] :+HUM(flHS(lH 14. The last screen shows that f"(ll/3) = 14, thus, x = 11/3 is a relative - 3 - :+NUMtflNStlH 14. :SUBST(FPP,X=-1) 6-1-8 :+NUMtflNStlH -14. This result indicates that f"(-l) = -14, thus, x = -1 is a relative maximum. Evaluate the function at those points to verify that indeed f(-l) > f(l 1/3). +NUM[SUBST[F -14.8148148151 +NUM(SUBST(F,X=-1H 36 Higher order derivatives Higher order derivatives can be calculated by applying a derivative function several times, e.g., Page 13-13 s^[^(*SIN(X))] COS(X)+COS(X)+X--SIN(X) 2-3 Anti-derivatives and integrals An anti-derivative of a function f(x) is a function F(x) such that f(x) = dF/dx. For example, since d(x3) /dx = 3x2, an anti-derivative of f(x) = 3x2 is F(x) = x3 + C, where C is a constant. One way to represent an anti-derivative is as a indefinite integral i.e., ^f(x)dx = F(x) + C, if and only if, f(x) = dF/dx, and C = constant. Functions INT, INTVX, RISCH, SIGMA and SIGMAVX The calculator provides functions INT, INTVX, RISCH, SIGMA and SIGMAVX to calculate anti-derivatives of functions. Functions INT, RISCH, and SIGMA work with functions of any variable, while functions INTVX, and SIGMAVX utilize functions of the CAS variable VX (typically, V). Functions INT and RISCH require, therefore, not only the expression for the function being integrated, but also the independent variable name. Function INT, requires also a value of x where the anti-derivative will be evaluated. Functions INTVX and SIGMAVX require only the expression of the function to integrate in terms of VX. Some examples are shown next in ALG mode: INTVX UeX) CX-13-e : IHTVXCRSIHCX2L Jl-SQCX3+X-flSIHCX) SIGMFlVX(£X-3M SIGMA X! X-0 X-l „ X-2 ^ 2 3 3 * 2 * IE: F" linTYKI LflPL |PREYA|RISCH|SIGHA SIGMFl(s-s!,s) Page 13-14 Please notice that functions SIGMAVX and SIGMA are designed for integrands that involve some sort of integer function like the factorial (!) function shown above. Their result is the so-called discrete derivative, i.e., one defined for integer numbers only. Definite integrals In a definite integral of a function, the resulting anti-derivative is evaluated at the upper and lower limit of an interval (a,b) and the evaluated values subtracted. Symbolically, f(x)dx = F(b) - F(a), where f(x) = dF/dx. The PREVAL(f(x),a,b) function of the CAS can simplify such calculation by returning f(b)-f(a) with x being the CAS variable VX. 70 PREVFlLl3-X^-X,0,5J PREVflL(X-LN(XU,5) 5-LHC5! UiaMHn^iffia«iaa^iflfeM:iMw;rr To calculate definite integrals the calculator also provides the integral symbol as the keystroke combination CS ( (associated with the (jmJ key). The simplest way to build an integral is by using the Equation Writer (see Chapter 2 for an example). Within the Equation Writer, the symbol Ir^J ( produces the integral sign and provides placeholders for the integration limits (a,b), for the function, f(x), and for the variable of integration (x). The following screen shots show how to build a particular integral. The insert cursor is first located in the lower limit of integration, enter a value and press the right-arrow key (Q} ) to move to the upper limit of integration. Enter a value in that location and press CD again to move to the integrand location. Type the integrand expression, and press once more to move to the differential place holder, type the variable of integration in that location and the integral is ready to be calculated. EDIT CURL" GIG ■ EVflL FACTO SIHP H EDIT CUR aegiHEBffiHBBiai Page 13-15 At this point, you can press [enter] to return the integral to the stack, which will show the following entry (ALG mode shown): This is the general format for the definite integral when typed directly into the stack, i.e., {(lower limit, upper limit, integrand, variable of integration) Pressing (enter) at this point will evaluate the integral in the stack: ^5 s2-lds 2 36 The integral can be evaluated also in the Equation Writer by selecting the entire expression an using the soft menu key BZEH. Step-by-step evaluation of derivatives and integrals With the Step/Step option in the CAS MODES windows selected (see Chapter 1 ), the evaluation of derivatives and integrals will be shown step by step. For example, here is the evaluation of a derivative in the Equation Writer: llllllS Page 13-16 Notice the application of the chain rule in the first step, leaving the derivative of the function under the integral explicitly in the numerator. In the second step, the resulting fraction is rationalized (eliminating the square root from the denominator), and simplified. The final version is shown in the third step. Each step is shown by pressing the EEEQ menu key, until reaching the point where further application of function EVAL produce no more changes in the expression. The following example shows the evaluation of a definite integral in the Equation Writer, step-by-step: EaaEnaoaiBEiMfliHEBini : +1 Square root s2+l Rat i ona 1 f r act i on 9 A. Rat ional f ract ion Rat ional f ract ion 2 2-s Notice that the step-by-step process provides information on the intermediate steps followed by the CAS to solve this integral. First, CAS identifies a square root integral, next, a rational fraction, and a second rational expression, to come up with the final result. Notice that these steps make a lot of sense to the calculator, although not enough information is provided to the user on the individual steps. Page 13-17 Integrating an equation Integrating an equation is straightforward, the calculator simply integrates both sides of the equation simultaneously, e.g., Techniques of integration Several techniques of integration can be implemented in the calculators, as shown in the following examples. Substitution or change of variables Suppose we want to calculate the i f2 x mteqral . — JoVT^ -dx . If we use step-by- step calculation in the Equation Writer, this is the sequence of variable substitutions: P9iiiinfrai?poifflniifiii(gniiii This second step shows the proper substitution to use, u = x2-1 1 . Int[u'*F(u>] with u= Square root Fx1 Rat i ona 1 f r act i on 9 Rat i ona 1 f r act i on 2 1 2-x 2-x lint Lu ' *h ^.l^ J with u= Square root Fx1 Rational fraction 9 aaaBnaiagiEEaaiBEBini Page 13-18 The last four steps show the progression of the solution: a square root, followed by a fraction, a second fraction, and the final result. This result can be simplified by using function illlilill, to read: Integration by parts and differentials A differential of a function y = f(x), is defined as dy = f'(x) dx, where f'(x) is the derivative of f(x). Differentials are used to represent small increments in the variables. The differential of a product of two functions, y = u(x)v(x), is given by dy = u(x)dv(x) +du(x)v(x), or, simply, d(uv) = udv - vdu. Thus, the integral of udv = d(uv) - vdu, is written as udv = jd(uv) — jvdu . Since by the definition of a differential, Jdy = y, we write the previous expression as judv = uv - jvdu . This formulation, known as integration by parts, can be used to find an integral if dv is easily integrable. For example, the integral jxexdx can be solved by integration by parts if we use u = x, dv = exdx, since, v = ex. With du = dx, the integral becomes jxexdx = judv = uv - jvdu = xex - jexdx = xex - ex. The calculator provides function IBP, under the CALC/DERIV&INTG menu, that takes as arguments the original function to integrate, namely, u(X)*v'(X), and the function v(X), and returns u(X)*v(X) and -v(X)*u'(X). In other words, function IBP returns the two terms of the right-hand side in the integration by parts equation. For the example used above, we can write in ALG mode: -e*} IE: F" |inTYK| LflPL |PRE' .'hIRIl'lH Page 13-19 Thus, we can use function IBP to provide the components of an integration by parts. The next step will have to be carried out separately. It is important to mention that the integral can be calculated directly by using, for example, IHTVXl X Integration by partial fractions Function PARTFRAC, presented in Chapter 5, provides the decomposition of a fraction into partial fractions. This technique is useful to reduce a complicated fraction into a sum of simple fractions that can then be integrated term by term. For example, to integrate X5 +5 X4 +2X3 +X -dX we can decompose the fraction into its partial component fractions, as follows: PRRTFRRC X5+5 „ 2, 5 IS, 4 ,^3 : PARTFRAC H 3 2 JT+a-JT+JT K CH+15 13 K+i :inTYK(AnStitt ^■Ka-a.K+-|-iD.Ln(K5+-^+i3.Ln(K^ ■nariit^i^iiii^iffmiiaiMi bnariit^i^iiiifl^niffmiiaaiiii The direct integration produces the same result, with some switching of the terms (Rigorous mode set in i the CAS - see Chapter 2): inTYJUAnsatt |.Ka-a.K+-|-iD.LnaKi)+-^+i3«Lrp:i^ H 3 2 JT+a-JT+JT 4-Ka-a.K+i3.LnaK+ii)+ -tio-LntiKm-^ BitiiiHitiiEC'HII'HO'HlliijaJ Page 1 3-20 Improper integrals These are integrals with infinite limits of integration. Typically, an improper integral is dealt with by first calculating the integral as a limit to infinity, e.g., r^dx t. ^ dx — = lim — . Using the calculator, we proceed as follows: J i 7« iz1 1 F 1 limCnHSC133 e-1 Alternatively, you can evaluate the integral to infinity from the start, e.g., -^dx x 1 Integration with units An integral can be calculated with units incorporated into the limits of integration, as in the example shown below that uses ALG mode, with the CAS set to Approx mode. The left-hand side figure shows the integral typed in the line editor before pressing [enter] . The right-hand figure shows the result x dx . 333333333333_mm Page 13-21 If you enter the integral with the CAS set to Exact mode, you will be asked to change to Approx mode, however, the limits of the integral will be shown in a different format as shown here: -mm 2 . x dx 0-1 -mm . 333333333333_nn3 These limits represent 1x1 _mm and Oxl_mm, which is the same as l_mm and 0_mm, as before. Just be aware of the different formats in the output. Some notes in the use of units in the limits of integrations: 1 - The units of the lower limit of integration will be the ones used in the final result, as illustrated in the two examples below: l_min J 1_; t2"dt 71999. 6666667_s"" 2 - Upper limit units must be consistent with lower limit units. Otherwise, the calculator simply returns the unevaluated integral. For example, 3 - The integrand may have units too For example: l_yr l_ni r dr f1, le. X'l_sdx .5_s 4 - If both the limits of integration and the integrand have units, the resulting units are combined according to the rules of integration. For example, Page 1 3-22 fl0_S J 1-9 s £.33333333333_(93-s2. J0_S 35U-CTM ■■■TlBiliMMDdlilllB Infinite series 00 An infinite series has the form ^/z(/?)(x — d)n . The infinite series typically 77=0,1 starts with indices n = 0 or n = 1 . Each term in the series has a coefficient h(n) that depends on the index n. Taylor and Maclaurin's series A function f(x) can be expanded into an infinite series around a point x=x0 by using a Taylor's series, namely, where f(n)(x) represents the n-th derivative of f(x) with respect to x, f(0)(x) = f(x). If the value x0 is zero, the series is referred to as a Maclaurin's series, i.e., Taylor polynomial and reminder In practice, we cannot evaluate all terms in an infinite series, instead, we approximate the series by a polynomial of order k, Pk(x), and estimate the order of a residual, Rk(x), such that Page 1 3-23 i.e., f(x) = Pk(x) + Rk(x). The polynomial Pk(x) is referred to as Taylor's polynomial. The order of the residual is estimated in terms of a small quantity h = x-x0/ i.e., evaluating the polynomial at a value of x very close to x0. The residual if given by Rk(x) = hK where \ is a number near x = x0. Since \ is typically unknown, instead of an estimate of the residual, we provide an estimate of the order of the residual in reference to h, i.e., we say that Rk(x) has an error of order hn+1, or R « 0(hk+1). If h is a small number, say, h«l, then hk+1 will be typically very small, i.e., « hk« ...« h « 1 . Thus, for x close to x0, the larger the number of elements in the Taylor polynomial, the smaller the order of the residual. Functions TAYLR, TAYLRO, and SERIES Functions TAYLR, TAYLRO, and SERIES are used to generate Taylor polynomials, as well as Taylor series with residuals. These functions are available in the CALC/LIMITS&SERIES menu described earlier in this Chapter. Function TAYLORO performs a Maclaurin series expansion, i.e., about X = 0, of an expression in the default independent variable, VX (typically X). The expansion uses a 4-th order relative power, i.e., the difference between the highest and lowest power in the expansion is 4. For example, : TflYLORote^l :TflYLOR0£SIH(XH DIYPCI Uh |SERIE|TrtYLO|TAYLR| CflLC Page 1 3-24 Function TAYLR produces a Taylor series expansion of a function of any variable x about a point x = a for the order k specified by the user. Thus, the function has the format TAYLR(f(x-a),x,k). For example, :TflYLR(siN(s-^],s,6] 1 ,t5+ 1 lt4+ 1 lt3++ DIYPCI l.iH |SERIE|TflVLO|TflVLR| CflLC DIVPC| Uh |SERIE|THVLO|TflVLR| CflLC Function SERIES produces a Taylor polynomial using as arguments the function f(x) to be expanded, a variable name alone (for Maclaurin's series) or an expression of the form Variable = value' indicating the point of expansion of a Taylor series, and the order of the series to be produced. Function SERIES returns two output items a list with four items, and an expression for h = x - a, if the second argument in the function call is 'x=a', i.e., an expression for the increment h. The list returned as the first output object includes the following items: 1 - Bi-directional limit of the function at point of expansion, i.e., lim f(x) 2 - An equivalent value of the function near x = a 3 - Expression for the Taylor polynomial 4 - Order of the residual or remainder Because of the relatively large amount of output, this function is easier to handle in RPN mode. For example: jLimit : 1 Equiu: 1 Exp* 1= h=X-f Drop the contents of stack level 1 by pressing j + J, and then enter Leval J f to decompose the list. The results are as follows: Page 1 3-25 4: 3: l: Expans! -1 Limit: l EquiuM Remain: (h^ afflaMHaHMHffiHBnaBaBnH 4Expans: '-W20*hA6+ 1^24*hA4+-1^2*hA2+l ' In the right-hand side figure above, we are using the line editor to see the series expansion in detail. Page 1 3-26 Chapter 14 Multi-variate Calculus Applications Multi-variate calculus refers to functions of two or more variables. In this Chapter we discuss the basic concepts of multi-variate calculus including partial derivatives and multiple integrals. Multi-variate functions A function of two or more variables can be defined in the calculator by using the DEFINE function (LjnJ^L_ ). To illustrate the concept of partial derivative, we will define a couple of multi-variate functions, f(x,y) = x cos(y), and g(x,y,z) = (x2+y2)1/2sin(z), as follows: DEFIHEC,fCx,y)=x-C0SCy),3 HOVflL DEFIHe( 9(x,y,z)=Jx2+y2-£ HOVRL aiHJHiHCE'HII'HO-HllEia We can evaluate the functions as we would evaluate any other calculator function, e.g., 2'C0S(3) J5.f Graphics of two-dimensional functions are possible using Fast3D, Wireframe, Ps-Contour, Y-Slice, Gridmap, and Pr-Surface plots as described in Chapter 12. Partial derivatives Consider the function of two variables z = f(x,y), the partial derivative of the function with respect to x is defined by the limit Page 14-1 Similarly, ¥_ = limf(x + h,y)-f(x,y) dx *-*> h £-lim 3y *-><> f{x,y + k)-f{x,y) We will use the multi-variate functions defined earlier to calculate partial derivatives using these definitions. Here are the derivatives of f(x,y) with respect to x and y, respectively: = lim[^x+h^-f(x^ h+0l h , COSCy] ^■■■I.liHiiiriiiiffiiiiHJIImu I UUSh^ ilin|f'^+k'-fh|tf' k+01 k -Cx-SIHCy)] ■■■■ff.hHiiiriiiiffiiiiHJIImi Notice that the definition of partial derivative with respect to x, for example, requires that we keep y fixed while taking the limit as h->0. This suggest a way to quickly calculate partial derivatives of multi-variate functions: use the rules of ordinary derivatives with respect to the variable of interest, while considering all other variables as constant. Thus, for example, ■|- (x cosO)) = cos( y\ -|- (x cos(y)) = -x sin(y) , ox oy which are the same results as found with the limits calculated earlier. Consider another example, dx (yx2 + y2)= 2yx + 0 = 2xy In this calculation we treat y as a constant and take derivatives of the expression with respect to x. Similarly, you can use the derivative functions in the calculator, e.g., DERVX, DERIV, d (described in detail in Chapter 1 3) to calculate partial derivatives. Recall that function DERVX uses the CAS default variable VX (typically, X), Page 14-2 therefore, with DERVX you can only calculate derivatives with respect to X. Some examples of first-order partial derivatives are shown next: COS(y) x— SINty] I k^x +y_ x-SIN(y) ^(9(x,y,z)) 2±L ■SIHCz) : DERVx(x-Y2-V2) DERVXCX-SIHCY+XH COS(X+Y)-X+S I HCX+ YJ DERIvts-t^-e^t) s-2-t-e ■I'liiiigiitwi'Jiiiiiii'iwiM'iauii^ ■I'liiii'Jiitwi'Jiiiiiii'iMiM'iauii^ Higher-order derivatives The following second-order derivatives can be defined d^£_d_(df^ d2f _ d dx dx d2f dydx ydxj dy\dx j dy1 dy d2f ' dxdy The last two expressions represent cross-derivatives, the partial derivatives signs in the denominator shows the order of derivation. In the left-hand side, the derivation is taking first with respect to x and then with respect to y, and in the right-hand side, the opposite is true. It is important to indicate that, if a function is continuous and differentiable, then d2f = d2f dydx dxdy Page 1 4-3 Third-, fourth-, and higher order derivatives are defined in a similar manner. To calculate higher order derivatives in the calculator, simply repeat the derivative function as many times as needed. Some examples are shown below: — 7? '_■ '_' ■_' '. M J 0 , x-COSCy) -SIHCy) -SIHCy) ^■iawi.]^ai-ji.]^i-iHB.n-jiMli:^i:i«d The chain rule for partial derivatives Consider the function z = f(x,y), such that x = x(t), y = y(t). The function z actually represents a composite function of t if we write it as z = f[x(t),y(t)]. The chain rule for the derivative dz/dt for this case is written as dz _ dz dx dz dy dv dx dv dy dv To see the expression that the calculator produces for this version of the chain rule use: :^-(z(x(Uya)H |dly(Ud2z(x(Uy(tH+dlx(tH The result is given by d 1 y(t)-d2z(x(t),y(t))+d 1 x(t)-d 1 z(x(y),y(t)). The term d 1 y(t) is to be interpreted as "the derivative of y(t) with respect to the 1st independent variable, i.e., t", or dly(t) = dy/dt. Similarly, dlx(t) = dx/dt. On the other hand, dl z(x(t),y(t)) means "the first derivative of z(x,y) with respect to the first independent variable, i.e., x", or d 1 z(x(t),y(t)) = dz/dx. Similarly, d2z(x(t),y(t)) = dz/dy. Thus, the expression above is to be interpreted as: dz/dt = (dy/dt).(dz/dy) + (dx/dt)- (dz/dx). Page 1 4-4 Total differential of a function z = z(x,y) From the last equation, if we multiply by dt, we get the total differential of the function z = z(x,y), i.e., dz = (dz/dx)dx + (dz/dy)dy. A different version of the chain rule applies to the case in which z = f(x,y), x = x(u,v), y = y(u,v), so that z = f[x(u,v), y(u,v)]. The following formulas represent the chain rule for this situation: dz _ dz dx dz dy dz _ dz dx dz dy du dx du dy du ' dv dx dv dy dv Determining extrema in functions of two variables In order for the function z = f(x,y) to have an extreme point (extrema) at (x0,y0), its derivatives d\/dx and d\/dy must vanish at that point. These are necessary conditions. The sufficient conditions for the function to have an extreme at point (x0,y0) are d\/dx = 0, Sf/5y = 0, and A = {d2\/dx2)- [d2\/dy2)-[d2\/dxdy]2 > 0. The point (x0,y0) is a relative maximum if d2{/dx2< 0, or a relative minimum if &\/dx2> 0. The value A is referred to as the discriminant. If A = (d2{/dx2)- [d2\/ dy2)-[d2\/ dxdy]2 < 0, we have a condition known as a saddle point, where the function would attain a maximum in x if we were to hold y constant, while, at the same time, attaining a minimum if we were to hold x constant, or vice versa. Example 1 - Determine the extreme points (if any) of the function f(X,Y) = X3- 3X-Y2+5. First, we define the function f(X,Y), and its derivatives fX(X,Y) = dt/dX, fY(X,Y) = ai/fff. Then, we solve the equations fX(X,Y) = 0 and fY(X,Y) = 0, simultaneously: DEFinE(,FtK,VJ=K3-3.K-Va+El) HOVflL 3>X -3 ■ u i ^^^ i ■■ = :^(F(K,Y"*FY -O.Y3 :S0LYE(CFK FYDj'EK YTJ ■[□■!=! v= li 3 □■:= -i "i" = Li □ : Page 1 4-5 We find critical points at (X,Y) = (1,0), and (X,Y) = (-1,0). To calculate the discriminant, we proceed to calculate the second derivatives, fXX(X,Y) = d2\/dX2f fXY(X,Y) = d2{/dX/DY, and fYY(X,Y) = d2{/dY2. ■ J-ULYLU-T A r 1 Ji'Li'i IJ'J £CK=i v=li: CK=-i v=li:] ^(RCLCFK'UfFKK :^(RCL('FY'UfFYY -2 '. r. '_ l '. ■ r i "j.1 ft i j- ^(RCLCFK'UfFKY : FKKiFYV-FKV fD 0 The last result indicates that the discriminant is A = -1 2X, thus, for (X,Y) = (1,0), A <0 (saddle point), and for (X,Y) = (-1,0), A>0 and d2f/dX2<0 (relative maximum). The figure below, produced in the calculator, and edited in the computer, illustrates the existence of these two points: Using function HESS to analyze extrema Function HESS can be used to analyze extrema of a function of two variables as shown next. Function HESS, in general, takes as input a function of n independent variables §(x]f x2, ...,xn), and a vector of the functions ['x/ 'x2'...'xn']. Function HESS returns the Hessian matrix of the function defined as the matrix H = [hjj] = [d^/dx-fix-^, the gradient of the function with respect to the n-variables, grad f = [ dty/dxu d$/dx2 , ... d$/dxn], and the list of variables ['x/V.-.V]. Page 1 4-6 Applications of function HESS are easier to visualize in the RPN mode. Consider as an example the function (])(X,Y,Z) = X2 + XY + XZ, we'll apply function HESS to function § in the following example. The screen shots show the RPN stack before and after applying X +X-Y+X-Z [X Y Z] unction HESS. 4: 3: 12 1 11 1 0 0 Li e @J 2: [2-X+Y+Z X X] l: [X Y Z] When applied to a function of two variables, the gradient in level 2, when made equal to zero, represents the equations for critical points, i.e., d^/dx^ - 0, while the matrix in level 3 represent second derivatives. Thus, the results from the HESS function can be used to analyze extrema in functions of two variables. For example, for the function f(X,Y) = X3-3X-Y2+5, proceed as follows in RPN mode: 'XA3-3*X-YA2+5' (enter) ['X'/Y'] (enter) HESS SOLVE [EVAL) 'si' (2°t) 's2' (W) Enter function and variables Apply function HESS Find critical points Decompose vector Store critical points The variables si and s2, at this point, contain the vectors ['X=-l '/Y=0] and ['X=l ','Y=0], respectively. The Hessian matrix is at level 1 at this point. Store Hessian matrix Substitute si into H The resulting matrix A has an elements an = d2$/dX2 = -6., a22= d2<\>/dX2 2., and a12 = 021 = d2^/dXSY = 0. The discriminant, for this critical point si (-1 ,0) is A = (d2{/dx2)- (d2{/dy2)-[d2{/dxdy]2 = (-6.)(-2.) = 1 2.0 > 0. Since d2$/dX2 <0, point si represents a relative maximum. Next, we substitute the second point, s2, into H: C^D II II SUBST CB^f Substitute s2 into H Page 1 4-7 The resulting matrix has elements an = d2$/dX2 = 6., a22 = d2$/dX2 = -2., anda12=a21 = 82§/dXdY = 0. The discriminant, for this critical point s2(l ,0) is A = (d2{/dx2y (dVdy2)-[d2t/dxdy]2 = (6.)(-2.) = -1 2.0 < 0, indicating a saddle point. Multiple integrals A physical interpretation of an ordinary integral, f(x)dx, is the area Ja under the curve y = f(x) and abscissas x = a and x = b. The generalization to three dimensions of an ordinary integral is a double integral of a function f(x,y) over a region R on the x-y plane representing the volume of the solid body contained under the surface f(x,y) above the region R. The region R can be described as R = {a<x<b, f(x)<y<g(x)} or as R = {c<y<d, r(y)<x<s(y)}. Thus, the double integral can be written as J*b rg(x) rd rs(y) </>(x,y)dydx = 0(x9y)dydx a J f(x) Jc Jr(y) R Calculating a double integral in the calculator is straightforward. A double integral can be built in the Equation Writer (see example in Chapter 2). An example follows. This double integral is calculated directly in the Equation Writer by selecting the entire expression and using function HEH. The result is 3/2. Step-by-step output is possible by setting the Step/Step option in the CAS MODES screen. 2 ^x+ydy dx4 1 EDIT | CURS I GIG -| EVflL |FACT0| SIHP Page 1 4-8 3-x 2-x+l 2 2 Rat i ona 1 f ract i on EDIT | CURS | GIG -| EVflL |FflCT0| SIHP 3-x~ 2-x+ A. ± 2 2 Rat ional f ract ion 2 X Rat ional f ract ion X Jacobian of coordinate transformation Consider the coordinate transformation x = x(u,v), y = y(u,v). The Jacobian of this transformation is defined as J \= det(J) = det ( 'dx du dv dy dy dv j When calculating an integral using such transformation, the expression to use is ^(/){x,y)dydx = ||^[x(i/,v),^(w,v)] | J \ dudv , where R' is the region R R R' expressed in (u,v) coordinates. Double integral in polar coordinates To transform from polar to Cartesian coordinates we use x(r,0) = r cos 0, and y(r, 0) = r sin 0. Thus, the Jacobian of the transformation is dx dx '~ dy dy_ ~ sin(/9) r • cos(6>) dr dO With this result, integrals in polar coordinates are written as = r Page 14-9 \\<f>{r,6)dA = [ Q<t>{r,0)rdrd6 where the region R' in polar coordinates is R' = {a < 0 < p, f(9) < r < g(0)}. Double integrals in polar coordinates can be entered in the calculator, making sure that the Jacobian | J | = r is included in the integrand. The following is an example of a double integral calculated in polar coordinates, shown step-by- step: r 4 IT ■ I 2 fQ T KJf"fl "1 1 ■ O 1 .J I Je m 8 ■ 9-r Rational fraction r Linearizing ■ 2 TT +2 -1 3216 H Page 14-10 Chapter 1 5 Vector Analysis Applications In this Chapter we present a number of functions from the CALC menu that apply to the analysis of scalar and vector fields. The CALC menu was presented in detail in Chapter 13. In particular, in the DERIV&INTEG menu we identified a number of functions that have applications in vector analysis, namely, CURL, DIV, HESS, LAPL. For the exercises in this Chapter, change your angle measure to radians. Definitions A function defined in a region of space such as (|)(x,y,z) is known as a scalar field, examples are temperature, density, and voltage near a charge. If the function is defined by a vector, i.e., F(x,y,z) = f(x,y,z)i+g(x,y,z)j+h(x,y,z)k, it is referred to as a vector field. The following operator, referred to as the 'del' or 'nabla' operator, is a vector- based operator that can be applied to a scalar or vector function: v[ ]-!•!-[ ]+*—[] ox oy oz When this operator is applied to a scalar function we can obtain the gradient of the function, and when applied to a vector function we can obtain the divergence and the curl of that function. A combination of gradient and divergence produces another operator, called the Laplacian of a scalar function. These operations are presented next. Gradient and directional derivative The gradient of a scalar function (|)(x,y,z) is a vector function defined by grade/) = V(f) = i • — + j- — + k- — dx dy dz The dot product of the gradient of a function with a given unit vector represents the rate of change of the function along that particular vector. This rate of change is called the directional derivative of the function, Du(|)(x,y,z) = u*Vf Page 15-1 At any particular point, the maximum rate of change of the function occurs in the direction of the gradient, i.e., along a unit vector u = V(])/ 1 V(|) | . The value of that directional derivative is equal to the magnitude of the gradient at any point Dmax(|)(x,y,z) = V<\> •V^/ 1 V(|) | = \ The equation (|)(x,y,z) = 0 represents a surface in space. It turns out that the gradient of the function at any point on this surface is normal to the surface. Thus, the equation of a plane tangent to the curve at that point can be found by using a technique presented in Chapter 9. The simplest way to obtain the gradient is by using function DERIV, available in the CALC menu, e.g., A program to calculate the gradient The following program, which you can store into variable GRADIENT, uses function DERIV to calculate the gradient of a scalar function of X,Y,Z. Calculations for other base variables will not work. If you work frequently in the (X,Y,Z) system, however, this function will facilitate calculations: « X Y Z 3 ^ARRY DERIV » Type the program while in RPN mode. After switching to ALG mode, you can call the function GRADIENT as in the following example: GRflD I EHT ( X ^2+ Y A2+Z *2 [2*X,2*Y?2*Z] Using function HESS to obtain the gradient The function HESS can be used to obtain the gradient of a function as shown next. As indicated in Chapter 14, function HESS takes as input a function of Page 1 5-2 n independent variables §(x]f x2, ...,xn)/ and a vector of the functions ['x/ /x2/---/xn/]- Function HESS returns the Hessian matrix of the function defined as the matrix H = [hjj] = [d^/dXjdxj], the gradient of the function with respect to the n-variables, grad f = [ d§/dx}, d$/dx2 , ... d<\>/dxn], and the list of variables ['x/ 'x2'...'xn']. Consider as an example the function §(X,Y,Z) = X2 + XY + XZ, well apply function HESS to this scalar field in the following 6: 5: 4: 3: 2: l: CX Y Z] 3 = 4: 3: [2 1 11 1 0 0 Li e @J 2: [2-X+Y+Z X X] l: [X Y Z] Thus, the gradient is [2X+Y+Z, X, X]. Alternatively, one can use function DERIV as follows: DERIV(XA2+X*Y+X*Z,[X,Y,Z]), to obtain the same result. Potential of a gradient Given the vector field, F(x,y,z) = f(x,y,z)i+g(x,y,z)j+h(x,y,z)k, if there exists a function (|)(x,y,z), such that f = d§/dx, g = d§/dy, and h = d§/dz, then (|)(x,y,z) is referred to as the potential function for the vector field F. It follows that F = grad § = V(|). The calculator provides function POTENTIAL, available through the command catalog (L J cat ), to calculate the potential function of a vector field, if it exists. For example, if F(x,y,z) = xi + yj + zk, applying function POTENTIAL we find: : POTENT I RLCCx y zlCx y z> 2 2 2 Since function SQ(x) represents x2, this results indicates that the potential function for the vector field F(x,y,z) = xi + yj + zk, is (|)(x,y,z) = (x2+y2+z2)/2. Notice that the conditions for the existence of (|)(x,y,z), namely, f = d§/dx, g = d^/dy, and h = d^/dz, are equivalent to the conditions: df/dy = dg/dx, di/dz = d\\/dx, and dg/dz = 5h/5y. These conditions provide a quick way to determine if the vector field has an associated potential function. If one of the conditions di/dy = dg/dx, d\/dz = dh/dx, dg/dz = dh/dy, fails, a potential Page 1 5-3 function <\>(x,y,z) does not exist. In such case, function POTENTIAL returns an error message. For example, the vector field F(x,y,z) = (x+y)i + (x-y+z)j + xzk, does not have a potential function associated with it, since, df/dz ^ dh/dx. The calculator response in this case is shown below: : POTENT I ALCCX+Y X-Y+Z XH 50TEHTIflL<CX+Y,X-Y+Z, <*Z1, [X,Y,Z]> PC A POTENTIAL Error: Bad Argument Value I X> 7 X> "Bad Argument Value" Divergence The divergence of a vector function, F(x,y,z) = f(x,y,z)i+g(x,y,z)j+h(x,y,z)k, is defined by taking a "dot-product" of the del operator with the function, i.e., divF = V.F=V + * + ® dx dy dz Function DIV can be used to calculate the divergence of a vector field. For example, for F(X,Y,Z) = [XY,X2+Y2+Z2,YZ], the divergence is calculated, in ALG mode, as follows: Div([x-Y X2+Y2+Z2 Y-z],[tf Y+2-Y+Y Laplacian The divergence of the gradient of a scalar function produces an operator called the Laplacian operator. Thus, the Laplacian of a scalar function (|)(x,y,z) is given by dx dx dx The partial differential equation V2([) = 0 is known as Laplace's equation. Function LAPL can be used to calculate the Laplacian of a scalar function. For example, to calculate the Laplacian of the function (|)(X,Y,Z) = (X2+Y2)cos(Z), use: Page 1 5-4 LflPL((X^2+Y^2>*C0St:Z 2*C0SCZ> + t:2*C0S(Z> + (X^ 2+V^2>*-C0S(Z>> Curl The curl of a vector field F(x,y,z) = f(x,y,z)i+g(x,y,z)j+h(x,y,z)k, is defined by a "cross-product" of the del operator with the vector field, i.e., curlF = V x F = f[] fu f[] ox qy & /(x, y, z) g(x, y, z) h(x, y, z) = 1 dh 8g) fdf dh dy dz + J dz dx + k dh_dg} dy dz The curl of vector field can be calculated with function CURL. For example, for the function F(X,Y,Z) = [XY,X2+Y2+Z2,YZ], the curl is calculated as follows: : CURl([x-Y X2+Y2+Z2 Y-z]/ [Z-2-Z 0 2-X-X] Irrotational fields and potential function In an earlier section in this chapter we introduced function POTENTIAL to calculate the potential function §(x,y,z) for a vector field, F(x,y,z) = f(x,y,z)i+ g(x,y,z)j+ h(x,y,z)k, such that F = grad ^ = V(|). We also indicated that the conditions for the existence of were: di/dy = dg/dx, d\/dz = dh/dx, and dg/dz = dh/dy. These conditions are equivalent to the vector expression curl F = VxF = 0. A vector field F(x,y,z), with zero curl, is known as an irrotational field. Thus, we conclude that a potential function (|)(x,y,z) always exists for an irrotational field F(x,y,z). Page 1 5-5 As an example, in an earlier example we attempted to find a potential function for the vector field F(x,y,z) = (x+y)i + (x-y+z)j + xzk, and got an error message back from function POTENTIAL. To verify that this is a rotational field (i.e., VxF ^ 0), we use function CURL on this field: CURLCCX+Y X-Y+Z X-Z],[X [-1 -Z 0] On the other hand, the vector field F(x,y,z) = xi + yj + zk, is indeed irrotational as shown below: : CURLCCX+Y X-Y+Z X-Z],[X 'i CURLCCX Y Z],CX Y Z]) C0 0 0] Vector potential Given a vector field F(x,y,z) = f(x,y,z)i+g(x,y,z)j+h(x,y,z)k, if there exists a vector function 0(x,y,z) = ^(x^zji+ii/jx^zjj+r^x^zjk, such that F = curl O = Vx O, then function 0(x,y,z) is referred to as the vector potential of F(x,y,z). The calculator provides function VPOTENTIAL, available through the command catalog (LxU_^z; ), to calculate the vector potential, 0(x,y,z), given the vector field, F(x,y,z) = f(x,y,z)i+g(x,y,z)j+h(x,y,z)k. For example, given the vector field, F(x,y,z) = -(yi+zj+xk), function VPOTENTIAL produces :VP0TEHTinLC-[y ; [•-M-fe z x],Cx *=* y +z-x i.e., 0(x,y,z) = -x2/2j + (-y2/2+zx)k. It should be indicated that there is more than one possible vector potential functions O for a given vector field F. For example, the following screen shot shows that the curl of the vector function ®, = [X2+Y2+Z2,XYZ,X+Y+Z] is the vector F = Vx 02 = [1 -XY,2Z-1 ,ZY-2Y]. Application of function VPOTENTIAL Page 1 5-6 produces the vector potential function 02 = [0, ZYX-2YX, Y-(2ZX-X)], which is different from The last command in the screen shot shows that indeed F = Vx 02. Thus, a vector potential function is not uniquely determined. : CURliLx +Y +Z X-Y-Z X+? El -X-Y 2-Z-l Z-Y-2-Y] :VPOTENTIflL(flNSmiX Y Z> [0 Z-Y-X-2-Y-X Y-C2-^X-X)] :CURL(flHS(lUX Y Z]) Hl-Y-X Z-2-1 Y-Z-Y-2] The components of the given vector field, F(x,y,z) = f(x,y,z)i+g(x,y,z)j +h(x,y,z)k, and those of the vector potential function, ®(x,y,z) = (|)(x,y,z)i+\|/(x,y,z)i+r|(x,y,z)k, are related by f = dr\/dy - dy/dx, g = dfy/dz - dr\/dx, and h = d\\r/dx - d<\>/dy. A condition for function ®(x,y,z) to exists is that div F = V*F = 0, i.e., d\/dx + dg/dy + di/dz = 0. Thus, if this condition is not satisfied, the vector potential function 0(x,y,z) does not exist. For example, given F = [X+Y,X-Y,ZA2], function VPOTENTIAL returns an error message, since function F does not satisfy the condition V*F = 0: 21 VPOTENTIfll_([x+Y X-Y Z' 4P0TEHT I FlL < I X+Y ? X-Y ? Z '21, [X?Y?Z]> \SWI?M +GEL DEL-* DEL L ins A ^POTENTIAL Error: Bad Argument Value VF VF "Bad Rrgu ment Value z2i ,21 The condition V*F ^ 0 is verified in the following screen shot: : DI v(Lx+Y X-Y Z2],CX Y Z]), 1+-1+2-Z Page 1 5-7 Chapter 1 6 Differential Equations In this Chapter we present examples of solving ordinary differential equations (ODE) using calculator functions. A differential equation is an equation involving derivatives of the independent variable. In most cases, we seek the dependent function that satisfies the differential equation. Basic operations with differential equations In this section we present some uses of the calculator for entering, checking and visualizing the solution of ODEs. Entering differential equations The key to using differential equations in the calculator is typing in the derivatives in the equation. The easiest way to enter a differential equation is to type it in the equation writer. For example, to type the following ODE: (x-1 )-(dy(x)/dx)2 + 2xy(x) = ex sin x, use: CB^w ED QD(S CEDCD CDCDCD(X)CB^ S™)ED(3 CD^lQDiSQD^ SQDSCDCD CZDCTD CDCDmtXJCX} (^)C5D (3 QD (^QD 0 QD^SEDO CDCDCDCD The derivative dy/dx is represented by 9x(y(x)) or by dly(x). For solution or calculation purposes, you need to specify y(x) in the expression, i.e., the dependent variable must include its independent variable(s) in any derivative in the equation. You can also type an equation directly into the stack by using the symbol d in the derivatives. For example, to type the following ODE involving second- order derivatives: d2u(x)/dx2 + 3-u(x)-(du(x)/dx) + u(x)2 = 1/x, directly into the screen, use: C3!L_ (^QD(3CDCDCDGJ(X)(X)e™) QD^CTl^ (^CT(3CDCxJC3 3(^C3D(3GI3 (l (^(20(3 ^ _ (^CSO CD CD CBt^CSOCSD y_ (^GDOCD CZDCZD C3 = CDS (AL^[^3(X}(ENTER) Page 16-1 The result is 'dx (3x (u (x) ) ) +3*u (x) *dx (u (x) ) +uA2=i/x '. This format shows up in the screen when the _Textbook option in the display setting ([mode) lllli!) is not selected. Press <\j? to see the equation in the Equation Writer. An alternative notation for derivatives typed directly in the stack is to use 'dl' for the derivative with respect to the first independent variable, '62' for the derivative with respect to the second independent variable, etc. A second- order derivative, e.g., d2x/dt2, where x = x(t), would be written as 'd 1 d 1 x(t)// while (dx/dt)2 would be written 'dlx(t)A2'. Thus, the PDE d2y/dt2 - g(x,y)- (d2y/dx2)2 = r(x,y), would be written, using this notation, as 'd2d2y(x,t)- g(x,y)*dldly(x,t)A2=r(x,y)'. The notation using 'd' and the order of the independent variable is the notation preferred by the calculator when derivatives are involved in a calculation. For example, using function DERIV, in ALG mode, as shown next DERIV('x*f(x,t)+g(t,y) = h(x,y,t)/,t), produces the following expression: 'x*d2f (x, t) +dlg (t, y) =d3h (x, y, t) '. Translated to paper, this expression represents the partial differential equation x-(df/dt) + dg/d\ = dh/dt. Because the order of the variable t is different in f(x,t), g(t,y), and h(x,y,t), derivatives with respect to t have different indices, i.e., d2f(x,t), dlg(t,y), and d3h(x,y,t). All of them, however, represent derivatives with respect to the same variable. Expressions for derivatives using the order-of-variable index notation do not translate into derivative notation in the equation writer, as you can check by pressing while the last result is in stack level 1 . However, the calculator understands both notations and operates accordingly regarding of the notation used. Checking solutions in the calculator To check if a function satisfy a certain equation using the calculator, use function SUBST (see Chapter 5) to replace the solution in the form 'y = {(x)' or 'y = f(x,t)', etc., into the differential equation. You may need to simplify the Page 1 6-2 result by using function EVAL to verify the solution. For example, to check that u = A sin coDt is a solution of the equation d2u/dt2 + co02-u = 0, use the following: In ALG mode: SUBST('dt(dt(u(t)))+ coOA2*u(t) = 0','u(t)=A*SIN (coO*t)') [enter} EVAL(ANS(1))S In RPN mode: 'dt(dt(u(t)))+ C00A2*u(t) = 0' (ENTER) 'u(t)=A*SIN (a>0*t)' {enter} SUBS'!" EVflL The result is '0=0'. For this example, you could also use: 'dt(dt(u(t))))+ coOA2*u(t) = 0' to enter the differential equation. Slope field visualization of solutions Slope field plots, introduced in Chapter 1 2, are used to visualize the solutions to a differential equation of the form dy/dx = f(x,y). A slope field plot shows a number of segments tangential to the solution curves, y = f(x). The slope of the segments at any point (x,y) is given by dy/dx = f(x,y), evaluated at any point (x,y), represents the slope of the tangent line at point (x,y). Example 1 - Trace the solution to the differential equation y' = f(x,y) = sin x cos y, using a slope field plot. To solve this problem, follow the instructions in Chapter 1 2 for slopefield plots. If you could reproduce the slope field plot in paper, you can trace by hand lines that are tangent to the line segments shown in the plot. This lines constitute lines of y(x,y) = constant, for the solution of y' = f(x,y). Thus, slope fields are useful tools for visualizing particularly difficult equations to solve. In summary, slope fields are graphical aids to sketch the curves y = g(x) that correspond to solutions of the differential equation dy/dx = f(x,y). Page 1 6-3 The CALC/DIFF menu The DIFFERENTIAL EQNS.. sub-menu within the CMC (C5DS^_ ) menu provides functions for the solution of differential equations. The menu is listed below with system flag 1 1 7 set to CHOOSE boxes: hhp: HERU 1. DERIY. ft iriTEG . .. 2. LIHITS SERIES.. 3 . DIFFERERTIAL EGRS.. H . GRAPH.. 5.DERVK 6.IRTYK DIFFERERTIAL EGRS HERU a.iLRp 3 . LAP H.LDEC 5 . CALCULUS.. These functions are briefly described next. They will be described in more detail in later parts of this Chapter. DESOLVE: Differential Equation SOLVEr, provides a solution if possible ILAP: Inverse LAPlace transform, L1[F(s)] = f(t) LAP: LAPlace transform, L[f(t)]=F(s) LDEC: solves Linear Differential Equations with Constant coefficients, including systems of differential equations with constant coefficients Solution to linear and non-linear equations An equation in which the dependent variable and all its pertinent derivatives are of the first degree is referred to as a linear differential equation. Otherwise, the equation is said to be non-linear. Examples of linear differential equations are: d2x/dt2 + p«(dx/dt) + co0-x = A sin cof t, and dC/d\ + u-(3C/3x) = D-(d2C/dx2). An equation whose right-hand side (not involving the function or its derivatives) is equal to zero is called a homogeneous equation. Otherwise, it is called non-homogeneous. The solution to the homogeneous equation is known as a general solution. A particular solution is one that satisfies the non- homogeneous equation. Page 1 6-4 Function LDEC The calculator provides function LDEC (Linear Differential Equation Command) to find the general solution to a linear ODE of any order with constant coefficients, whether it is homogeneous or not. This function requires you to provide two pieces of input: • the right-hand side of the ODE • the characteristic equation of the ODE Both of these inputs must be given in terms of the default independent variable for the calculator's CAS (typically 'X'). The output from the function is the general solution of the ODE. The function LDEC is available through in the CALC/DIFF menu. The examples are shown in the RPN mode, however, translating them to the ALG mode is straightforward. Example 1 - To solve the homogeneous ODE: d3y/dx3-4-(d2y/dx2)- 1 1 -(dy/dx)+30-y = 0, enter: 0 [enter} 5 vr3 4*XA2- 1 1 *X+30 5 (enter) LDEC. The solution is: frcCJ-<cCi»cCZ) 5-K iP'CCJ-<7.cCi-cCZ) -<3.K) 15.cCJ»Z.cCi-cCZ ;-k zh * + hd * + is * where cCO, cCl, and cC2 are constants of integration. While this result seems very complicated, it can be simplified if we take K1 = (10*cC0-(7+cC1-cC2))/40, K2 = -(6*cC0-(cC1+cC2))/24, and K3 = (15*cC0+(2*cC1-cC2))/15. Then, the solution is y = Kre-3x+ K2-e5x+ K3-e2x. The reason why the result provided by LDEC shows such complicated combination of constants is because, internally, to produce the solution, LDEC utilizes Laplace transforms (to be presented later in this chapter), which transform the solution of an ODE into an algebraic solution. The combination Page 1 6-5 of constants result from factoring out the exponential terms after the Laplace transform solution is obtained. Example 2 - Using the function LDEC, solve the non-homogeneous ODE: " " d3y/dx3-4.(d2y/dx2)-l 1 -(dy/dx)+30.y = x2. Enter: 5 2 5 {enter) 5 X 3 4 * X 2 ■■■■■ 1 i * X + 3 0 s (enter) L D E C The solution, shown partially here in the Equation Writer, is: ?50.cciKia5.ca+ia5.cca+a) 5-k a70.cco-(i33.cCi-£ar.cca-a» -O-h) H50.Ka*EflK+aHi t 3000 10S0 Replacing the combination of constants accompanying the exponential terms with simpler values, the expression can be simplified to y = Kre"3x + K2-e5x + K3-e2x+ (450-x2+330-x+241)/13500. We recognize the first three terms as the general solution of the homogeneous equation (see Example 1, above). If yh represents the solution to the homogeneous equation, i.e., yh = Kre"3x + K2-e5x + K3-e2x. You can prove that the remaining terms in the solution shown above, i.e., yp = (450-x2+330-x+241 )/l 3500, constitute a particular solution of the ODE. Note: This result is general for all non-homogeneous linear ODEs, i.e., given the solution of the homogeneous equation, yh(x), the solution of the corresponding non-homogeneous equation, y(x), can be written as yM = yh(x) + yp(x), where yp(x) is a particular solution to the ODE. To verify that yp = (450-x2+330-x+241 )/l 3500, is indeed a particular solution of the ODE, use the following: s d 1 d 1 d 1 V C X > 4*d 1 d 1 V < X > - 1 1 *d 1 Y < X > +30* Y < X > = X A2 s (^) 5 Y C X > ::::: C 45B*X A2+330*X+24 1 > 1 3588 5 (enter) =:::= ■:::: \ v ni_ Page 1 6-6 Allow the calculator about ten seconds to produce the result: 'XA2 = XA2\ Example 3 - Solving a system of linear differential equations with constant coefficients. Consider the system of linear differential equations: x/(t) + 2x2'(t) = a 2x1'(t) + x2'(t) = 0. [1 2\ In algebraic form, this is written as: A-x'(t) = 0, where A = . The system can be solved by using function LDEC with arguments [0,0] and matrix A, as shown in the following screen using ALG mode: RflD KYI HEM f;= [HOME]- ALG LDEC([@ 0],[^ f ]] cVl+cV2 3-X, cVl-cV2 : ~, '8 + ~, The solution is given as a vector containing the functions [x^t), x2(t)]. Pressing ^▼7 will trigger the Matrix Writer allowing the user to see the two components of the vector. To see all the details of each component, press the illlilllili soft menu key. Verify that the components are: < c V 1 +c V£ V£*EXP < 3*X > + (cVl-cV2V2*EXP(-X> < c V 1 +c V£ V£*EXP < 3*X > - (cVl-cV2V2*EXP(-X> H'MII'JVmilM'lllM'Hffl'HJEl H'MII'JVmilM'lllM'Hffl'HJEl Function DESOLVE The calculator provides function DESOLVE (Differential Equation SOLVEr) to solve certain types of differential equations. The function requires as input the differential equation and the unknown function, and returns the solution to the equation if available. You can also provide a vector containing the differential equation and the initial conditions, instead of only a differential equation, as input to DESOLVE. The function DESOLVE is available in the CALC/DIFF menu. Examples of DESOLVE applications are shown below using RPN mode. Example 1 - Solve the first-order ODE: Page 1 6-7 dy/dx + x2-y(x) = 5. In the calculator use: 'dlytxJ+x^S^ytx^S' [enter) 1 y(x) 5 [enter) DESOLVE The solution provided is {'y (INT(5*EXP(xtA3/3)/xt/x)+cC0)*l/EXP(xA3/3)), }, i.e., y{x) = exp(-x3 / 3) • ( J5 • exp(x3 /3)-dx + cC0 ) The variable ODETYPE You will notice in the soft-menu key labels a new variable called EESB (ODETYPE). This variable is produced with the call to the DESOL function and holds a string showing the type of ODE used as input for DESOLVE. Press IMlXii to obtain the string "lit order linear". Example 2 -- Solve the second-order ODE: d2y/dx2 + x (dy/dx) = exp(x). In the calculator use: 'd I d 1 y C x ) +x*d 1 y 5-! x ) ::::: EXP £ x ) ' (enter) 'y (m x y ' [enter) DESOLVE The result is an expression having two implicit integrations, namely, l: y(x)=II)T in t e 2 mi For this particular equation, however, we realize that the left-hand side of the equation represents d/dx(x dy/dx), thus, the ODE is now written: d/ dx(x dy/ dx ) = exp x, and x dy/dx = exp x + C. Page 1 6-8 Next, we can write dy/dx = (C + exp x)/x = C/x + ex/x. In the calculator, you may try to integrate: 'd 1 y (. x > ===== ( C + EXP C x > ) .■- x ' (^D 'y < x > 7 (enter) DESOL VE The result is { 'yM = INT((EXP(xt)+C)/xt,xt,x)+CO, }, i.e., j(x) = f • - + — dx + C0 J x Performing the integration by hand, we can only get it as far as: y(x) <ix + C-lnx + C0 J x because the integral of exp(x)/x is not available in closed form. Example 3 - Solving an equation with initial conditions. Solve d2y/dt2 + 5y = 2 cos(t/2), with initial conditions y(0) = 1 .2, y'(0) = -0.5. In the calculator, use: ['dldly(t)+5*y(t) = 2*COS(t/2)' 'y(O) = 6/5' /d]y(0) = -1/2'] [enter} 'y(t)' ^) DESOLVE Notice that the initial conditions were changed to their Exact expressions, 'y(O) = 6/5', rather than /y(0)=1.2,/ and 'dly(O) = -1/2', rather than, 'dly(O) = - 0.5'. Changing to these Exact expressions facilitates the solution. Note: To obtain fractional expressions for decimal values use function ->Q (See Chapter 5). Page 1 6-9 The solution is: 4 'y<t>=cos<t*a^2>>* <B^I9> + <C0S<t*J"5>*<< 95*<6^5>+-40V95>+-l^ 2*<J"5*19V95*SIN<t*J"5 > ::■ 1 EHMHEZEgEgliaaiEig] Press (W)(W)to simplify the result to 'y(t) = -((19*V5*SIN(V5*tH148*COS(V5*t)+80*COS(t/2)))/190),. Press C^D EEOEQ to get the string "Linear w/ est coef f " for the ODE type in this case. Laplace Transforms The Laplace transform of a function f(t) produces a function F(s) in the image domain that can be utilized to find the solution of a linear differential equation involving f(t) through algebraic methods. The steps involved in this application are three: 1 . Use of the Laplace transform converts the linear ODE involving f(t) into an algebraic equation. 2. The unknown F(s) is solved for in the image domain through algebraic manipulation. 3. An inverse Laplace transform is used to convert the image function found in step 2 into the solution to the differential equation f(t). Definitions The Laplace transform for function f(t) is the function F(s) defined as L{f(t)} = F(s)=[f(t)-e-s'dt. The image variable s can be, and it generally is, a complex number. Many practical applications of Laplace transforms involve an original function f(t) where t represents time, e.g., control systems in electric or hydraulic Page 16-10 circuits. In most cases one is interested in the system response after time t>0, thus, the definition of the Laplace transform, given above, involves an integration for values of t larger than zero. The inverse Laplace transform maps the function F(s) onto the original function f(t) in the time domain, i.e., L "^(s)} = f(t). The convolution integral or convolution product of two functions f(t) and g(t), where g is shifted in time, is defined as (f*g)(t) = \j{u)-g{t-u)-du. Laplace transform and inverses in the calculator The calculator provides the functions LAP and ILAP to calculate the Laplace transform and the inverse Laplace transform, respectively, of a function f(VX), where VX is the CAS default independent variable, which you should set to 'X'. Thus, the calculator returns the transform or inverse transform as a function of X. The functions LAP and ILAP are available under the CALC/DIFF menu. The examples are worked out in the RPN mode, but translating them to ALG mode is straightforward. For these examples, set the CAS mode to Real and Exact. Example 1 - You can get the definition of the Laplace transform use the following: TOO' (enter) LAP in RPN mode, or LflPCf <X )) in ALG mode. The calculator returns the result (RPN, left; ALG, right): fttUe (U,X)dtt 0 LflPCf (XH fltOe CU,X3dU 0 Compare these expressions with the one given earlier in the definition of the Laplace transform, i.e., L{f(t)} = F(s)=[f(t)-e-stdt, and you will notice that the CAS default variable X in the equation writer screen replaces the variable s in this definition. Therefore, when using the Page 16-11 function LAP you get back a function of X, which is the Laplace transform of f(X). Example 2 - Determine the Laplace transform of f(t) = e2t-sin(t). Use: 'EXP(2*X)*SIN(X)' (enter) LAP The calculator returns the result: l/(SQ(X-2)+l ). Press (Ml) to obtain, l/(X2-4X+5). When you translate this result in paper you would write F(s) = L{e2t-smt} = ^^ s2 -4-s + 5 Example 3 - Determine the inverse Laplace transform of F(s) = sin(s). Use: 'SIN(X)' (enter) ILAP. The calculator takes a few seconds to return the result: /ILAP(SIN(X))// meaning that there is no closed-form expression f(t), such that f(t) = L-{sin(s)}. Example 4 - Determine the inverse Laplace transform of F(s) = 1/s3. Use: '1/XA3' (enter) ILAP (eval). The calculator returns the result: /XA2/2,/ which is interpreted as L ^{l/s3} = t2/2. Example 5 - Determine the Laplace transform of the function f(t) = cos (a-t+b). Use: 'COS(a*X+b)' (enter) LAP . The calculator returns the result: Press (Ml) to obtain -(a sin(b) - X cos(b))/(X2+a2). The transform is interpreted as follows: L {cos(a-t+b)} = (s-cos b - a-sin b)/(s2+a2). Laplace transform theorems To help you determine the Laplace transform of functions you can use a number of theorems, some of which are listed below. A few examples of the theorem applications are also included. • Differentiation theorem for the first derivative. Let fG be the initial condition for f(t), i.e., f(0) = f0, then Page 16-12 L{df/dt} = s-F(s) - f0. Example 1 - The velocity of a moving particle v(t) is defined as v(t) = dr/dt, where r = r(t) is the position of the particle. Let rG = r(0), and R(s) =L{r(t)}, then, the transform of the velocity can be written as V(s) = L{v(t)}=L{dr/dt}= s-R(s)-rQ. • Differentiation theorem for the second derivative. Let fQ = f(0), and (df/dt)D = df/dt 1 1=0, then L{d2f/dt2} = s2-F(s) - s-f0 - (df/dt) c. Example 2 - As a follow up to Example 1 , the acceleration a(t) is defined as a(t) = d2r/dt2. If the initial velocity is v0 = v(0) = dr/dt |t=0/ then the Laplace transform of the acceleration can be written as: A(s) = L{a(t)} = L{d2r/dt2}= s2-R(s) - s-r0 - vc. • Differentiation theorem for the n-th derivative. Let f M, = dkf/dxk 1 1 = o, and fG = f(0), then L{dnf/dtn} = sn-F(s) - snl.f0 s.f(n2)0 - f (nl) 0. • Linearity theorem. L{af(t)+bg(t)} = a-L{f(t)} + b-L{g(t)}. • Differentiation theorem for the image function. Let F(s) = L{f(t)}, then dnF/dsn = L{(-t)n.f(t)}. Example 3 - Let f(t) = e~at, using the calculator with 'EXP(-a*X)' [enter} LAP, you get 'l/(X+a)', or F(s) = l/(s+a). The third derivative of this expression can be calculated by using: X (enter} [^J d X^JCB a X (enter} [^J d (Ml) The result is '-6/(XA4+4*a*XA3+6*aA2*XA2+4*aA3*X+aA4)/, or d3F/ds3 = -6/(s4+4-a.s3+6.a2.s2+4.a3.s+a4). Page 16-13 Now, use '(-X)A3*EXP(-a*X)' gg) LAP The result is exactly the same- Integration theorem. Let F(s) = L{f(t)}, then \-\\'f(u)du ■F(s). • Convolution theorem. Let F(s) = L{f(t)} and G(s) = L{g(t)}, then Example 4 - Using the convolution theorem, find the Laplace transform of (f*g)(t), if f(t) = sin(t), and g(t) = exp(t). To find F(s) = L{f(t)}, and G(s) = L{g(t)}, use: 'SIN(X)'^) LAP (W). Result, '1/(XA2+1)', i.e., F(s) = l/(s2+l). Also, 'EXP(X)'(^] LAP. Result, 'V(X-l)', i.e., G(s) = l/(s-l). Thus, L{(f*g)(t)} = F(s)G(s) = l/(s2+l)-l/(s-l) = l/((s-l)(s2+l)) = l/(s3-s2+s-l). • Shift theorem for a shift to the right. Let F(s) = L{f(t)}, then • Shift theorem for a shift to the left. Let F(s) = L{f(t)}, and a >0, then • Similarity theorem. Let F(s) = L{f(t)}, and a>0, then L{f(a-t)} = (l/a)-F(s/a). • Damping theorem. Let F(s) = L{f(t)}, then L{e-bl-f(t)} = F(s+b). • Division theorem. Let F(s) = L{f(t)}, then L{f(t)}-L{g(t)} = F(s)-G(s) L{f(t-a)}=e-as-L{f(t)} = e^-Ffs). Page 16-14 Laplace transform of a periodic function of period T: L{/(0> = l-e sT ■lf(t)-e-s> -dt. Limit theorem for the initial value: Let F(s) = L{f(t)}, then /0=lim/(0 = lim[*-F(5)]. Limit theorem for the final value: Let F(s) = L{f(t)}, then /00=lim/(0 = lim[5-F(j)]. f-»00 S— »0 Dirac's delta function and Heaviside's step function In the analysis of control systems it is customary to utilize a type of functions that represent certain physical occurrences such as the sudden activation of a switch (Heaviside's step function, H(t)) or a sudden, instantaneous, peak in an input to the system (Dirac's delta function, 8(t)). These belong to a class of functions known as generalized or symbolic functions [e.g., see Friedman, B., 1956, Principles and Techniques of Applied Mathematics, Dover Publications Inc., New York (1 990 reprint) ]. The formal definition of Dirac's delta function, 5(x), is 8(x) = 0, for x ^0, and Also, if f(x) is a continuous function, then f(x)S(x — x0)dx = f(x0). '-GO Page 16-15 An interpretation for the integral above, paraphrased from Friedman (1990), is that the 8-function "picks out" the value of the function f(x) at x = x0. Dirac's delta function is typically represented by an upward arrow at the point x = xO, indicating that the function has a non-zero value only at that particular value of x0. Heaviside's step function, H(x), is defined as H(x) = 1, x>0 0, x<0 Also, for a continuous function f(x), / {x)H(x - x0 )dx = f (x)dx. J -co Jx0 Dirac's delta function and Heaviside's step function are related by dH/dx 8(x). The two functions are illustrated in the figure below. You can prove that L{H(t)} = 1/s, from which it follows that L{U0-H(t)} = U0/s, where U0 is a constant. Also, L ^{l/sJ^H^), and L-MUo/s^lVHW. Also, using the shift theorem for a shift to the right, L{f(t-a)}=e"°s-L{f(t)} = e^-F(s), we can write L{H(t-k)}=e-b L{H(t)} = e^-(l/s) = (l/s)-e"ks. Page 16-16 Another important result, known as the second shift theorem for a shift to the right is that L •F(s)}=f(t-a)-H(t-a), with F(s) = L{f(t)}. In the calculator the Heaviside step function H(t) is simply referred to as '1 '. To check the transform in the calculator use: L / J LENTER) LAP. The result is '1/X', i.e., L{1} = 1/s. Similarly, W [enter] LAP , produces the result /U0/X,/ i.e., L{U0} = U0/s. You can obtain Dirac's delta function in the calculator by using: Ij^[enter) ILAP The result is 'Delta (X) '. This result is simply symbolic, i.e., you cannot find a numerical value for, say 'Delta (5) '. This result can be defined the Laplace transform for Dirac's delta function, because from L .0}= 5(t), it follows that L{5(t)} = 1 .0 Also, using the shift theorem for a shift to the right, L{f(t-a)}=e"as-L{f(t)} = e-as-F(s), we can write L{5(t-k)}=e-ks-L{5(t)} = e"ks-l .0 = e"ks. Applications of Laplace transform in the solution of linear ODEs At the beginning of the section on Laplace transforms we indicated that you could use these transforms to convert a linear ODE in the time domain into an algebraic equation in the image domain. The resulting equation is then solved for a function F(s) through algebraic methods, and the solution to the ODE is found by using the inverse Laplace transform on F(s). The theorems on derivatives of a function, i.e., L{df/dt} = s-F(s) - fo; L{d2f/dt2} = s2 F{s) - s-f0 - (df/dt) 0, and, in general, L{dnf/dtn} = sn.F(s) - snl-f0 s.f(n2)0 - f (nl) G, are particularly useful in transforming an ODE into an algebraic equation. Page 16-17 Example 1 - To solve the first order equation, dh/dt + k-h(t) = a-e"', by using Laplace transforms, we can write: L{dh/dt + k-h(t)} = Lja-e"'}, L{dh/dt} + k-L{h(t)} = a-Lje"1}. Note: 'EXP(-X)' gg) LAP , produces /1/(X+1)/, i.e., L{e-f }=1/(s+1). With H(s) = L{h(t)}, and L{dh/dt} = s-H(s) - hG, where hG = h(0), the transformed equation is s-H(s)-h0+k-H(s) = a/(s+l). Use the calculator to solve for H(s), by writing: /X*H-hO+k*H=a/(X+l),(^) 'H' ISOL The result is 'H=((X+1 )*hO+a)/(XA2+(k+l )*X+k)'. To find the solution to the ODE, h(t), we need to use the inverse Laplace transform, as follows: OBJ-> CS L^Jti^J Isolates right-hand side of last expression ILAP Obtains the inverse Laplace transform a-ek'X+»k-D-ho-a)-eX X k 'X The result is (k-l)-e -e . Replacing X with t in this expression and simplifying, results in h(t) = a/(k-l )-e"f +((k-l )-h0-a)/(k-l )-e"kt. Check what the solution to the ODE would be if you use the function LDEC: /a*EXP(-X)/ [enter} 'X+k' [enter} LDEC (W) Page 16-18 a-ek'X+»k-l)-cCB-a)-eX The result is: Ck-13-eX-ek'X / i.e., h(t) = a/(k-l).e4 +((k-l).cC0-a)/(k-l).ekt. Thus, cCO in the results from LDEC represents the initial condition h(0). Note: When using the function LDEC to solve a linear ODE of order n in f(X), the result will be given in terms of n constants cCO, cCl, cC2, cC(n-l), representing the initial conditions f(0), f'(0), {"(0), f(n1) (0). Example 2 - Use Laplace transforms to solve the second-order linear equation, d2y/dt2+2y = sin 3t- Using Laplace transforms, we can write: L{d2y/dt2+2y} = L{sin 3t}, L{d2y/dt2} + 2 L{y(t)} = L{sin 3t}. Note: 'SIN(3*X)'(^) LAP (W) produces '3/(XA2+9)', i.e., Ljsin 3t}^3/(s2+9). With Y(s) = L{y(t)}, and L{d2y/dt2} = s2-Y(s) - s-y0 - yl7 where yG = h(0) and Yl = W(0), the transformed equation is s2-Y(s)-s-y0-y1 + 2-Y(s) = 3/(s2+9). Use the calculator to solve for Y(s), by writing: /XA2*Y-X*y0-yl+2*Y=3/(XA2+9),(^) 'Y' ISOL The result is fY=((XA2+9^y1+(y0*XA3+9*y0*X+3))/(XA4+1rXA2+18)^ Page 16-19 To find the solution to the ODE, y(t), we need to use the inverse Laplace transform, as follows: OBJ-> 1_4J L*J Isolates right-hand side of last expression ILAPd^T) Obtains the inverse Laplace transform The result is (7'Jg'yl+3'Jg)siH(^ 14 i.e., y(t) = -(1/7) sin 3x + yQ cos V2x + (V2 (7Yl+3)/14) sin V2x. Check what the solution to the ODE would be if you use the function LDEC: 'SIN(3*X)'(^) 'XA2+2'(£!3) LDEC d^T) The result is: (7'J?'cCl+3'J?)'SIN(^^ 14 i.e., the same as before with cCO = yO and cCl = yl . Note: Using the two examples shown here, we can confirm what we indicated earlier, i.e., that function ILAP uses Laplace transforms and inverse transforms to solve linear ODEs given the right-hand side of the equation and the characteristic equation of the corresponding homogeneous ODE. Example 3 - Consider the equation d2y/dt2+y = 8(t-3), where 8(t) is Dirac's delta function. Using Laplace transforms, we can write: L{d2y/dt2+y} = L{S(t-3)}, Page 1 6-20 L{d2y/dt2} + L{y(t)} = L{5(t-3)}. With 'Delta (x-3)' (enter) LAP , the calculator produces EXP(-3*X), i.e., L{8(t-3)} = e"3s. With Y(s) = L{y(t)}, and L{d2y/dt2} = s2-Y(s) - s-y0 - yl7 where yG = h(0) and y} = h'(0), the transformed equation is s2-Y(s) - s-y0 - yi + Y(s) = e"3s. Use the calculator to solve for Y(s), by writing: 'XA2*Y-X*yO-yl +Y=EXP(-3*X)' 'Y' ISOL The result is 'Y=(X*yO+(yl +EXP(-(3*X))))/(XA2+1 )'. To find the solution to the ODE, y(t), we need to use the inverse Laplace transform, as follows: OBJ-> L*J Isolates right-hand side of last expression ILAP (evalJ Obtains the inverse Laplace transform The result is 'yl *SIN(X)+yO*COS(X)+SIN(X-3)*Heaviside(X-3),. Notes: [1 ]. An alternative way to obtain the inverse Laplace transform of the expression /(X*yO+(yl +EXP(-(3*X))))/(XA2+1 )' is by separating the expression into partial fractions, i.e., 'yO*X/(XA2+l) + yl/(XA2+l) + EXP(-3*X)/(XA2+1 )', and use the linearity theorem of the inverse Laplace transform L 1{a.F(s)+b-G(s)} = a-L 1{F(s)} + b-L ]{G(s)}, to write, L -i{yo.s/(s2+l )+yi/(s2+l )) + e-V(s2+l )) } = y0-L 1 {s/(s2+ 1 )}+ y, -L 1 { 1 /(s2+ 1 )}+ L 1 {e-3V(s2+ 1 ))}, Then, we use the calculator to obtain the following: Page 16-21 'X/(XA2+1 )' ILAP Result, 'COS(X)', i.e., L VfAl )}= cos t. '1/(XA2+1)'^) ILAP Result, 'SIN(X)', i.e., L ]{1 /(s2+l )}= sin t. 'EXP(-3*X)/(XA2+1 )' (mh) ILAP Result, SIN(X-3)*Heaviside(X-3)'. [2]. The very last result, i.e., the inverse Laplace transform of the expression '(EXP(-3*X)/(XA2+1))', can also be calculated by using the second shifting theorem for a shift to the right L-1{e-.F(s)}=Kt-a)-H(t-a)l if we can find an inverse Laplace transform for l/(s2+l). With the calculator, try /1/(XA2+1)/ (enter) ILAP. The result is 'SIN(X)'. Thus, L V^/V+l ))} = sin(t-3)-H(t-3), Check what the solution to the ODE would be if you use the function LDEC: 'Delta(X-3)' (enter) 'Xa2+1'(^ LDEC Qw) The result is: ySIN(X-3)*Heaviside(X-3) + cCl *SIN(X) + cC0*COS(X)+'. Please notice that the variable X in this expression actually represents the variable t in the original ODE. Thus, the translation of the solution in paper may be written as: y{f) = Co • cosf + Q • sin/ +sin(7 - 3) • H(t - 3) When comparing this result with the previous result for y(t), we conclude that cC0 = y0, cCt = y!. Page 16-22 Defining and using Heaviside's step function in the calculator The previous example provided some experience with the use of Dirac's delta function as input to a system (i.e., in the right-hand side of the ODE describing the system). In this example, we want to use Heaviside's step function, H(t). In the calculator we can define this function as: 'H(X) = IFTE(X>0, 1, 0)' {enter)[^Jde^_ This definition will create the variable in the calculator's soft menu key. Example 1 - To see a plot of H(t-2), for example, use a FUNCTION type of plot (see Chapter 1 2): • Press C3D J^, , simultaneously in RPN mode, to access to the PLOT SETUP window. > Change type to function, if needed > Change EQ to 'H(X-2)'. > Make sure that indep is set to 'X'. > Press [nxt) BQIHto return to normal calculator display. • Press LjnJ ML , simultaneously, to access the PLOT window. > Change the H-VIEW range to 0 to 20, and the V-VIEW range to -2 to 2. > Press D333 to plot the function . Use of the function H(X) with LDEC, LAP, or ILAP, is not allowed in the calculator. You have to use the main results provided earlier when dealing with the Heaviside step function, i.e., L{H(t)} = 1/s, L ^{l /s}=H(t), L{H(t-k)}=e-ks L{H(t)} = e-ks.(l/s) = -(l/sj-e^ and L V05 -F(s)}=f(t-a).H(t-a). Example 2 - The function H(t-tG) when multiplied to a function f(t), i.e., H(t-t0)f(t), has the effect of switching on the function f(t) at t = tQ. For example, the solution obtained in Example 3, above, was y(t) = yG cos t + y} sin t + sin(t- 3)-H(t-3). Suppose we use the initial conditions yG = 0.5, and y! = -0.25. Let's plot this function to see what it looks like: • Press UnJi^ , simultaneously if in RPN mode, to access to the PLOT SETUP window. Page 16-23 > Change type to function, if needed > Change EQ to /0.5*COS(X)-0.25*SIN(X)+SIN(X-3)*H(X-3)/. > Make sure that indep is set to 'X'. > Press ylilLiii Em to plot the function. > Press Mm (W) EMM to see the plot. The resulting graph will look like this: Notice that the signal starts with a relatively small amplitude, but suddenly, at t=3, it switches to an oscillatory signal with a larger amplitude. The difference between the behavior of the signal before and after t = 3 is the "switching on" of the particular solution yp(t) = sin(t-3)-H(t-3). The behavior of the signal before t = 3 represents the contribution of the homogeneous solution, yh(t) = yQ cos t + y} sin t. The solution of an equation with a driving signal given by a Heaviside step function is shown below. Example 3 - Determine the solution to the equation, d2y/dt2+y = H(t-3), where H(t) is Heaviside's step function. Using Laplace transforms, we can write: L{d2y/dt2+y} = L{H(t-3)}, L{d2y/dt2} + L{y(t)} = L{H(t-3)}. The last term in this expression is: L{H(t-3)} = (l/s)-e-3s. With Y(s) = L{y(t)}, and L{d2y/dt2} = s2-Y(s) - s-yQ - y]f where yG = h(0) and y! = h'(0), the transformed equation is s2-Y(s) - s-yQ - yi + Y(s) = (l/s)-e"3s. Change CAS mode to Exact, if necessary. Use the calculator to solve for Y(s), by writing: To find the solution to the ODE, y(t), we need to use the inverse Laplace transform, as follows: /XA2*Y-X*yO-yl+Y=(l/X)*EXP(-3*X),(^ 'Y' ISOL The result is 'YHXA2>0+X>1+EXP(-3*X))/(XA3+X)'. Page 1 6-24 OBJ^ 3D 3D ILAP Isolates right-hand side of last expression Obtains the inverse Laplace transform The result is 'yl *SIN(X-1 )+yO*COS(X-l )-(COS(X-3)-l )*Heaviside(X-3)'. Thus, we write as the solution: y(t) = yQ cos t + yn sin t + H(t-3)*( 1 +sin(t-3)). Check what the solution to the ODE would be if you use the function LDEC: 'H(X-3)'(^ [ENTER] 'XA2+T(^ LDEC The result is: sm<k> K.ttt Please notice that the variable X in this expression actually represents the variable t in the original ODE, and that the variable ttt in this expression is a dummy variable. Thus, the translation of the solution in paper may be written as: poo y{t) = Co-cost + Cl -sin^ + siiU- ^ H(u — 3)-e~ut -du. Example 4 - Plot the solution to Example 3 using the same values of yQ and y] used in the plot of Example 1 , above. We now plot the function y(t) = 0.5 cos t -0.25 sin t + (1 +sin(t-3))-H(t-3). In the range 0 < t < 20, and changing the vertical range to (-1,3), the graph should look like this: Page 1 6-25 Again, there is a new component to the motion switched at t=3, namely, the particular solution yp(t) = [1 +sin(t-3)]-H(t-3), which changes the nature of the solution for t>3. The Heaviside step function can be combined with a constant function and with linear functions to generate square, triangular, and saw tooth finite pulses, as follows: • Square pulse of size UQ in the interval a < t < b: f(t) = Uo[H(t-a)-H(t-b)]. • Triangular pulse with a maximum value Uo, increasing from a < t < b, decreasing from b < t < c: f(t) = U0- ((t-a)/(b-a)-[H(t-a)-H(t-b)]+(l-(t-b)/(b-c))[H(t-b)-H(t-c)]). • Saw tooth pulse increasing to a maximum value Uo for a < t < b, dropping suddenly down to zero at t = b: f(t) = U„- (t-a)/(b-a) [H(t-a)-H(t-b)]. • Saw tooth pulse increasing suddenly to a maximum of Uo at t = a, then decreasing linearly to zero for a < t < b: f(t) = U0-[l-(t-a)/(b-l)]-[H(t-a)-H(t-b)]. Examples of the plots generated by these functions, for Uo = 1 , a = 2, b = 3, c = 4, horizontal range = (0,5), and vertical range = (-1, 1 .5), are shown in the figures below: lv 1 1 lv /\ . 1 _i_ 0. 5 . 1 j. 1 lv A f N 0. F. 1 f j. 0. 5 . Page 1 6-26 Fourier series Fourier series are series involving sine and cosine functions typically used to expand periodic functions. A function f(x) is said to be periodic, of period T, if f(x+T) = f(t). For example, because sin(x+27i) = sin x, and cos(x+27i) = cos x, the functions sin and cos are 27i-periodic functions. If two functions f(x) and g(x) are periodic of period T, then their linear combination h(x) = a-f(x) + b-g(x), is also periodic of period T. A T-periodic function f(t) can be expanded into a series of sine and cosine functions known as a Fourier series given by Inn 7 . 2nn \ fit) = a0 + 2^ \an • cos— —t + bn • sin— t n=\\ 1 1 J where the coefficients an and bn are given by 1 rT/2 2 rT/2 2nn aCl=—\ f(t)'dt, a=—\ fit)- cos t-dt, U f hll J V 7 n J J-T/2J V J J Ti2 _ x . 2nn h = fit) -sin t-dt. The following exercises are in ALG mode, with CAS mode set to Exact. (When you produce a graph, the CAS mode will be reset to Approx. Make sure to set it back to Exact after producing the graph.) Suppose, for example, that the function f(t) = t2+t is periodic with period T = 2. To determine the coefficients a0/ a^ and ^ for the corresponding Fourier series, we proceed as follows: First, define function f(t) = t2+t : : DEF I He(V Ct )=t ) HOVRU Next, we'll use the Equation Writer to calculate the coefficients: Page 1 6-27 al m f(t) COS(>t)dt I EDIT CURL" | GIG ■ EVflL |FflCTO| SIHP bl i fCt) SIN(TT't)dt 1 EDIT CURS | GIG ■ EVflL |FflCTO| SIHP Thus, the first three terms of the function are: f(t) * 1/3 - (4/ti2).cos M+(2/7i)-sin (n-\). A graphical comparison of the original function with the Fourier expansion using these three terms shows that the fitting is acceptable for t < 1 , or thereabouts. But, then, again, we stipulated that T/2 = 1 . Therefore, the fitting is valid only between -1 < t < 1 . Function FOURIER An alternative way to define a Fourier series is by using complex numbers as follows: f(t)=Xcn-cxp(—^-), where Page 16-28 cn=— L/(0*exp( t)-dt, n = -oov.. -2 ,-1,0,1,2,- -00. Function FOURIER provides the coefficient cn of the complex-form of the Fourier series given the function f(t) and the value of n. The function FOURIER requires you to store the value of the period (T) of a T-periodic function into the CAS variable PERIOD before calling the function. The function FOURIER is available in the DERIV sub-menu within the CALC menu ([j^jc^c_ ). Fourier series for a quadratic function Determine the coefficients c0, q, and c2 for the function f(t) = t2+t, with period 1 = 2. (Note: Because the integral used by function FOURIER is calculated in the interval [0,T], while the one defined earlier was calculated in the interval [-T/2,T/2], we need to shift the function in the t-axis, by subtracting T/2 from t, i.e., we will use g(t) = f(t-l ) = (t-1 )2+(t-l ).) Using the calculator in ALG mode, first we define functions f(t) and g(t): : DEF I He( f Ct )=t +t ) HOVflL : DEF I HEC'gCt 3=f Ct - 1 3'3 Next, we move to the CASDIR sub-directory under HOME to change the value of variable PERIOD, e.g., (hold) updir_ (enter)[WJ mMM (l^(JJ droT) lllj:[|!33 {enter} HOVRL :H0ME HOVflL iCflSDIR HOVflL ^►PERIOD 2 F" F; I M 1 1 H L" I H | M ij [i U L | F; E H L H | F- E F; I ij | VK Return to the sub-directory where you defined functions f and g, and calculate the coefficients (Accept change to Complex mode when requested): Page 1 6-29 :FOURIER(gtX),0) 2 3 2 :FOURIER(g(XU) 3 2-i-TT+4 2 TT 2 :F0URIER(9(X),2) TT i-TT+1 2 TT 2 COLLECTtflNSdH TT 2 iCOLLECTtflNSClH i-TT+2 2 TT TT 2 iCOLLECTtflNSClH i-TT+1 Thus, c0 = 1/3, c, = (n-\+2)/n2, c2 = (jc-i+l )/(2tt2). The Fourier series with three elements will be written as g(t) ~ Re[(l/3) + (7i i+2)A2 exp(i-7r t)+ (n-i+1 )/(27r2)-exp(2i-7i-t)]. A plot of the shifted function g(t) and the Fourier series fitting follows: -i. The fitting is somewhat acceptable for 0<t<2, although not as good as in the previous example. Page 1 6-30 A general expression for cn The function FOURIER can provide a general expression for the coefficient cn of the complex Fourier series expansion. For example, using the same function g(t) as before, the general term cn is given by (figures show normal font and small font displays): 2-tt" :F0URIERt9(X),n) Cn-TT+2- i )-e 1 ,|_|,TT+2- i ti2-tt2h i-n+i :F0URIER(3CK)jnJ (n.n+a.iJ.«a,x,n,n+a.i.na.na+3.n-n-a.i 3 3 2-i-n-ir * n "TT -e _3_3 a-i-n-n 2 a The general expression turns out to be, after simplifying the previous result, inn + 2i) ■ e2inM + 2i2n2n2 + 3nx - 2i c = — 2n n -e We can simplify this expression even further by using Euler's formula for complex numbers, namely, e2inn = cos(2n7i) + i-sin(2n7i) = 1 + i-0 = 1, since cos(2n7i) = 1, and sin(2n7i) = 0, for n integer. Using the calculator you can simplify the expression in the equation writer (L r» J eqw ) by replacing e2mTl = 1. The figure shows the expression after simplification: EaaBnaBgnfflnMBiBEBini The result is cn = (i-n-7i+2)/(n2-7i2). Putting together the complex Fourier series Having determined the general expression for cn, we can put together a finite complex Fourier series by using the summation function (X) in the calculator as follows: Page 16-31 • First, define a function c(n) representing the general term cn in the complex Fourier series. : DEFINE n "TT HOVRL • Next, define the finite complex Fourier series, F(X,k), where X is the independent variable and k determines the number of terms to be used. Ideally we would like to write this finite complex Fourier series as F(X,k)=fjc(n)-txp(2'l^'n-X) n=-k However, because the function c(n) is not defined for n = 0, we will be better advised to re-write the expression as F(X,k,c0) = c0 + 2J.c{n) • exp( X) + cirri) • exp( X)l n=\ * * Or, in the calculator entry line as: DEFINE('F(X,k,cO) = cO+Z(n=l ,k,c(n)*EXP(2*i*7i*n*X/T)+ c(-n)*EXP(-(2*i*7i*n*X/T)),)/ where T is the period, T = 2. The following screen shots show the definition of function F and the storing of T = 2: Page 16-32 DEF I HE ( 1 F t X j k s_c0 > =c0+A rr*n*X^PER I OD > +c ( -n > * EXP < -2* i *TT*n*X/PER I OD >> ' > a:tiaH:tiec.H«.»pi.]«iniMj :2H aajaaaffijaaBaHHaiBig] The function 111!!!!! can be used to generate the expression for the complex Fourier series for a finite value of k. For example, for k = 2, c0 = l/3,and using t as the independent variable, we can evaluate F(t,2,l/3) to get: =+41 !+(0.20?0.32)-e (0.00,6.£ 2.0£> This result shows only the first term (cO) and part of the first exponential term in the series. The decimal display format was changed to Fix with 2 decimals to be able to show some of the coefficients in the expansion and in the exponent. As expected, the coefficients are complex numbers. The function F, thus defined, is fine for obtaining values of the finite Fourier series. For example, a single value of the series, e.g., F(0.5,2,l/3), can be obtained by using (CAS modes set to Exact, step-by-step, and Complex): :f(.5,2±] 737940956009,0.) :+NUM(flNS(l.H Accept change to Approx mode if requested. The result is the value -0.40467.... The actual value of the function g(0.5) is g(0.5) = -0.25. The following calculations show how well the Fourier series approximates this value as the number of components in the series, given by k, increases: F (0.5, 1, 1/3) = (-0.303286439037,0.) F (0.5, 2, 1/3) = (-0.404607622676,0.) F(0.5, 3, 1/3) = (-0.192401031886,0.) Page 16-33 F (0.5, 4, 1/3) = (-0.167070735979,0.) F (0.5, 5, 1/3) = (-0.294394690453,0.) F (0.5, 6, 1/3) = (-0.305652599743,0.) To compare the results from the series with those of the original function, load these functions into the PLOT - FUNCTION input form (C5D^ , simultaneously if using RPN mode) Change the limits of the Plot Window (GT3 ML ) as follows: ^KPLOT HiriDOH - FuncTion^W 3. V-Vi«H=-i. 3. Indep Loh: I'-NJ-Um Hish: Default Step: Default _ Pixels Enter HiniHUH indep uar ualue Press the soft-menu keys IlilllS to produce the plot: -i. Notice that the series, with 5 terms, "hugs" the graph of the function very closely in the interval 0 to 2 (i.e., through the period T = 2). You can also notice a periodicity in the graph of the series. This periodicity is easy to visualize by expanding the horizontal range of the plot to (-0.5,4): Page 1 6-34 Fourier series for a triangular wave Consider the function x, if 0 < x < 1 2-x, if\<x<2 which we assume to be periodic with period T = 2. This function can be defined in the calculator, in ALG mode, by the expression DEFINE(/g(X) = IFTE(X<1 ,X,2-X)') If you started this example after finishing example 1 you already have a value of 2 stored in CAS variable PERIOD. If you are not sure, check the value of this variable, and store a 2 in it if needed. The coefficient c0 for the Fourier series is calculated as follows: :F0URIER(9(X),e) ' IFTE(Xt<l.,Xt,-(Xt-£h [ " IFTE(Xt<l.,Xt,-(Xt-£h 2 :+NUM(flNS(l.H .5 2 The calculator will request a change to Approx mode because of the integration of the function IFTE() included in the integrand. Accepting, the change to Approx produces c0 = 0.5. If we now want to obtain a generic expression for the coefficient cn use: Page 16-35 hUUKlLKI9|..::..|.riJ "2. IFTEtXt<l.JXtJ-tXt- Xt-n-te. ? 1.3-3. 14159J 0. The calculator returns an integral that cannot be evaluated numerically because it depends on the parameter n. The coefficient can still be calculated by typing its definition in the calculator, i.e., 1 fi -• \X-EXP ? Jo i • 2 • n - n - X • dX + ^•fi(2-X)-EXP i • 2 • n • n • X dX where T = 2 is the period. The value of T can be stored using: :2H 2 Typing the first integral above in the Equation Writer, selecting the entire expression, and using iLlllliiEESil, will produce the following: l-n-TT . e -1TVTT-1 .22 l-n-TT 2-n "TT -e EDIT lUF;l" BIG ■ E'.'HL FACTO l'IMF" Recall the emn = cos(n7i) + i-sin(nTi) = (-l)n . Performing this substitution in the result above we have: Page 16-36 (-1) -i-n-iT-1 Press [enter] [enter] to copy this result to the screen. Then, reactivate the Equation Writer to calculate the second integra defining the coefficient cn/ namely, [2 j-2TrTT-X (2-X>e 1 dX4 (.-lTi-TT+lJ-e -e EaaEnaoaiBEiMfliHEBini BaaEnaBgaBEaHiHEBEa Once again, replacing em7t = (-1)n, and using e2m7t = 1, we get: -i-n-TT+l-C-l) Press ijNf^ijNTER] to copy this second result to the screen. Now, add ANS(1 ) and ANS(2) to get the full expression for cn: n n RHSCD+RHSC2) e1 n TT+i-n-TT-l (-(i-niTT)+1 "22 i-n-ir 0 2 2 2-n *tt -e _2ti -it -i MoanimMaiaBBaaEiia Pressing ^3? will place this result in the Equation Writer, where we can simplify (llllllillll) it to read: i-n-ir -1 e + 2 2 i ■ri'TT n "TT -e EDIT CURS BIG E'.'AL FACTO SIHF H EDIT CURS BIG - E'.'AL FACTO SIHF Page 16-37 Once again, replacing einn = (-l)n, results in fciffllllTI^iaPC^WIllMMKHild This result is used to define the function c(n) as follows: DEFINE('c(n) = - (((-1 )An-l )/(nA2*7iA2*(-l )An)') i.e., DEFINE d £. . . . n n "TT -C — 1 i HOVRU Next, we define function F(X,k,cO) to calculate the Fourier series (if you completed example 1, you already have this function stored): DEFINE('F(X,k,cO) = cO+Z(n=l ,k,c(n)*EXP(2*i*7i*n*X/T)+ c(-n)*EXP(-(2*i*7i*n*X/T)),)/ To compare the original function and the Fourier series we can produce the simultaneous plot of both functions. The details are similar to those of example 1, except that here we use a horizontal range of 0 to 2 and a vertical range from 0 to 1, and adjust the equations to plot as shown here: plot - Funaiong Page 16-38 The resulting graph is shown below for k = 5 (the number of elements in the series is 2k+l, i.e., 1 1, in this case): From the plot it is very difficult to distinguish the original function from the Fourier series approximation. Using k = 2, or 5 terms in the series, shows not so good a fitting: plot - Funcnon§ The Fourier series can be used to generate a periodic triangular wave (or saw tooth wave) by changing the horizontal axis range, for example, from -2 to 4. The graph shown below uses k = 5: Fourier series for a square wave A square wave can be generated by using the function g(x) = 0, ifO<x<\ 1, ifl<x<3 0, if 3<x<4 Page 1 6-39 In this case, the period T, is 4. Make sure to change the value of variable Ilillll to 4 (use: GD (£roT) ■BQwra)). Function g(X) can be defined in the calculator by using DEFINE('g(X) = IFTE((X>1 ) AND (X<3), 1 ,0)') The function plotted as follows (horizontal range: 0 to 4, vertical range:0 to 1.2): V 1 + ■ . . J Using a procedure similar to that of the triangular shape in example 2, above, you can find that 1 f fl. and :Cn)=f i-2-n-TT-X 3'iTVTT i-n-TT c(n)= 2 . 2 -i-e +i-e i-n-TT S-i-n-TT * 2 2 H4tiHII«l4{WI4Mfll*MM14J:iJ ein7t/2 = in and e3in7l/2 = (-i)n Page 1 6-40 ((-1)cnti),1),<i-") ci.ri.j-- &rviK-l)n nmisTnaRmraniramsimTa DEFINE c(n)= ((_15(n+D + 1, 2-n-TT-C-l HOVRL The simplification of the right-hand side of c(n), above, is easier done on paper (i.e., by hand). Then, retype the expression for c(n) as shown in the figure to the left above, to define function c(n). The Fourier series is calculated with F(X,k,cO), as in examples l and 2 above, with cO = 0.5. For example, for k = 5, i.e., with I l components, the approximation is shown below: A better approximation is obtained by using k = I 0, i.e., For k = 20, the fitting is even better, but it takes longer to produce the graph: Page 1 6-4 1 Fourier series applications in differential equations Suppose we want to use the periodic square wave defined in the previous example as the excitation of an undamped spring-mass system whose homogeneous equation is: d2y/dX2 + 0.25y = 0. We can generate the excitation force by obtaining an approximation with k = 10 out of the Fourier series by using SW(X) = F(X, 10,0.5): : DEF I NE('SU(X)=F(X, 1 0 ■ , ■ 5* HOVRL We can use this result as the first input to the function LDEC when used to obtain a solution to the system d2y/dx2 + 0-25Y = SW(X), where SW(X) stands for Square Wave function of X. The second input item will be the characteristic equation corresponding to the homogeneous ODE shown above, i.e., 'XA2+0.25' . With these two inputs, function LDEC produces the following result (decimal format changed to Fix with 3 decimals). : LDEctsNCX^X2" 000+0. 25& C4. 019E-9-CC0+C0. 000,-3! D El" 'J LI ILHF- LAP LDEC Pressing allows you to see the entire expression in the Equation writer. Exploring the equation in the Equation Writer reveals the existence of two constants of integration, cCO and cCl . These values would be calculated using initial conditions. Suppose that we use the values cCO = 0.5 and cCl = -0.5, we can replace those values in the solution above by using function SUBST (see Chapter 5). For this case, use SUBST(ANS(1 )/cC0=0.5) (enter}, followed by SUBST(ANS(1 ),cCl =-0.5) [enter}. Back into normal calculator display we can use: Page 1 6-42 [4. 019E-9-CC0+C0. 000j -3! : SUBSTCRHSC1 . 0003,cC0=0 > C4. 019E-9-0. 500+C0. 000^ : SUBSTCRHSC1 . 000),cCl=-i> :4. 019E-9-0. 500+C0. 000/ The latter result can be defined as a function, FW(X), as follows (cutting and pasting the last result into the command): C4. 019E-9-0. 500+E0. 000/ : DEFIHe('fNCX)=C4. 019E-9* HOVRL We can now plot the real part of this function. Change the decimal mode to Standard, and use the following: Eaimg-aig^tiifi-HMiTif-^i-mi The solution is shown below: ^»FL0T HiriDOH - Funaionem 60. H.5 Indcp Loh: EHZEIE Hi?h: Default Step: DflfOUU _PiX« If Enter HiniHUH indep Fourier Transforms Before presenting the concept of Fourier transforms, we'll discuss the general definition of an integral transform. In general, an integral transform is a transformation that relates a function f(t) to a new function F(s) by an Page 1 6-43 integration of the form F(s)= k{sJ)- f{f)-dt. The function k(s,t) is %:J J a known as the kernel of the transformation. The use of an integral transform allows us to resolve a function into a given spectrum of components. To understand the concept of a spectrum, consider the Fourier series 00 fit) = a0 + ^ (an • cos conx + bn • sin conx\ n=\ representing a periodic function with a period T. This Fourier series can be 00 re-written as f(x) = a0 + ^ An • cos(ft7wx + (j)n ), where n=\ A = J a2 + b2 , d) = tan" for n =1 ,2, ... The amplitudes An will be referred to as the spectrum of the function and will be a measure of the magnitude of the component of f(x) with frequency fn = n/T. The basic or fundamental frequency in the Fourier series is f0 = 1/T, thus, all other frequencies are multiples of this basic frequency, i.e., fn = n-f0. Also, we can define an angular frequency, con = 2n7i/T = 27i-fn = n-f0 = n-co0, where co0 is the basic or fundamental angular frequency of the Fourier series. Using the angular frequency notation, the Fourier series expansion is written as 00 f(x) = a0+YjAn' cosOwx + (j)n ). n=\ GO = a0 + y£J(an • cos conx + bn -sin^x) n=\ Page 1 6-44 A plot of the values An vs. con is the typical representation of a discrete spectrum for a function. The discrete spectrum will show that the function has components at angular frequencies con which are integer multiples of the fundamental angular frequency co0- Suppose that we are faced with the need to expand a non-periodic function into sine and cosine components. A non-periodic function can be thought of as having an infinitely large period. Thus, for a very large value of T, the fundamental angular frequency, co0 = 27i/T, becomes a very small quantity, say Aco. Also, the angular frequencies corresponding to con = n-co0 = n-Aco, (n = 1, 2, oo), now take values closer and closer to each other, suggesting the need for a continuous spectrum of values. The non-periodic function can be written, therefore, as /•OO f(x)= [C(a))'COs(a>'x) + S(a))'Sm(a>'x)]da>, Jo where anc 1 r°° C(co) = / (x) • cos(&> • x) • dx, In J-°° 1 r °° S(cd) = / (x) • sin(&> -x)-dx 2n J-°° The continuous spectrum is given by A(<o) = ^[C(6))]2+[S(cd)]2 The functions C(co), S(co), and A(co) are continuous functions of a variable co, which becomes the transform variable for the Fourier transforms defined below. Example 1 - Determine the coefficients C(co), S(co), and the continuous spectrum A(a>), for the function f(x) = exp(-x), for x > 0, and f(x) = 0, x < 0. Page 1 6-45 In the calculator, set up and evaluate the following integrals to calculate C(co) and S(co , respectively. CAS modes are set to Exact and Real 1 2-ir" e X-COS(>x)dx e X-SIH(wx)dx-4 Their results are, respectively: The continuous spectrum, A(co) is calculated as: 1 Define this expression as a function by using function DEFINE ). Then, plot the continuous spectrum, in the range 0 < <d < 10, as: Definition of Fourier transforms Different types of Fourier transforms can be defined. The following are the definitions of the sine, cosine, and full Fourier transforms and their inverses used in this Chapter: Fourier sine transform Page 1 6-46 Fs {fit)} = F{cd) = - • f 7(0 • sin(^ • t) • dt n J0 Inverse sine transform F;1 {F(co)} = f(t) = [f(cd) • sin(« -t)-dt Fourier cosine transform Fc {fit)} = F(a>) = - • f 7(0 • cos(*> • 0 • dt n Jo Inverse cosine transform F;1 {F(a>)} = f(t) = {>(«) • cos(« -t)-dt Fourier transform (proper) F {fit) } = F{a>) = -1- • f/(0 ' e4" • dt In J-G0 Inverse Fourier transform (proper) F"1 {Fico)} = fit) = f°V(<») • e~im ■ dt J -00 Example 1 - Determine the Fourier transform of the function f(t) = exp(- 1), for t >0, and f(t) = 0, for t<0. The continuous spectrum, F(co), is calculated with the integral: — fV1+to)^ = lim— Ve^dt In Jo s^2n Jo _L 1 In l + ico This result can be rationalized by multiplying numerator and denominator by the conjugate of the denominator, namely, 1-ico. The result is now: lira— In 1 - exp(-(l + ico)s) \ + ia> Page 1 6-47 1 ( 1 CO InKX + co1 \ + co2 J which is a complex function. The absolute value of the real and imaginary parts of the function can be plotted as shown below Notes: The magnitude, or absolute value, of the Fourier transform, | F(co) | , is the frequency spectrum of the original function f(t). For the example shown above, |F(co)| = 1/[2ti(1 +co2)]1/2. The plot of | F(co) | vs. co was shown earlier. Some functions, such as constant values, sin x, exp(x), x2, etc., do not have Fourier transform. Functions that go to zero sufficiently fast as x goes to infinity do have Fourier transforms. Properties of the Fourier transform Linearity: If a and b are constants, and f and g functions, then F{a-f + b-g} = Transformation of partial derivatives. Let u = u(x,t). If the Fourier transform transforms the variable x, then aF{f}+bF{g}. F{5u/5x} = ico F{u}, F{a2u/dx2} = -co2 F{u}, F{5u/3t} = 3F{u}M F{52u/3t2} = 52F{u}/5t2 Page 1 6-48 convolution: For Fourier transform applications, the operation of convolution is defined as The following property holds for convolution: F{f*g} = F{f}-F{g}. Fast Fourier Transform (FFT) The Fast Fourier Transform is a computer algorithm by which one can calculate very efficiently a discrete Fourier transform (DFT). This algorithm has applications in the analysis of different types of time-dependent signals, from turbulence measurements to communication signals. The discrete Fourier transform of a sequence of data values {xj}, j = 0, 1, 2, n-l, is a new finite sequence {Xk}, defined as The direct calculation of the sequence Xk involves n2 products, which would involve enormous amounts of computer (or calculator) time particularly for large values of n. The Fast Fourier Transform reduces the number of operations to the order of n-log2n. For example, for n = 1 00, the FFT requires about 664 operations, while the direct calculation would require 1 0,000 operations. Thus, the number of operations using the FFT is reduced by a factor of 1 0000/664 « 1 5. The FFT operates on the sequence {xj} by partitioning it into a number of shorter sequences. The DFT's of the shorter sequences are calculated and later combined together in a highly efficient manner. For details on the algorithm refer, for example, to Chapter 1 2 in Newland, D.E., 1 993, "An Page 1 6-49 Introduction to Random Vibrations, Spectral & Wavelet Analysis - Third Edition/' Longman Scientific and Technical, New York. The only requirement for the application of the FFT is that the number n be a power of 2, i.e., select your data so that it contains 2, 4, 8, 1 6, 32, 62, etc., points. Examples of FFT applications FFT applications usually involve data discretized from a time-dependent signal. The calculator can be fed that data, say from a computer or a data logger, for processing. Or, you can generate your own data by programming a function and adding a few random numbers to it. Example 1 - Define the function f(x) = 2 sin (3x) + 5 cos(5x) + 0.5* RAND, where RAND is the uniform random number generator provided by the calculator. Generate 1 28 data points by using values of x in the interval (0,1 2.8). Store those values in an array, and perform a FFT on the array. First, we define the function f(x) as a RPN program: « ^ x '2*SIN(3*x) + 5*COS(5*x)' EVAL RAND 5 * + ^NUM » and store this program in variable I!I!II. Next, type the following program to generate 2m data values between a and b. The program will take the values of m, a, and b: « ^ m a b « '2Am' EVAL n « '(b-a)/(n+l )' EVAL ^ Dx « 1 n FOR j 'a+(j-l)*Dx' EVAL f NEXT n ^ARRY » » » » Store this program under the name GDATA (Generate DATA). Then, run the program for the values, m = 5, a = 0, b = 1 00. In RPN mode, use: CD CD QD CD CD CD CD HnMI The figure below is a box plot of the data produced. To obtain the graph, first copy the array just created, then transform it into a column vector by using: OBJ^ CD CD ^ARRY (Functions OBJ^ and -^ARRY are available Page 1 6-50 in the command catalog, Lr>J cat ). Store the array into variable ZDAT by using function STOZ (also available through L r> j cat ). Select Bar in the TYPE for graphs, change the view window to H-VIEW: 0 32, V-VIEW: -10 10, and BarWidth to 1 . Press fillilllL^J to return to normal calculator display. jilUjJJu 1 n | To perform the FFT on the array in stack level 1 use function FFT available in the MTH/FFT menu on array ZDAT: Ellllii! FFT. The FFT returns an array of complex numbers that are the arrays of coefficients Xk of the DFT. The magnitude of the coefficients Xk represents a frequency spectrum of the original data. To obtain the magnitude of the coefficients you could transform the array into a list, and then apply function ABS to the list. This is accomplished by using: OBJ^ (W) ^LIST C3D^ Finally, you can convert the list back to a column vector to be stored in ZDAT, as follows: OBJ^ CD CD ^LIST ^ARRY STOZ To plot the spectrum, follow the instructions for producing a bar plot given earlier. The vertical range needs to be changed to -1 to 80. The spectrum of frequencies is the following: 1 mIm.I.IIiI ii.ii The spectrum shows two large components for two frequencies (these are the sinusoidal components, sin (3x) and cos(5x)), and a number of smaller components for other frequencies. Page 16-51 Example 2 - To produce the signal given the spectrum, we modify the program GDATA to include an absolute value, so that it reads: « ^ m a b « '2Am' EVAL ^ n « '(b-a)/(n+l )' EVAL ^ Dx « 1 n FOR j 'a+(j-l)*Dx' EVAL f ABS NEXT n ^ARRY » » » » Store this version of the program under GSPEC (Generate SPECtrum). Run the program with m = 6, a = 0, b = 100. In RPN mode, use: □D Cz3 QD (jfD CD QD QD mSm Press [enter] when done, to keep an additional copy of the spectrum array. Convert this row vector into a column vector and store it into ZDAT. Following the procedure for generating a bar plot, the spectrum generated for this example looks as shown below. The horizontal range in this case is 0 to 64, while the vertical range is -1 to 1 0: .V ,ll i,i li 1 .1 1.1 .1 J ill n -L CM To reproduce the signal whose spectrum is shown , use function IFFT. Since we left a copy of the spectrum in the stack (a row vector), all you need to do if find function IFFT in the MTH/FFT menu or through the command catalog, L r> J cat . As an alternative, you could simply type the function name, i.e., type [ai^{alpha}(I} (7} (T) (t}[enter). The signal is shown as an array (row vector) with complex numbers. We are interested only in the real part of the elements. To extract the real part of the complex numbers, use function RE from the CMPLX menu (see Chapter 4), e.g., type {al^{alp^}(r](e}(e^r} . What results is another row vector. Convert it into a column vector, store it into SDAT, and plot a bar plot to show the signal. The signal for this example is shown below, using a horizontal range of 0 to 64, and a vertical range of -1 to 1 : Page 16-52 V Jj-'4l.i..-,i'"J'i I,iI..i,i,.„i. J.L.J.h. " 1 r en. Except for a large peak at t = 0, the signal is mostly noise. A smaller vertical scale (-0.5 to 0.5) shows the signal as follows: V It- , ll.Ul 1, ..J. Solution to specific second-order differential equations In this section we present and solve specific types of ordinary differential equations whose solutions are defined in terms of some classical functions, e.g., Bessel's functions, Hermite polynomials, etc. Examples are presented in RPN mode. The Cauchy or Euler equation An equation of the form x2-(d2y/dx2) + ax- (dy/dx) + by = 0, where a and b are real constants, is known as the Cauchy or Euler equation. A solution to the Cauchy equation can be found by assuming that y(x) = xn. Type the equation as: 'xA2*dldly(x)+a*x*dly(x)+b*y(x)=0' (enter} Then, type and substitute the suggested solution: 'y(x) = xAn' {enter) i!]3Iil The result is: 'xA2*(n*(xA(n-l -1 )*(n-l )))+a*x*(n*xA(n-l ))+b*xAn =0, which simplifies to 'n*(n-l )*xAn+a*n*xAn+b*xAn = 0'. Dividing by xAn, results in an auxiliary algebraic equation: 'n*(n-l )+a*n+b = 0', or. n2 +(a-\)-n + b = 0 . • If the equation has two different roots, say and n2, then the general solution of this equation is y(x) = Krx ^ + K2-x n2. • If b = (l-a)2/4, then the equation has a double root n} = n2 = n = (l-a)/2, and the solution turns out to be y(x) = (K} + K2-ln x)xn. Page 16-53 Legendre's equation An equation of the form (1 -x2)-(d2y/dx2)-2-x- (dy/dx)+n- (n+1) -y = 0, where n is a real number, is known as the Legendre's differential equation. Any solution for this equation is known as a Legendre's function. When n is a nonnegative integer, the solutions are called Legendre's polynomials. Legendre's polynomial of order n is given by M (2n-2m)\ Pn(x) = Y(-l)m K }' -xn~2m m=0 2n - m\-(n - m)\'{n - 2m)l (2/i)! (2/1-2)! , X \ ... 2"-(n\y 2"-l!-(w-l)!(»-2)! where M = n/2 or (n-1 )/2, whichever is an integer. Legendre's polynomials are pre-programmed in the calculator and can be recalled by using the function LEGENDRE given the order of the polynomial, n. The function LEGENDRE can be obtained from the command catalog (CB-££ ) or through the menu ARITHMETIC/POLYNOMIAL menu (see Chapter 5). In RPN mode, the first six Legendre polynomials are obtained as follows: 0 LEGENDRE, result: 1, i.e., P0(x) = 1.0. 1 LEGENDRE, result: X, i.e., P^x) = x. 2 LEGENDRE, result: '(3*XA2-1 )/2', i.e., P2(x) = (3x2-l)/2. 3 LEGENDRE, result: '(5*XA3-3*X)/2', i.e., P3(x) =(5x3-3x)/2. 4 LEGENDRE, result: '(35*XA4-30*XA2+3)/8', i.e., P4(x) =(35x4-30x2+3)/8. 5 LEGENDRE, result: '(63*XA5-70*XA3+1 5*X)/8', i.e., P5(x) =(63x5-70x3+15x)/8. The ODE (l-x2)-(d2y/dx2)-2-x- (dy/dx)+[n- (n+l)-m2/(l-x2)] y = 0, has for solution the function y(x) = Pnm(x)= (1-x2)m/2-(dmPn/dxm). This function is referred to as an associated Legendre function. Page 1 6-54 Bessel's equation The ordinary differential equation x2-(d2y/dx2) + x- (dy/dx)+ (x2-v2) -y = 0, where the parameter v is a nonnegative real number, is known as Bessel's differential equation. Solutions to Bessel's equation are given in terms of Bessel functions of the first kind of order v: Jv(x) = xv y — r\ 2m+v m=0 Z ^ 2m ht • m\-T{v + m + 1) where v is not an integer, and the function Gamma r(a) is defined in Chapter 3. If v = n, an integer, the Bessel functions of the first kind for n = integer are defined by tl2m+n -m\{n + m)\ Regardless of whether we use v (non-integer) or n (integer) in the calculator, we can define the Bessel functions of the first kind by using the following finite series: H_Ba -H!-(n+H>! Thus, we have control over the function's order, n, and of the number of elements in the series, k. Once you have typed this function, you can use function DEFINE to define function J(x,n,k). This will create the variable !!!!!!!!!!!!!!!! in the soft-menu keys. For example, to evaluate J3(0.1) using 5 terms in the series, calculate J(0. 1 ,3,5), i.e., in RPN mode: CZDCTC^CBC^COi The result is 2.082031 57E-5. Page 1 6-55 If you want to obtain an expression for J0(x) with, say, 5 terms in the series, use J(x,0,5). The result is 'l-0.25*xA3+0.015625*xA4-4.3403777E-4*xA6+6.782168E-6*xA8- 6.78168*xA10'. For non-integer values v, the solution to the Bessel equation is given by y(x) = KrJv(x)+K2.J.v(x). For integer values, the functions Jn(x) and J-n(x) are linearly dependent, since J„(x) = (-l)\l.„(x), therefore, we cannot use them to obtain a general function to the equation. Instead, we introduce the Bessel functions of the second kind defined as Yv(x) = [Jv(x) cos V7i - J_v(x)]/sin vn, for non-integer v, and for n integer, with n > 0, by Yn(x) = — -Jn(x)-(ln- + y) + L^mTn u ~ 'x 7i 2 n tTo 2 'm\\m + n)\ -n n-\ -—■I (n-m-\)\ x2m n 22m-"-m\ where y is the Euler constant, defined by y = lim[l + - + - + ... + -- In r] « 0.57721 566490..., r^co 2 3 r and hm represents the harmonic series hm =1 + - + - + ... + — 2 3 m For the case n = 0, the Bessel function of the second kind is defined as Y0(x) = - 71 j (x) • (In- + r) + Y i-^ \ -x2m Page 1 6-56 With these definitions, a general solution of Bessel's equation for all values of v is given by y(x) = KrJv(x)+K2-Yv(x). In some instances, it is necessary to provide complex solutions to Bessel's equations by defining the Bessel functions of the third kind of order v as Hn(1)(x) =Jv(x)+i-Yv(x), and Hn<2'(x) = Jv(x)-i-Yv(x), These functions are also known as the first and second Hankel functions of order v. In some applications you may also have to utilize the so-called modified Bessel functions of the first kind of order v defined as lv(x)= i"v-Jv(i-x), where i is the unit imaginary number. These functions are solutions to the differential equation x2-(d2y/dx2) + x- (dy/dx)- (x2+v2) y = 0. The modified Bessel functions of the second kind, Kv(x) = (tt/2)-[U (xK (x)]/sin vtt, are also solutions of this ODE. You can implement functions representing Bessel's functions in the calculator in a similar manner to that used to define Bessel's functions of the first kind, but keeping in mind that the infinite series in the calculator need to be translated into a finite series. Chebyshev or Tchebycheff polynomials The functions Tn(x) = cos(n-cos"] x), and Un(x) = sin[(n+l) cos"1 x]/(l-x2)1/2, n = 0, 1, ... are called Chebyshev or Tchebycheff polynomials of the first and second kind, respectively. The polynomials Tn(x) are solutions of the differential equation (l-x2)-(d2y/dx2) - x- (dy/dx) + n2-y = 0. In the calculator the function TCHEBYCHEFF generates the Chebyshev or Tchebycheff polynomial of the first kind of order n, given a value of n > 0. If the integer n is negative (n < 0), the function TCHEBYCHEFF generates a Tchebycheff polynomial of the second kind of order n whose definition is Page 1 6-57 Un(x) = sin(n-arccos(x))/sin(arccos(x)). You can access the function TCHEBYCHEFF through the command catalog (C3^ ). The first four Chebyshev or Tchebycheff polynomials of the first and second kind are obtained as follows: 0 TCHEBYCHEFF, result: 1 , i.e., ToM = 1.0. -0 TCHEBYCHEFF, result: 1, i.e., UoM = 1.0. 1 TCHEBYCHEFF, result: X, i.e., T,(x) = X. -1 TCHEBYCHEFF, result: 1, i.e., U,(x) = 1.0. 2 TCHEBYCHEFF, result: '2*XA2-1, i.e., T2(x) =2x2-l . -2 TCHEBYCHEFF, result: '2*X', i.e., U2(x) =2x. 3 TCHEBYCHEFF, result: '4*XA3-3*X', i.e., T3(x) = 4x3-3x. -3 TCHEBYCHEFF, result: '4*XA2-T, i.e., U3(x) = 4x2-l . Laguerre's equation Laguerre's equation is the second-order, linear ODE of the form x-(d2y/dx2) +(l-x)- (dy/dx) + ny = 0. Laguerre polynomials, defined as L0(x) = 1, Ln{x) = — — , n = 1,2V.., n\ ax are solutions to Laguerre's equation. Laguerre's polynomials can also be calculated with: »=o ml n(n-l) 2 (-I)" „ = l-n-x + — --x -... + .... + - — —-x 4 n\ The term = C(njn) m\(n — m)\ Page 16-58 is the m-th coefficient of the binomial expansion (x+y)n. It also represents the number of combinations of n elements taken m at a time. This function is available in the calculator as function COMB in the MTH/PROB menu (see also Chapter 1 7). You can define the following function to calculate Laguerre's polynomials: m=0 When done typing it in the equation writer press use function DEFINE to create the function L(x,n) into variable IIII . To generate the first four Laguerre polynomials use, L(x,0), L(x, 1), L(x,2), L(x,3). The results are: Lo(x)= • L,(x)= 1-x. L2(x)= l-2x+ 0.5x2 L3(x) = l-3x+1.5x2-0.16666...x3. Weber's equation and Hermite polynomials Weber's equation is defined as d2y/dx2+(n+l/2-x2/4)y = 0, for n = 0, 1, 2, ... A particular solution of this equation is given by the function , y(x) = exp(-x2/4)H*(x/V2), where the function H*(x) is the Hermite polynomial: H0* = l, Hn*(x) = (-l)"ex2^(e-x2), n = l,2,.. ax In the calculator, the function HERMITE, available through the menu ARITHMETIC/POLYNOMIAL. Function HERMITE takes as argument an integer number, n, and returns the Hermite polynomial of n-th degree. For example, the first four Hermite polynomials are obtained by using: Page 1 6-59 0 HERMITE, result: 1, 1 HERMITE, result: ,2*X,/ 2 HERMITE, result: ,4*XA2-2,/ 3 HERMITE, result: '8*XA3-1 2*X', i.e., H0* = 1. i.e., H]* = 2x. i.e., H2* = 4x2-2. i.e., H3* = 8x3-12x. Numerical and graphical solutions to ODEs Differential equations that cannot be solved analytically can be solved numerically or graphically as illustrated below. Numerical solution of first-order ODE Through the use of the numerical solver (L r> Jnumslv )f you can access an input form that lets you solve first-order, linear ordinary differential equations. The use of this feature is presented using the following example. The method used in the solution is a fourth-order Runge-Kutta algorithm preprogrammed in the calculator. Example 1 -- Suppose we want to solve the differential equation, dv/dt = -1 .5 v1/2, with v = 4 at t = 0. We are asked to find v for t = 2. First, create the expression defining the derivative and store it into variable EQ. The figure to the left shows the ALG mode command, while the right- hand side figure shows the RPN stack before pressing Isto>j . :-1.5-JI>EQ 3: -1.5-Jy l: 1 EQ 1 Then, enter the NUMERICAL SOLVER environment and select the differential equation solver: [j^Jnum.slv jjjjjjilijTjjjjjjj . Enter the following parameters: SOLVE V'(T)=F(TJV) f- '-1.5*-J"u' Ind«p=t lnit:0 Final 2 l'mI.ti: Ini+:4 Final.| TOU, 000 1 Step = Df 1 1 _ Stiff Press SOLVE For Final. sol.n ual.u« Page 1 6-60 To solve, press: BBEB (wait) EMM. The result is 0.2499 « 0.25. Press H. Solution presented as a table of values Suppose we wanted to produce a table of values of v, for t = 0.00, 0.25, 2.00, we will proceed as follows: First, prepare a table to write down your results. Write down in your table the step-by-step results: t V 0.00 0.00 0.25 2.00 Next, within the SOLVE environment, change the final value of the independent variable to 0.25, use : ^.25IHaiCV)a) MSB (wait) B3H (Solves for v at t = 0.25, v = 3.285 .... ) lini lilllll ^ . 5 lail CTC^Iill(wait)!EiI (Changes initial value of t to 0.25, and final value of t to 0.5, solve for v(0.5) = 2.640...) tan fssso^ .75naa5C& ana (wait) mm (Changes initial value of t to 0.5, and final value of t to 0.75, solve for v(0.75) = 2.066...) IIIElI:!!!!! 1 jjjjijijjjjjjj O) 05 B3H33 (wait) lEiEEiEii (Changes initial value of t to 0.75, and final value of t to 1, solve for v(l) = 1.562...) Repeat for t = 1 .25, 1 .50, 1 .75, 2.00. Press ill! after viewing the last result in iililillii. To return to normal calculator display, press l^EJ or C^3Ilii]Ii. The different solutions will be shown in the stack, with the latest result in level 1 . The final results look as follows (rounded to the third decimal): Page 16-61 t V 0.00 4.000 0.25 3.285 0.50 2.640 0.75 2.066 1.00 1.562 1.25 1.129 1.50 0.766 1.75 0.473 2.00 0.250 Graphical solution of first-order ODE When we can not obtain a closed-form solution for the integral, we can always plot the integral by selecting Dif f Eq in the TYPE field of the PLOT environment as follows: suppose that we want to plot the position x(t) for a velocity function v(t) = exp(-t2), with x = 0 at t = 0. We know there is no closed-form expression for the integral, however, we know that the definition of v(t) is dx/dt = exp(-t2). The calculator allows for the plotting of the solution of differential equations of the form Y'(T) = F(T,Y). For our case, we let Y = x and T = t, therefore, F(T,Y) = f(t, x) = exp(-t2). Let's plot the solution, x(t), for t = 0 to 5, by using the following keystroke sequence: • IJnJi^ (simultaneously, if in RPN mode) to enter PLOT environment • Highlight the field in front of TYPE, using the ^r? keys. Then, press EiCEEH, and highlight Diff Eq, using the ^^^7 keys. Press 139. • Change field F: to 'EXP(-tA2)' • Make sure that the following parameters are set to: H-VAR: 0, V-VAR: 1 • Change the independent variable to t . • Accept changes to PLOT SETUP: [nxt) MM • EDJ^L (simultaneously, if in RPN mode). To enter PLOT WINDOW environment • Change the horizontal and vertical view window to the following settings: H-VIEW: -1 5; V-VIEW: -1 1.5 Page 1 6-62 • Also, use the following values for the remaining parameters: Init: 0, Final: 5, Step: Default, Tol: 0.0001, Init-Soln: 0 • To plot the graph use: EEMi + n 1 1 II I m IMTl I HI I hi H When you observe the graph being plotted, you'll notice that the graph is not very smooth. That is because the plotter is using a time step that may be a bit large for a smooth graph. To refine the graph and make it smoother, use a step of 0.1. Press IIIililiiE! and change the Step : value to 0.1, then use EuTuI! once more to repeat the graph. The plot will take longer to be completed, but the shape is definitely smoother than before. Try the following: IIIiMll ® EHUD to see axes labels and range. Notice that the labels for the axes are shown as 0 (horizontal, for t) and 1 (vertical, for x). These are the definitions for the axes as given in the PLOT SETUP window (C5Di^ ) i.e., H-VAR: 0, and V-VAR: 1 . To see the graphical solution in detail use the following: Inxt j Inxt j [III]! To recover menu and return to PICT environment. !l(:l:li!lli!il)ll To determine coordinates of any point on the graph. Use the GDCD ^eys *° move *ne cursor around the plot area. At the bottom of the screen you will see the coordinates of the cursor as (X,Y), i.e., the calculator uses X and Y as the default names for the horizontal and vertical axes, respectively. Press [nxtJ H3D31 to recover the menu and return to the PLOT WINDOW environment. Finally, press Ion j to return to normal display. i -i. 5. -i. Page 1 6-63 Numerical solution of second-order ODE Integration of second-order ODEs can be accomplished by defining the solution as a vector. As an example, suppose that a spring-mass system is subject to a damping force proportional to its speed, so that the resulting d2x dx differential equation is: — — = —1 8.75 • x — 1 .962 dt2 dt or, x" = - 18.75 x- 1.962 x1, subject to the initial conditions, v = x1 = 6, x = 0, at t = 0. We want to find x, x1 att = 2. Re-write the ODE as: w1 = Aw, where w = [ x x1 ]T, and A is the 2 x 2 matrix shown below. 0 1 -18.75 -1.962 The initial conditions are now written as w = [0 6]T, for t = 0. (Note: The symbol [ ]T means the transpose of the vector or matrix). To solve this problem, first, create and store the matrix A, e.g., in ALG mode: re ii 1-13,75 -1-962| Then, activate the numerical differential equation solver by using: L r> J numslv ^▼7 Iliiilllllll . To solve the differential equation with starting time t = 0 and final time t = 2, the input form for the differential equation solver should look as follows (notice that the Init: value for the Soln: is a vector [0, 6]): Page 1 6-64 WBBBB solve rm:F(U)™ f : fl*w Ind«p=t lnit:0 Final 2 i.n : w Init : [ 0 . ,,. Fina I. ^^^^| ToU, 000 1 St* p = Df 1 1 _ Stiff Ffgjj SOLVE for final join ualm Press Mm (wait) BSD to solve for w(t=2). The solution reads [.1 671 6... - .6271...], i.e., x(2) = 0.16716, and x'(2) = v(2) = -0.6271. Press EM! to return to SOLVE environment. Solution presented as a table of values In the previous example we were interested only in finding the values of the position and velocity at a given time t. If we wanted to produce a table of values of x and x1, for t = 0.00, 0.25, 2.00, we will proceed as follows: First, prepare a table to write down your results: t X x' 0.00 0.00 6.00 0.25 2.00 Next, within the SOLVE environment, change the final value of the independent variable to 0.25, use: ^ .25 En nr. nr. iEIIilii! (wait) (Solves for w at t = 0.25, w = [0.968 1 .368]. ) ::::v::::::: I":"1::":":™: /~\ C ™v::::::: ~r ::!:::v:":"""::: / , 'i\ i::::"1:::::": iiii:!:!.-:!!!!! LSijLSLSa C±^> . D ilfcLLLlli LJ^ ii::;i:::!.::h::!.::i (WOlt) sjius (Changes initial value of t to 0.25, and final value of t to 0.5, solve again for w(0.5) = [0.748 -2.61 6]) SCIISI iQOllli .75 l!l!!i]]]|li(T) QT> S3!3!!!CEii! (wait) IHIHil (Changes initial value of t to 0.5, and final value of t to 0.75, solve again for w(0.75) = [0.0147 -2.859]) ::::v:':'::::: :::":"!::"::"::!:: "I ::::v:::::i: / r-— ^ /-r--. V--------:":: /. 4 , "iX i:"::"":"::": iiii:!:!.-:!!!!! !!!.!!.!.!!.!!!.!!■:■! (_^j> I bb:!:™ (JO (WOlt) UJUJ (Changes initial value of t to 0.75, and final value of t to 1, solve again for w(l) = [-0.469 -0.607]) Page 1 6-65 Repeat for t = 1 .25, 1 .50, 1 .75, 2.00. Press liill!!! after viewing the last result in iilliillii. To return to normal calculator display, press L0A/ J or jNxrj The different solutions will be shown in the stack, with the latest result in level 1 . The final results look as follows: t X x" t X x" 0.00 0.000 6.000 1.25 -0.354 1.281 0.25 0.968 1.368 1.50 0.141 1.362 ! 0.50 0.748 -2.616 1.75 0.227 0.268 0.75 -0.015 -2.859 2.00 0.167 -0.627 1.00 -0.469 -0.607 Graphical solution for a second-order ODE Start by activating the differential equation numerical solver, (j^J numslv ^3? IISHII . The SOLVE screen should look like this: ^» SOLVE r(T):F(U)« f = R*w Ind«p=t lnit:0 Final 2 i.n = y Init = [ 0 . ,„ Fina L B^JMll TOU, 000 1 Step = Df 1 1 _ StiFf Press SOLVE For Final. sol.n ual.u« Notice that the initial condition for the solution (Soln: w Init: [0., ...) includes the vector [0, 6]. Press [nxtJ mlM. Next, press GT3J^ (simultaneously, if in RPN mode) to enter the PLOT environment. Highlight the field in front of TYPE, using the </^N><^7 keys. Then, press H33SB, and highlight Diff Eq, using the keys. Press DII. Modify the rest of the PLOT SETUP screen to look like this: woooooooooooooooooow F L '.' T _■ E T U F .; F:fl-H _StiFF Ind«p: t H-TiCh=iD. Y-TiCh:10. ^Pixels Choos« typ« oF put Page 1 6-66 Notice that the option V-Var: is set to 1, indicating that the first element in the vector solution, namely, x', is to be plotted against the independent variable t. Accept changes to PLOT SETUP by pressing [nxtJ mm. Press C5D ML (simultaneously, if in RPN mode) to enter the PLOT WINDOW environment. Modify this input form to look like this: bbbbbplot HinDOH - DIFF 2.5 S. Init: 0. Final.: 2.S Step: .1 To L : .0001 Init-Sol.n: [LL. .■■:.] Enter HiniHUH horizontal. To plot the x vs. t graph use: !L;iLl:!!;!!§L;i! 13333 . The plot of x' vs. t looks like this: To plot the second curve we need to use the PLOT SETUP input form once, more. To reach this form from the graph above use: HlClHII ® EB QD (simultaneously, if in RPN mode) . Change the value of the V-Var: field to 2, and press III:!!;!;] (do not press 11133:10 or you would loose the graph produced above). Use: 13333 C^D IB3333I CHEEI to see axes labels and range. Notice that the x axis label is the number 0 (indicating the independent variable), while the y-axis label is the number 2 (indicating the second variable, i.e., the last variable plotted). The combined graph looks like this: 5.' 4 -5., Press [Nxf^[Nxf) lllllil B3BS33 Q^J to return to normal calculator display. Page 1 6-67 Numerical solution for stiff first-order ODE Consider the ODE: dy/dt = -1 00y+l 00t+l 01 , subject to the initial condition y(0)=l. Exact solution This equation can be written as dy/dt + 1 00 y = 1 00 t + 101, and solved using an integrating factor, IF(t) = exp(100t), as follows (RPN mode, with CAS set to Exact mode): '(100*t+101)*EXP(100*t)'(™^ '\' (enter) RISCH The result is '(t+1 )*EXP(1 00*t)'. Next, we add an integration constant, by using: 'C (^DC+D Then, we divide by Fl(x), by using: /EXP(100*t)/ (^GED . The result is: /((t+l)*EXP(100*t)+C)/EXP(100*t)/, i.e., y(t) = 1+ t +Ge100t. Use of the initial condition y(0) = 1, results in 1 = 1 + 0 + Ge°, or C = 0, the particular solution being y(t) = 1+t. Numerical solution If we attempt a direct numerical solution of the original equation dy/dt = - 1 00y+l 00t+l 01 , using the calculator's own numerical solver, we find that the calculator takes longer to produce a solution that in the previous first-order example. To check this out, set your differential equation numerical solver ((JfJ NUM.SLV ^r? lllilMllll) to: SOLVE V'(T)=F(TJV) F= -100.*Y+100.*t + l Ind«p=t lnit:0 Final 2 So In: V Ini+:1 Final | To I : . 000 1 St* p = Df 1 1 _ Stiff Fr«s SOLVE For Final join ualu* Page 1 6-68 Here we are trying to obtain the value of y(2) given y(0) = 1 . With the Soin: Final field highlighted, press B3SQ. You can check that a solution takes about 6 seconds, while in the previous first-order example the solution was almost instantaneous. Press jQN J to cancel the calculation. This is an example of a stiff ordinary differential equation. A stiff ODE is one whose general solution contains components that vary at widely different rates under the same increment in the independent variable. In this particular case, the general solution, y(t) = 1+ t +Ge100t, contains the components Y and 'Ge100t/, which vary at very different rates, except for the cases C=0 or C*0 (e.g., for C = 1, t =0.1, Ce100t =22026). The calculator's ODE numerical solver allows for the solution of stiff ODEs by selecting the option _stiff in the solve y' (t) = f(t,y) screen. With this option selected you need to provide the values of df/dy and df/dt. For the case under consideration df/dy = -1 00 and di/d\ = 1 00. Enter those values in the corresponding fields of the solve y' (t) = f(t,y) screen: jKHKB SOLVE V'(T)=F(T,V)^ F = ' -1... *F*y: ' -1... 3Fit: 100 Ind«p=t lnit=0 Final 2 So In: V Init:l Final 3E1 T^:, 000 1 Step = Df 1 1 ^ StiFf Pr«ff SOLVE For Final join ual.u« |iniT+|S0LYE When done, move the cursor to the soin: Final field and press BSSQ. This time, the solution in produced in about 1 second. Press llllllil to see the solution: 2.9999999999, i.e., 3.0. Note: The option stiff is also available for graphical solutions of differential equations. Numerical solution to ODEs with the SOLVE/DIFF menu The SOLVE soft menu is activated by using 74 MENU in RPN mode. This menu is presented in detail in Chapter 6. One of the sub-menus, DIFF, Page 1 6-69 contains functions for the numerical solution of ordinary differential equations for use in programming. These functions are described next using RPN mode and system flag 1 1 7 set to SOFT menus. The functions provided by the SOLVE/DIFF menu are the following: U Function RKF This function is used to compute the solution to an initial value problem for a first-order differential equation using the Runge-Kutta-Fehlbert 4th -5th order solution scheme. Suppose that the differential equation to be solved is given by dy/dx = f(x,y), with y = 0 at x = 0, and that you will allow a convergence criteria s for the solution. You can also specify an increment in the independent variable, Ax, to be used by the function. To run this function you will prepare your stack as follows: 3: {V, y, 'f(x,y)'} 2: {c Ax} 1 : Xfinal The value in the first stack level is the value of the independent variable where you want to find your solution, i.e., you want to find, yfina| = fs(xfina|), where fs(x) represents the solution to the differential equation. The second stack level may contain only the value of 8, and the step Ax will be taken as a small default value. After running function illliil, the stack will show the lines: 2: {V, y, 'f(x,y)'} 1: 8 The value of the solution, yfina|, will be available in variable 11111. This function is appropriate for programming since it leaves the differential equation specifications and the tolerance in the stack ready for a new solution. Notice that the solution uses the initial conditions x = 0 at y = 0. If, your actual initial solutions are x = xinit at y = yinit, you can always add these values to the solution provided by RKF, keeping in mind the following relationship: Page 1 6-70 RKF solution Actual solution X y X y 0 0 Xjnit Yinit Xfinal Yfinal Xjnit + Xfjnal Yinit + yfinal The following screens show the RPN stack before and after applying function x+y, e = 0.001, Ax = 0.1. 4: 3: {XL 2: mi l: 2 4: 3 ' 2: (xy x+y> l: ,sgi baHMaa«iaH«iiaaHaiiaH«aiM:»d After applying function RKF, variable contains the value 4.3880... Function RRK This function is similar to the RKF function, except that RRK (Rosenbrock and Runge-Kutta methods) requires as the list in stack level 3 for input not only the names of the independent and dependent variables and the function defining the differential equation, but also the expressions for the first and second derivatives of the expression. Thus, the input stack for this function will look as follows: 3: {V, y, 'f(x,y)' 'df/dx' 'd\/dy' } 2: {c Ax} "I : Xfinal The value in the first stack level is the value of the independent variable where you want to find your solution, i.e., you want to find, yfind = fs(xfina|), where fs(x) represents the solution to the differential equation. The second stack level may contain only the value of s, and the step Ax will be taken as a small default value. After running function III:!!!!!, the stack will show the lines: 2: {V, y, 'f(x,y)' 'tf/dx' Wvy' } 1: {s Ax} The value of the solution, yfina|, will be available in variable IE11II. This function can be used to solve so-called "stiff" differential equations. Page 16-71 The following screen shots show the RPN stack before and after application of function RRK: '-100*y+100*X -100' y £ x y +101T 100 t .001 .1 3 l: 2 3 5 2: {. x y '-100*y+100*x +101 7 100 '-100' > l: .001 The value stored in variable y is 3.00000000004. Function RKFSTEP This function uses an input list similar to that of function RKF, as well as the tolerance for the solution, and a possible step Ax, and returns the same input list, followed by the tolerance, and an estimate of the next step in the independent variable. The function returns the input list, the tolerance, and the next step in the independent variable that satisfies that tolerance. Thus, the input stack looks as follows: 3: {V, y, 'f(x,y)'} 2: s 1: Ax After running this function, the stack will show the lines: 3: fx', y, 'f(x,y)'} 2: c 1 : (Ax)next Thus, this function is used to determine the appropriate size of a time step to satisfy the required tolerance. The following screen shots show the RPN stack before and after application of function RKFSTEP: 4: 3: £ x y 'x*y' } 2: .001 l: . 1 baHMaa«iaH«iiaaHaiiaH«aima^ 4: 3: £ x y 'x*y' } 2: .001 l: .340493095001 These results indicate that (Ax)next = 0.34049... Page 1 6-72 Function RRKSTEP This function uses an input list similar to that of function RRK, as well as the tolerance for the solution, a possible step Ax, and a number (LAST) specifying the last method used in the solution (1, if RKF was used, or 2, if RRK was used). Function RRKSTEP returns the same input list, followed by the tolerance, an estimate of the next step in the independent variable, and the current method (CURRENT) used to arrive at the next step. Thus, the input stack looks as follows: 4: {V, y, 'f(x,y)'} 3: s 2: Ax 1: LAST After running this function, the stack will show the lines: 4: {V, y, 'f(x,y)'} 3: c 2: (Ax)next 1: CURRENT Thus, this function is used to determine the appropriate size of a time step ((Ax)next) to satisfy the required tolerance, and the method used to arrive at that result (CURRENT). The following screen shots show the RPN stack before and after application of function RRKSTEP: £ x y '-100*y+100*x +101f 100 '-10' > 3: .0001 2: . 1 l: 1 t x y '-100*y+100*x +101 7 100 '-10' > 3: .0001 2: 5.58878551997E-3 1. baH«aa«iaH«iiaaMiiaH«aiMa*a These results indicate that (Ax)next = 0.00558... and that the RKF method (CURRENT = 1) should be used. Page 1 6-73 Function RKFERR This function returns the absolute error estimate for a given step when solving a problem as that described for function RKF. The input stack looks as follows: 2: {V, y, 'f(x,y)'} 1: Ax After running this function, the stack will show the lines: 4: {V, y, 'f(x,y)'} 3: c 2: Ay 1 : error Thus, this function is used to determine the increment in the solution, Ay, as well as the absolute error (error). The following screen shots show the RPN stack before and after application of function RKFERR: 6: 5: 4: 3: 2: l: £ x y 'x*y' } 6: 5: 4: 3 ' 2: .827201242271 l: -1.S95374S9701E-6 baHMBaa«iaH«iiaa;«naHj^aiM=»s £ x y 'x*y' 3 These result show that Ay = 0.827... and error = -1 .89...xl 0"6. Function RSBERR This function performs similarly to RKERR but with the input elements listed for function RRK. Thus, the input stack for this function will look as follows: 2: {V, y, 'f(x,y)' 'd\/dx' 'Sf/vy' } 1: Ax After running the function, the stack will show the lines: 4: {V, y, 'f(x,y)' 'dt/dx* Wvy' }: 3: c 2: Ay error Page 1 6-74 The following screen shots show the RPN stack before and after application of function RSBERR: 4: 3: l: £ x y + 101T '-100*y+100*x 100 '-10' > . 1 4: 3: l: t x y '-100*y+100*x +1017 100 '-10' > . 1 4. 15144617136 2.76211716614 These results indicate that Ay = 4.1 514... and error = 2.762..., for Dx = 0.1 . Check that, if Dx is reduced to 0.01, Ay = -0.00307... and error = 0.000547. Note: As you execute the commands in the DIFF menu values of x and y will be produced and stored as variables in your calculator. The results provided by the functions in this section will depend on the current values of x and y. Therefore, some of the results illustrated above may differ from what you get in your calculator. Page 1 6-75 Chapter 1 7 Probability Applications In this Chapter we provide examples of applications of calculator's functions to probability distributions. The MTH/PROBABILITY.. sub-menu - part 1 The MTH/PROBABILITY.. sub-menu is accessible through the keystroke sequence MhJmtw . With system flag 117 set to CHOOSE boxes, the following list of MTH options is provided (see left-hand side figure below). We have selected the PROBABILITY., option (option 7), to show the following functions (see right-hand side figure below): HATH HEMJ 6. BASE.. 1 S . FFT.. ! 5 . LUMF LE!!.. 10. consTAnTS.. 11. special FuncTions.. | PROBABILITY HEMJ a™R™ % ^ I 3.! H . RAAD I S . RDZ e.uTPC I In this section we discuss functions COMB, PERM, ! (factorial), RAND, and RDZ. Factorials, combinations, and permutations The factorial of an integer n is defined as: n! = n- (n-1) • (n-2)... 3-2-1 . By definition, 0! = 1 . Factorials are used in the calculation of the number of permutations and combinations of objects. For example, the number of permutations of r objects from a set of n distinct objects is nPr = n(n -\)(n -\)...(n - r + 1) = n\l{n-r)\ Also, the number of combinations of n objects taken r at a time is n{n - X){n - 2)...(n - r + 1) \rj r\ r\{n - r)\ Page 17-1 To simplify notation, use P(n,r) for permutations, and C(n,r) for combinations. We can calculate combinations, permutations, and factorials with functions COMB, PERM, and ! from the MTH/PROBABILITY.. sub-menu. The operation of those functions is described next: • COMB(n,r): Combinations of n items taken r at a time • PERM(n,r): Permutations of n items taken r at a time • n!: Factorial of a positive integer. For a non-integer, x! returns r(x+l), where r(x) is the Gamma function (see Chapter 3). The factorial symbol (!) can be entered also as the keystroke combination Example of applications of these functions are shown next: :COMB(10.,6.:i 210. :PERM(10.,6.:i 151200. : 12.! 479001600. Random numbers The calculator provides a random number generator that returns a uniformly distributed, random real number between 0 and 1 . The generator is able to produce sequences of random numbers. However, after a certain number of times (a very large number indeed), the sequence tends to repeat itself. For that reason, the random number generator is more properly referred to as a pseudo-random number generator. To generate a random number with your calculator use function RAND from the MTH/PROBABILITY sub-menu. The following screen shows a number of random numbers produced using RAND. The numbers in the left-hand side figure are produced with calling function RAND without an argument. If you place an argument list in function RAND, you get back the list of numbers plus an additional random number attached to it as illustrated in the right-hand side figure. Page 1 7-2 :RRHD .529199353633 :RRHD 4.35821314444E-2 :RRHD . £94922982083 . 2949229820881 RRHDC5J {5- 4- 10396424443E-2) :RRHDC2-,5.) {2. 5. .736370433305) RRND(l.,2.,3.:i kl. 2. 3. 4-07030793137^ Random number generators, in general, operate by taking a value, called the "seed" of the generator, and performing some mathematical algorithm on that "seed" that generates a new (pseudo)random number. If you want to generate a sequence of number and be able to repeat the same sequence later, you can change the "seed" of the generator by using function RDZ(n), where n is the "seed," before generating the sequence. Random number generators operate by starting with a "seed" number that is transformed into the first random number of the series. The current number then serves as the "seed" for the next number and so on. By "re-seeding" the sequence with the same number you can reproduce the same sequence more than once. For example, try the following: Use 0.25 as the "seed." First random number = 0.75285... Second random number = 0.51 109... Third random number^ 0.085429.... RDZ(0.25) (ENTER) RAND() (enter} RAND() (enter} RAND() (enter} Re-start the sequence: RDZ(0.25) (enter} RAND() (enter} RAND() (enter} RANDQ (enter} Use 0.25 as the "seed." First random number = 0.75285... Second random number = 0.51 1 09... Third random number^ 0.085429.... To generate a sequence of random numbers use function SEQ. For example, to generate a list of 5 random numbers you can use, in ALG mode: SEQ<RflHD< ) :: j :: 1 :: 5 j 1 > . In RPN mode, use the following program: ■*: ^ n * 1 n FOR j RND NEXT n ^LIST :*■ Store it into variable RLST (Random LiST), and use L^LiJiE^ to produce a list of 5 random numbers. Function RNDM(n,m) can be used to generate a matrix of n rows and m columns whose elements are random integers between -1 and l(see Chapter 10). Page 1 7-3 Discrete probability distributions A random variable is said to be discrete when it can only take a finite number of values. For example, the number of rainy days in a given location can be considered a discrete random variable because we count them as integer numbers only. Let X represent a discrete random variable, its probability mass function (pmf) is represented by f(x) = P[X=x], i.e., the probability that the random variable X takes the value x. The mass distribution function must satisfy the conditions that f(x) >0, for all x, and £/(*) = 1.0 allx A cumulative distribution function (cdf) is defined as F(x) = P[X<x] = Zf(k) k<x Next, we will define a number of functions to calculate discrete probability distributions. We suggest that you create a sub-directory, say, HOME\STATS\DFUN (Discrete FUNctions) where we will define the probability mass function and cumulative distribution function for the binomial and Poisson distributions. Binomial distribution The probability mass function of the binomial distribution is given by f{n,p,x) = •px-(i-prx, *= 0,1,2,...,* where (nx) = C(n,x) is the combination of n elements taken x at a time. The values n and p are the parameters of the distribution. The value n represents the number of repetitions of an experiment or observation that can have one of two outcomes, e.g., success and failure. If the random variable X represents the number of successes in the n repetitions, then p represents the Page 1 7-4 probability of getting a success in any given repetition. The cumulative distribution function for the binomial distribution is given by F(n,p,x) = ^f(n,p,x), x = 0,1,2,...,/? £=0 Poisson distribution The probability mass function of the Poisson distribution is given by f(A,x) = — , x = 0,1,2,..., oo . x! In this expression, if the random variable X represents the number of occurrences of an event or observation per unit time, length, area, volume, etc., then the parameter I represents the average number of occurrences per unit time, length, area, volume, etc. The cumulative distribution function for the Poisson distribution is given by X F(Z,x) = ^/(l,x), x = 0,1,2,..., oo Next, use function DEFINE (UiJDiL_ ) to define the following probability mass functions (pmf) and cumulative distribution functions (cdf): IY: l" ! ": :° l "! ■■ \'."S :: "x" 5 ::::: S~" ^ W 5" """ •■ ' "S" ' !■■■ ! !■■.::■■■ ■■ : ■ ■ • ■■■■ .■ ■ ■ ■ Z< k =0 j X j pmfb C H , P V. k > > > ^,x> ::::: EXP<-X)*XAx^x ! > ■ : :■■.[!■■■ :"- The function names stand for: • pmfb: probability mass function for the binomial distribution • cdfb: cumulative distribution function for the binomial distribution • pmfp: probability mass function for the Poisson distribution • cdfp: cumulative distribution function for the Poisson distribution Page 1 7-5 Examples of calculations using these functions are shown next: : pmfbCie, . 15i3> . 129833720754 : cdfbae, . 15i3> .950030201121 : +HUM(pmfp(5?4>> . 175467369768 : ■*NUM<cdfp<5i4>> . 377336848837 cdfp I pHfp | c4fb \ pHfb | S Wm ■:dh p | phFp | ojft- 1 pHfb | i Continuous probability distributions The probability distribution for a continuous random variable, X, is characterized by a function f(x) known as the probability density function (pdf). The pdf has the following properties: f(x) > 0, for all x, and P[X<x]= F(x)= p+co / (x)dx = 1 . J— 00 Probabilities are calculated using the cumulative distribution function (cdf), F(x), defined by P[X <x] = F(x) = f f{g)dl; , where P[X<x] stands for "the J-00 probability that the random variable X is less than the value x". In this section we describe several continuous probability distributions including the gamma, exponential, beta, and Weibull distributions. These distributions are described in any statistics textbook. Some of these distributions make use of a the Gamma function defined earlier, which is calculated in the calculator by using the factorial function as r(x) = (x-1)!, for any real number x. The gamma distribution The probability distribution function (pdf) for the gamma distribution is given by 1 X f (x) = xa~l • exp( ), for x > 0? a > 0? B > 0; paT(a) p Page 1 7-6 The corresponding (cumulative) distribution function (cdf) would be given by an integral that has no closed-form solution. The exponential distribution The exponential distribution is the gamma distribution with a = 1 . Its pdf is given by 1 x /(*) = — -exp(-—), /or x>0,/?>0, while its cdf is given by F(x) = 1 - exp(-x/p), for x>0, p >0. The beta distribution The pdf for the gamma distribution is given by = +J*, \ - x*~l • 0 - *y~i>fi>r ° < * < i>a > w > ° As in the case of the gamma distribution, the corresponding cdf for the beta distribution is also given by an integral with no closed-form solution. The Weibull distribution The pdf for the Weibull distribution is given by f(x) = a-j3' xp~x • exp(-a • xfi\ for x > 0,a > 0,/? > 0 While the corresponding cdf is given by F(x) = 1 - exp(-a • xfi\ for x>0,a >0,j3 > 0 Functions for continuous distributions To define a collection of functions corresponding to the gamma, exponential, beta, and Weibull distributions, first create a sub-directory called CFUN Page 1 7-7 (Continuous FUNctions) and define the following functions (change to Approx mode): Gamma pdf: 'gpdf(x) = xA (cx-l ) *exp ( - x/p) / (PAot* gamma (ot) ) 1 Gamma cdf: 'gcdf(x) = J(0, x, gpdf (t) , t) 1 Beta pdf: 1 Ppdf (x)= GAMMA (a+P) *xA (a-1) * (1-x) A (P-l) / (GAMMA (a) * GAMMA ( P ) ) ' Beta cdf: 1 (Jcdf (x) = 1(0, x, Ppdf (t) ,t) ' Exponential pdf: 'epdf(x) = exp(-x/P)/P' Exponential cdf: 'ecdf(x) = l - exp(-x/P)' Weibull pdf: 'Wpdf(x) = a*p*xA (p-l) *exp (-a*xAP) ' Weibull cdf: 'Wcdf(x) = 1 - exp(-oc*xaP)' Use function DEFINE to define all these functions. Next, enter the values of a and p, e.g., Q^C^(^C3ffl(^ CZDC^D ^w)CE)(3(^) Finally, for the cdf for Gamma and Beta cdf's, you need to edit the program definitions to add ->NUM to the programs produced by function DEFINE. For example, the Gamma cdf, i.e., the function gcdf, should be modified to read: -> x '^NUM( j (0,x,gpdf (t) , t) ) ' * and stored back into EBB. Repeat the procedure for pcdf. Unlike the discrete functions defined earlier, the continuous functions defined in this section do not include their parameters (a and/or p) in their definitions. Therefore, you don't need to enter them in the display to calculate the functions. However, those parameters must be previously defined by storing the corresponding values in the variables a and p. Once all functions and the values a and p have been stored, you can order the menu labels by using function ORDER. The call to the function will be the following: ORDERa'a'/p'/gpdP/gcdP/PpdP/pcdP/epdP/ecdP/WpdP/WcdP}) Following this command the menu labels will show as follows (Press jNxrj to move to the second list. Press jNxrj once more to move to the first list): ■zp-ji- I ccdf | Hpdf | Hojh Page 1 7-8 Some examples of application of these functions, for values of a = 2, p = 3, are shown below. Notice the variable IERR that shows up in the second screen shot. This results from a numerical integration for function gcdf. 2>« 3>p 2. 3. gpdf <l. 2) 3. 93760061 33 1E-2I 3c4f | Bpdf I Bcdf 1.536 ■ 1308 . 154353006737 ppdfC-2) pcdfC-2) epdf(2.3) GcdF | cpdf | i>z>if | Hpdf | H'i'JF 571 gpdf <1. 2) 8.93760061381E-2 gcdf <1.2> 6. 1551 935550 1E-2 ppdf <■£> 1.536 3cdf | ppdf 530067S7 ecdf <2.3> . 535440979639 Npdf < 1 . > .312011699422 Ncdf < 1 . > .364664716763 GcdF I ip.jh I ecdf I Hp-jh | HcdF Continuous distributions for statistical inference In this section we discuss four continuous probability distributions that are commonly used for problems related to statistical inference. These distributions are the normal distribution, the Student's t distribution, the Chi- square (x2) distribution, and the F-distribution. The functions provided by the calculator to evaluate probabilities for these distributions are contained in the MTH/PROBABILITY menu introduced earlier in this chapter. The functions are NDIST, UTPN, UTPT, UTPC, and UTPF. Their application is described in the following sections. To see these functions activate the MTH menu: Cji Jmth and select the PROBABILITY option: HATH HEMJ c.base.. r S.FFT.. 3.C0HFLEH.. li 10. consTAnTS.. 11. special Funcnons.. | PROBABILITY HEMJ 6. UTPC F.UTPF S.UTPn 3. UTPT iO.nDIST I Normal distribution pdf The expression for the normal distribution pdf is: Page 1 7-9 G^ln No- where ja is the mean, and a2 is the variance of the distribution. To calculate the value of f(ju,a2,x) for the normal distribution, use function NDIST with the following arguments: the mean, ju, the variance, a2, and, the value x , i.e., NDIST(|u,a2,x). For example, check that for a normal distribution, f(l. 0,0.5,2.0) = 0.20755374. Normal distribution cdf The calculator has a function UTPN that calculates the upper-tail normal distribution, i.e., UTPN(x) = P(X>x) = 1 - P(X<x). To obtain the value of the upper-tail normal distribution UTPN we need to enter the following values: the mean, \x; the variance, a2; and, the value x, e.g., UTPN((|u,a2,x) For example, check that for a normal distribution, with ja = 1 .0, a2 = 0.5, UTPN(0.75) = 0.638163. Use UTPN(1 .0,0.5,0.75) = 0.638163. Different probability calculations for normal distributions [X is N(ja,a2)] can be defined using the function UTPN, as follows: • P(X<a) = 1 - UTPN(m a2,a) • P(a<X<b) = P(X<b) - P(X<a) = 1 - UTPN(n, a2,b) - (1 - UTPN(n, a2,a)) = UTPNfri, a2,a) - UTPN(ju, a2,b) • P(X>c) = UTPN(m a2,c) Examples: Using ju = 1 .5, and a2 = 0.5, find: P(X<1 .0) = 1 - P(X>1 .0) = 1 - UTPN(1 .5, 0.5, 1 .0) = 0.239750. P(X>2.0) = UTPN(1 .5, 0.5, 2.0) = 0.239750. P(l .0<X<2.0) = F(l .0) - F(2.0) = UTPN(1 .5,0.5,1 .0) - UTPN(1 .5,0.5,2.0) = 0.7602499 - 0.2397500 = 0.524998. Page 17-10 The Student-t distribution The Student-t, or simply, the t-, distribution has one parameter v, known as the degrees of freedom of the distribution. The probability distribution function (pdf) is given by f(t) = 2 (l + _) 2 >_00<^<00 r(^)-V^ where r(a) = (a-1)! is the GAMMA function defined in Chapter 3. The calculator provides for values of the upper-tail (cumulative) distribution function for the t-distribution, function UTPT, given the parameter v and the value of t, i.e., UTPT(v,t). The definition of this function is, therefore, f(t)dt = 1 - f f{t)dt = \-P(T<t) t J-oo For example, UTPT(5,2.5) = 2.7245. ..E-2. Other probability calculations for the t-distribution can be defined using the function UTPT, as follows: • P(T<a) = 1 - UTPT(v,a) • P(a<T<b) = P(T<b) - P(T<a) = 1 - UTPT(v,b) - (1 - UTPT(v,a)) = UTPT(v,a) - UTPT(v,b) • P(T>c) = UTPT(v,c) Examples: Given v = 1 2, determine: P(T<0.5) = 1-UTPT(1 2,0.5) = 0.68694.. P(-0.5<T<0.5) = UTPT(12,-0.5)-UTPT(l 2,0.5) = 0.3738... P(T> -1 .2) = UTPT(1 2,-1 .2) = 0.8733... The Chi-square distribution The Chi-square (x2) distribution has one parameter v, known as the degrees of freedom. The probability distribution function (pdf) is given by Page 17-11 1 --1 -- /(jc) = — x2 -e 2,v>0,x>0 The calculator provides for values of the upper-tail (cumulative) distribution function for the x2-distribution using [UTPC] given the value of x and the parameter v. The definition of this function is, therefore, UTPC(v, x) = f C°f(x)dx = 1-1" f{x)dx = 1 - P(X < x) J t J -00 To use this function, we need the degrees of freedom, v, and the value of the chi-square variable, x, i.e., UTPC(v,x). For example, UTPQ5, 2.5) = 0.776495... Different probability calculations for the Chi-squared distribution can be defined using the function UTPC, as follows: • P(X<a) = 1 - UTPC(v,a) • P(a<X<b) = P(X<b) - P(X<a) = 1 - UTPC(v,b) - (1 - UTPC(v,a)) = UTPC(v,a) - UTPC(v,b) • P(X>c) = UTPC(v,c) Examples: Given v = 6, determine: P(X<5.32) = 1-UTPC(6,5.32) = 0.4965.. P(1.2<X<10.5) = UTPC(6,1.2)-UTPC(6,10.5) = 0.8717... P(X> 20) = UTPC(6,20) = 2.769.. E-3 The F distribution The F distribution has two parameters vN = numerator degrees of freedom, and vD = denominator degrees of freedom. The probability distribution function (pdf) is given by Page 17-12 The calculator provides for values of the upper-tail (cumulative) distribution function for the F distribution, function UTPF, given the parameters vN and vD, and the value of F. The definition of this function is, therefore, UTPF(vN,vD,F) = \ f{F)dF = \-\ f(F)dF = \-P(Z<F) J t J -oo For example, to calculate UTPF(10,5, 2.5) = 0.161834... Different probability calculations for the F distribution can be defined using the function UTPF, as follows: • P(F<a) = 1 - UTPF(vN, vD,a) • P(a<F<b) = P(F<b) - P(F<a) = 1 -UTPF(vN, vD,b)- (1 - UTPF(vN, vD,a)) = UTPF(vN, vD,a) - UTPF(vN, vD,b) • P(F>c) = UTPF(vN, vD,a) Example: Given vN = 10, vD = 5, find: P(F<2) = 1-UTPF(1 0,5,2) = 0.7700... P(5<F<10) = UTPF(1 0,5,5) -UTPF(1 0,5, 10) = 3.4693. .E-2 P(F>5) = UTPF(1 0,5,5) = 4.4808. .E-2 Inverse cumulative distribution functions For a continuous random variable X with cumulative density function (cdf) F(x) = P(X<x) = p, to calculate the inverse cumulative distribution function we need to find the value of x, such that x = F_1(p). This value is relatively simple to find for the cases of the exponential and Weibull distributions since their cdf's have a closed form expression: Page 17-13 • Exponential, F(x) = 1 -exp(-x/p) • Weibull, F(x)= l-exp(-axp) (Before continuing, make sure to purge variables a and p). To find the inverse cdPs for these two distributions we need just solve for x from these expressions, i.e., Exponential: : SOLVE -x 6 P=l-e ,'x' x=-(p-LH(-(F-l»J| Weibull: SOLVElp=l-e /x1 x=e LH[ LH(-(p-1h1 P For the Gamma and Beta distributions the expressions to solve will be more complicated due to the presence of integrals, i.e., ^ f X 1 a-\ , Z x r • Gamma, p = z -exp( )dz ioJ3ar(a) P . Beta, f-r(a + l) ^ _ ^ A numerical solution with the numerical solver will not be feasible because of the integral sign involved in the expression. However, a graphical solution is possible. Details on how to find the root of a graph are presented in Chapter 1 2. To ensure numerical results, change the CAS setting to Approx. The function to plot for the Gamma distribution is Y(X) = j(0,X,zA(a-l)*exp(-z/p)/(pAa*GAMMA(a)),z)-p For the Beta distribution, the function to plot is Y(X) = I(0,X, z A (a- 1 ) * ( 1 -z) A (p- 1 ) * GAMMA(a+p)/(GAMMA(a) * GAMMA(p)),z)-p To produce the plot, it is necessary to store values of a, p, and p, before attempting the plot. For example, for a = 2, p = 3, and p = 0.3, the plot of Y(X) for the Gamma distribution is shown below. (Please notice that, because Page 17-14 of the complicated nature of function Y(X), it will take some time before the graph is produced. Be patient.) a: V -6.5 -3.1 e.s There are two roots of this function found by using function USED within the plot environment. Because of the integral in the equation, the root is approximated and will not be shown in the plot screen. You will only get the message Constant? Shown in the screen. However, if you press [enter] at this point, the approximate root will be listed in the display. Two roots are shown in the right-hand figure below. V -6.5 Constant? 6.5 (-1.9,0.) Alternatively, you can use function lililE;!! 1(1193)1 to estimate the roots by tracing the curve near its intercepts with the x-axis. Two estimates are shown below: V V — 6.5 r=5.aHE-3 V -I 1 1 1 ^^_L — V -6.5 f:5.71E-H These estimates suggest solutions x = -1 .9 and x = 3.3. You can verify these "solutions" by evaluating function Yl (X) for X = -1 .9 and X = 3.3, i.e., :Y1(-1.9) :Y1(3.3) .009244101213 , 000970724234 Page 17-15 For the normal, Student's t, Chi-square (y2), and F distributions, which are represented by functions UTPN, UTPT, UPTC, and UTPF in the calculator, the inverse cuff can be found by solving one of the following equations: • Normal, • Student's t, • Chi-square, • F distribution: p = 1 - UTPN(li,g2,x) p = 1 - UTPT(v,t) p = 1 - UTPC(v,x) p = 1 - UTPF(vN,vD,F) Notice that the second parameter in the UTPN function is a2, not a2, representing the variance of the distribution. Also, the symbol v (the lower- case Greek letter no) is not available in the calculator. You can use, for example, y (gamma) instead of v. The letter y is available thought the character set (CB^s)- For example, to obtain the value of x for a normal distribution, with ju = 10, a2 = 2, with p = 0.25, store the equation /p=l-UTPH<! \x». <j2*. x)' into variable EQ (figure in the left-hand side below). Then, launch the numerical solver, to get the input form in the right-hand side figure: 'P=l . -UTPHCu,cr2,xi>EQ P=l.-UTPNCtJL,(T2,x> ^ EtUflTIOl"! §§§§§§§§§§§§§§§§§ Eq=p=l,-UTPH<UL,g2,X> p: p^j^rn^t^ M.: Enter ual.u« or press SOLVE The next step is to enter the values of li, a2, and p, and solve for x: SOLVE EGUATIOM Eq:p=l.-UTPhKtJL3<T£?X> P= -25 K= 10 &Z: 2 X= 9.04612.. Enter ugUjg or pfjJJ SOLVE 1 1 I H^M^Tl 1 1 II lllllllHII This input form can be used to solve for any of the four variables involved in the equation for the normal distribution. Page 17-16 To facilitate solution of equations involving functions UTPN, UTPT, UTPC, and UTPF, you may want to create a sub-directory UTPEQ were you will store the equations listed above: 'P=l . -UTPHCu,cr2,xi>EQH P=1.-UTPNCui(t2,x 'p=l--UTPTKt3*EQT P=l. -UTPT t>?U 'p=l--UTPCKxi>EQC P=l.-UTPC<^jX> 'P=l - -UTPFt-*N^D,F)»EQF P=1.-UTPF^HJ^D,F> Thus, at this point, you will have the four equations available for solution. You needs just load one of the equations into the EQ field in the numerical solver and proceed with solving for one of the variables. Examples of the UTPT, UTPC, and UPTF are shown below: SOLVE EGUfiTIOn Eq=p=l.-UTPT<^t> P= .25 r- 15 -.691196948958 Enter ualm or pregj SOLVE SOLVE EGUATIOn Eg:p=l.-UTPC(-v?x> p= .68 r- 10 11.498778181: Enter uaUje or pfjjj SOLVE inFO |S0LVE SOLVE EGUfiTIOn Eq:p=l.-UTPF(-vH?-vD?F> .25 i& : 14 vn= 18 Enter uqlue or press SOLVE Notice that in all the examples shown above, we are working with p = P(X<x). In many statistical inference problems we will actually try to find the value of x for which P(X>x) = a. Furthermore, for the normal distribution, we most likely will be working with the standard normal distribution in which li =0, and a2 = 1 . The standard normal variable is typically referred to as Z, so that the problem to solve will be P(Z>z) = a. For these cases of statistical inference problems, we could store the following equations: Page 17-17 ,ffl=UTPN(0.,l.Jz)*EQNfl o:=UTPH(0. , 1. ?z> 'ffl=UTPTKt)>EQTfl oc=UTPT<^Pt> '*=UTPCK>d'KQCfl «=UTPC(-Vjx> : ,ffl=UTPF(^H/yDiF)*EQFfi ffl=UTPF<^HP^DPF> With these four equations, whenever you launch the numerical solver you have the following choices: HeHory: Select: PROG sECnfl PROG r-Li| PROG sECF PROG Sil »E4C PROG SECT PROG Examples of solution of equations EQNA, EQTA, EQCA, and EQFA are shown below: SOLVE EGURTIOn Eq=ffl=UTPN<8. ,11PZ) «: .05 1 .64435362695 Enter uql.ue or press SOLVE SOLVE ECURTIOn Eq:ffl=UTPT<"fPt> .05 15 Enter uqlue or press SOLVE SOLVE EGURTIOn Eq=«=UTPC<^X> 05 25 37.6524341335 Enter uaUe or press SOLVE fcaaa^M^Mffl 1 1 n hn mm SOLVE EGURTIOn Eq=«=UTPF<^H,^D,F> «= .05 5^ = 3 F: aEggBi Enter ualue or press SOLVE ehi^m^ti 1 1 ii hn n inn Page 17-18 Chapter 1 8 Statistical Applications In this Chapter we introduce statistical applications of the calculator including statistics of a sample, frequency distribution of data, simple regression, confidence intervals, and hypothesis testing. Pre-programmed statistical features The calculator provides pre-programmed statistical features that are accessible through the keystroke combination Lr^J_^( (same key as the number L5J key). The statistical applications available in the calculator are: 3 Frequencies.. 3 Fit data.. H L'UHH'iry ftatf.. 5 Hypoth. tests.. 6 ConF. interuaL. These applications are presented in detail in this Chapter. First, however, we demonstrate how to enter data for statistical analysis. Entering data For the analysis of a single set of data (a sample) we can use applications number 1, 2, and 4 from the list above. All of these applications require that the data be available as columns of the matrix SDAT. This can be accomplished by entering the data in columns using the matrix writer, This operation may become tedious for large number of data points. Instead, you may want to enter the data as a list (see Chapter 8) and convert the list into a column vector by using program CRMC (see Chapter 10). Alternatively, you can enter the following program to convert a list into a column vector. Type the program in RPN mode: * OBJ^ 1 2 ^LIST HARRYS- Page 18-1 Store the program in a variable called LXC. After storing this program in RPN mode you can also use it in ALG mode. To store a column vector into variable SDAT use function STOZ, available through the catalog (CB-^ ), e.g., STOZ (ANS(l)) in ALG mode. Example 1 - Using the program LXC, defined above, create a column vector using the following data: 2.1 1.2 3.1 4.5 2.3 1.1 2.3 1.5 1.6 2.2 1.2 2.5. In RPG mode, type in the data in a list: {2.1 1.2 3.1 4.5 2.3 1.1 2.3 1.5 1.6 2.2 1.2 2.5 }(^!!I!H Use function STOS to store the data into SDAT. Calculating single-variable statistics Assuming that the single data set was stored as a column vector in variable ZDAT. To access the different STAT programs, press Lr?J_^ . Press ECU to select 1. Single-var.. There will be available to you an input form labeled SINGLE-VARIABLE STATISTICS, with the data currently in your SDAT variable listed in the form as a vector. Since you only have one column, the field Col: should have the value l in front of it. The Type field determines whether you are working with a sample or a population, the default setting is Sample. Move the cursor to the horizontal line preceding the fields Mean, Std Dev, Variance, Total, Maximum, Minimum, pressing the I^IDl! soft menu key to select those measures that you want as output of this program. When ready, press Sill!:!!!!!. The selected values will be listed, appropriately labeled, in the screen of your calculator. Example 1 -- For the data stored in the previous example, the single-variable statistics results are the following: Mean: 2.133, Std Dev: 0.964, Variance: 0.929 Total: 25.6, Maximum: 4.5, Minimum: 1.1 Page 1 8-2 Definitions The definitions used for these quantities are the following: Suppose that you have a number data points xl7 x2, x3/ representing different measurements of the same discrete or continuous variable x. The set of all possible values of the quantity x is referred to as the population of x. A finite population will have only a fixed number of elements Xj. If the quantity x represents the measurement of a continuous quantity, and since, in theory, such a quantity can take an infinite number of values, the population of x in this case is infinite. If you select a sub-set of a population, represented by the n data values {xl7 x2, xn}, we say you have selected a sample of values of x. Samples are characterized by a number of measures or statistics. There are measures of central tendency, such as the mean, median, and mode, and measures of spreading, such as the range, variance, and standard deviation. Measures of central tendency The mean (or arithmetic mean) of the sample, x, is defined as the average value of the sample elements, x= — ^xr n i=x The value labeled Total obtained above represents the summation of the values of x, or ZXj = n- x. This is the value provided by the calculator under the heading Mean. Other mean values used in certain applications are the geometric mean, xg, or the harmonic mean, xh, defined as: -ni — _L-V_L Examples of calculation of these measures, using lists, are available in Chapter 8. The median is the value that splits the data set in the middle when the elements are placed in increasing order. If you have an odd number, n, of ordered elements, the median of this sample is the value located in position Page 1 8-3 (n+l)/2. If you have an even number, n, of elements, the median is the average of the elements located in positions n/2 and (n+l)/2. Although the pre-programmed statistical features of the calculator do not include the calculation of the median, it is very easily to write a program to calculate such quantity by working with lists. For example, if you want to use the data in ZDAT to find the median, type the following program in RPN mode (see Chapter 21 for more information on programming in User RPL language).: ■*: ^ nC * RCLZ DUP SIZE 2 GET IF 1 > THEN nC COL- SWAP DROP OBJ^ 1 + ->ARRY END OBJ^ OBJ^ DROP DROP DUP n ■*: ^LIST SORT IF 'n MOD 2 == 0' THEN DUP 'n/27 EVAL GET SWAP '(n+1 )/2' EVAL GET + 2 / ELSE '(n+l)/2' EVAL GET END "Median" ^TAG * Store this program under the name MED. An example of application of this program is shown next. Example 2 - To run the program, first you need to prepare your SDAT matrix. Then, enter the number of the column in ZDAT whose median you want to find, and press lllulll!. For the data currently in IDAT (entered in an earlier example), use program MED to show that Median: 2.15. The mode of a sample is better determined from histograms, therefore, we leave its definition for a later section. Measures of spread 1 n The variance (Var) of the sample is defined as sx = / t (xf — x) . n-\ M The standard deviation (St Dev) of the sample is just the square root of the variance, i.e., sx. The range of the sample is the difference between the maximum and minimum values of the sample. Since the calculator, through the pre-programmed statistical functions provides the maximum and minimum values of the sample, you can easily calculate the range. Page 1 8-4 Coefficient of variation The coefficient of variation of a sample combines the mean, a measure of central tendency, with the standard deviation, a measure of spreading, and is defined, as a percentage, by: Vx = (sx/ x)l 00. Sample vs. population The pre-programmed functions for single-variable statistics used above can be applied to a finite population by selecting the Type: Population in the single-variable statistics screen. The main difference is in the values of the variance and standard deviation which are calculated using n in the denominator of the variance, rather than (n-1 ). Example 3 - If you were to repeat the exercise in Example 1 of this section, using Population rather than Sample as the Type, you will get the same values for the mean, total, maximum, and minimum. The variance and standard deviation, however, will be given by: Variance: 0.852, Std Dev: 0.923. Obtaining frequency distributions The application 2. Frequencies., in the STAT menu can be used to obtain frequency distributions for a set of data. Again, the data must be present in the form of a column vector stored in variable ZDAT. To get started, press (j-H stat<^v? iiiiii=!=ili:iiiilii . The resulting input form contains the following fields: EDAT: the matrix containing the data of interest. Col: the column of ZDAT that is under scrutiny. X-Min: the minimum class boundary (default = -6.5). Bin Count: the number of classes(default = 1 3). Bin Width: the uniform width of each class (default = 1 ). Definitions To understand the meaning of these parameters we present the following definitions: Given a set of n data values: {xl7 x2, xn} listed in no particular order, it is often required to group these data into a series of classes by counting the frequency or number of values corresponding to each class. (Note: the calculators refers to classes as bins). Page 1 8-5 Suppose that the classes, or bins, will be selected by dividing the interval (xbot, xtop), into k = Bin Count classes by selecting a number of class boundaries, i.e., {xB], xB2, xBk+1}, so that class number 1 is limited by xBrxB2, class number 2 by xB2- xB3, and so on. The last class, class number k, will be limited by xBk- xBk+1. The value of x corresponding to the middle of each class is known as the class mark, and is defined as xMj = (xBj + xB i+1)/2, for i = 1 , 2, k. If the classes are chosen such that the class size is the same, then we can define the class size as the value Bin Width = Ax = (xmax - xmin) / k, and the class boundaries can be calculated as xBj = xbot + (i - 1 ) * Ax. Any data point, Xj, j = 1 , 2, n, belongs to the i-th class, if xB;< Xj < xB i+1 The application 2. Frequencies., in the STAT menu will perform this frequency count, and will keep track of those values that may be below the minimum and above the maximum class boundaries (i.e., the outliers). Example 1 - In order to better illustrate obtaining frequency distributions, we want to generate a relatively large data set, say 200 points, by using the following: • First, seed the random number generator using: RDZt 25) in ALG mode, or 25 [enter) RDZ in RPN mode (see Chapter 17). • Type in the following program in RPN mode: ■*: ^ n * 1 n FOR j RAND 100 * 2 RND NEXT n ^LIST :*■ and save it under the name RDLIST (RanDom number LIST generator). • Generate the list of 200 number by using RDLIST(200) in ALG mode, or 298 [enter) in RPN mode. • Use program LXC (see above) to convert the list thus generated into a column vector. • Store the column vector into SDAT, by using function STOZ. Page 1 8-6 • Obtain single-variable information using: LrD stat BIS. Use Sample for the Type of data set, and select all options as results. The results for this example were: Mean: 51.0406, Std Dev: .29.5893..., Variance: 875.529... Total: 10208.12, Maximum: 99.35, Minimum: 0.13 This information indicates that our data ranges from values close to zero to values close to 1 00. Working with whole numbers, we can select the range of variation of the data as (0,1 00). To produce a frequency distribution we will use the interval (1 0,90) dividing it into 8 bins of width 1 0 each. • Select the program 2. Frequencies., by using LHJ_^^3? BIS. The data is already loaded in ZDAT, and the option Col should hold the value 1 since we have only one column in ZDAT. • Change X-Min to 1 0, Bin Count to 8, and Bin Width to 1 0, then press :::::::::P!::::::: Using the RPN mode, the results are shown in the stack as a column vector in stack level 2, and a row vector of two components in stack level 1 . The vector in stack level 1 is the number of outliers outside of the interval where the frequency count was performed. For this case, I get the values [ 25. 22.] indicating that there are, in my ZDAT vector, 25 values smaller than 1 0 and 22 larger than 90. • Press J to drop the vector of outliers from the stack. The remaining result is the frequency count of data. This can be translated into a table as shown below. This table was prepared from the information we provided to generate the frequency distribution, although the only column returned by the calculator is the Frequency column (fj. The class numbers, and class boundaries are easy to calculate for uniform-size classes (or bins), and the class mark is just the average of the class boundaries for each class. Finally, the cumulative frequency is obtained by adding to each value in the last column, except the first, the frequency in the next row, and replacing the result in the last column Page 1 8-7 of the next row. Thus, for the second class, the cumulative frequency is 1 8+1 5 = 33, while for class number 3, the cumulative frequency is 33 + 16 = 49, and so on. The cumulative frequency represents the frequency of those numbers that are smaller than or equal to the upper boundary of any given class. Class No. i Class Bound. Class mark. Xm, Frequency f; Cumulative frequency XB; XB i+1 <XBt outlier below range 25 1 10 ! 20 15 18 18 2 20 30 25 14 32 3 30 40 35 17 49 4 40 50 45 17 66 5 50 60 55 22 88 6 60 70 65 22 110 7 70 80 75 24 134 k = 8 80 90 85 19 153 >XBk outliers above range 22 Given the (column) vector of frequencies generated by the calculator, you can obtain a cumulative frequency vector by using the following program in RPN mode: ■*: DUP SIZE 1 GET ^ freq k * {k 1} 0 CON ^ cfreq * 'freq(l,l)' EVAL 'cfreq(l,l)' STO 2 k FOR j 'cfreq(j-l ,1 ) +freq(j,l)' EVAL 'cfreq (j,l)' STO NEXT cfreq * Save it under the name CFREQ. Use this program to generate the list of cumulative frequencies (press MSSM with the column vector of frequencies in the stack). The result, for this example, is a column vector representing the last column of the table above. Page 1 8-8 Histograms A histogram is a bar plot showing the frequency count as the height of the bars while the class boundaries shown the base of the bars. If you have your raw data (i.e., the original data before the frequency count is made) in the variable ZDAT, you can select Histogram as your graph type and provide information regarding the initial value of x, the number of bins, and the bin width, to generate the histogram. Alternatively, you can generate the column vector containing the frequency count, as performed in the example above, store this vector into SDAT, and select Barpiot as your graph type. In the next example, we show you how to use the first method to generate a histogram. Example 1 - Using the 200 data points generated in the example above (stored as a column vector in SDAT), generate a histogram plot of the data using X-Min = 10, Bin Count = 16, and Bin Width = 5. • First, press CSDi^ (simultaneously, if in RPN mode) to enter the PLOT SETUP screen. Within this screen, change Type: to Histogram, and check that the option Col: 1 is selected. Then, press (nxt)WEEM. • Next, press LjnJ ML (simultaneously, if in RPN mode) to enter the PLOT WINDOW - HISTOGRAM screen. Within that screen modify the information to H-View: 1 0 90, V-View: 0 1 5, Bar Width: 5. • Press MBMi llillillll to generate the following histogram: • Press H3EEHS to return to the previous screen. Change the V-view and Bar Width once more, now to read V-View: 0 30, Bar Width: 10. The new histogram, based on the same data set, now looks like this: Page 1 8-9 A plot of frequency count, fj, vs. class marks, xMj, is known as a frequency polygon. A plot of the cumulative frequency vs. the upper boundaries is known as a cumulative frequency ogive. You can produce scatterplots that simulate these two plots by entering the proper data in columns 1 and 2 of a new ZDAT matrix and changing the Type: to scatter in the PLOT SETUP window. Fitting data to a function y = f(x) The program 3, Fit data.., available as option number 3 in the STAT menu, can be used to fit linear, logarithmic, exponential, and power functions to data sets (x,y), stored in columns of the SDAT matrix. In order for this program to be effective, you need to have at least two columns in your SDAT variable. Example 1 - Fit a linear relationship to the data shown in the table below: X 0 1 2 3 4 5 y 0.5 2.3 3.6 6.7 7.2 11 First, enter the two rows of data into column in the variable SDAT by using the matrix writer, and function STOS. To access the program 3. Fit data.., use the following keystrokes: iJ+J_sm<^?<^?WBM The input form will show the current SDAT, already loaded. If needed, change your set up screen to the following parameters for a linear fitting: _fit data;! EDAT : _ Hod«u Linear Fit [[ 0. .5 ] [ 1. Enter statistic l_dgtg 1 1 1 HI 1 1 1 1 \^mfi 1 1 II I III HB I ■ Page 18-10 • To obtain the data fitting press EC9. The output from this program, shown below for our particular data set, consists of the following three lines in RPN mode: 3: '0.195238095238 + 2.00857142857*X' 2: Correlation: 0.983781424465 1 : Covariance: 7.03 Level 3 shows the form of the equation. In this case, y = 0.06924 + 0.00383 x. Level 2 shows the sample correlation coefficient, and level 1 shows the covariance of x-y. Definitions For a sample of data points (x,y), we define the sample covariance as 1 n sxy = — -y) n — v i=x The sample correlation coefficient for x,y is defined as r = xy xy Where sx, sy are the standard deviations of x and y, respectively, i.e. 1 n 1 n si n-\ i=l n-\ i=l The values sxy and rxy are the "Covariance" and "Correlation," respectively, obtained by using the "Fit data" feature of the calculator. Linearized relationships Many curvilinear relationships "straighten out" to a linear form. For example, the different models for data fitting provided by the calculator can be linearized as described in the table below. Page 18-11 Type of Fitting Actual Model Linearized Model Indep. variable Depend. Variable Covar. Linear y = a + bx [same] X y Sxy Log. y = a + b ln(x) [same] ln(x) y S|n(x),y Exp. y = a eDX ln(y) = ln(a) + bx X ln(y) Sx,ln(y) Power y = axD ln(y) = ln(a) + b ln(x) ln(x) ln(y) S|n(x),ln(y) The sample covariance of ^,r| is given by s, = ^ (<^. -^){rji -rj) n-l Also, we define the sample variances of E, and r|, respectively, as n i i=i n i i=x The sample correlation coefficient r^ is r, = The general form of the regression equation is r| = A + B^. Best data fitting The calculator can determine which one of its linear or linearized relationship offers the best fitting for a set of (x,y) data points. We will illustrate the use of this feature with an example. Suppose you want to find which one of the data fitting functions provides the best fit for the following data: X 0.2 0.5 1 1.5 2 4 5 10 y 3.16 2.73 2.12 1.65 1.29 0.47 0.29 0.01 First, enter the data as a matrix, either by using the Matrix Writer and entering the data, or by entering two lists of data corresponding to x and y and using Page 18-12 the program CRMC developed in Chapter 10. Next, save this matrix into the statistical matrix 2DAT, by using function STOZ. Finally, launch the data fit application by using: Lr^J _JBT ^r? <^r? ECEII1 . The display shows the current ZDAT, already loaded. Change your set up screen to the following parameters if needed: EDflT: EC ■ 2 3-16 ] C .... 1 Y-C0l: 2 Mods: i. : Press IE!!!!, to get: 1 : '3.99504833324*EXP(-.579206831 203*X)' 2: Correlation: -0.996624999526 3: Covariance: -6.23350666124 The best fit for the data is, therefore, y = 3.995 e058x. Obtaining additional summary statistics The application 4. Summary stats., in the STAT menu can be useful in some calculations for sample statistics. To get started, press L r> j STAl once more, move to the fourth option using the down-arrow key ^3? , and press !!!!!E!I!!!!!!!. The resulting input form contains the following fields: SDAT: the matrix containing the data of interest. X-Col, Y-Col: these options apply only when you have more than two columns in the matrix ZDAT. By default, the x column is column 1 , and the y column is column 2. _zx_ ZY...: summary statistics that you can choose as results of this program by checking the appropriate field using [VCHK] when that field is selected. Many of these summary statistics are used to calculate statistics of two variables (x,y) that may be related by a function y = f(x). Therefore, this program can be thought off as a companion to program 3. Fit data.. Example 1 - For the x-y data currently in SDAT, obtain all the summary statistics. Page 18-13 • To access the summary stats... option, use: OJ^^?^?^iIl • Select the column numbers corresponding to the x- and y-data, i.e., X-Col: 1, and Y-Col: 2. • Using the IKiilllEi key select all the options for outputs, i.e., _ZX, _IY, etc. • Press B™1 to obtain the following results: XX: 24.2, ZY: 1 1 .72, ZX2: 148.54, ZY2: 26.6246, ZXY: 12.602, NZ:8 Note: There are two other applications under the STAT menu, namely, 5. Hypth. tests., and 6, Conf. Interval.. These two applications will be discussed later in the chapter. Calculation of percentiles Percentiles are measures that divide a data set into 100 parts. The basic procedure to calculate the 1 00 p-th Percentile (0 < p < 1) in a sample of size n is as follows: 1 . Order the n observations from smallest to largest. 2. Determine the product n-p A. If n-p is not an integer, round it up to the next integer and find the corresponding ordered value. B. If n-p is an integer, say k, calculate the mean of the k-th and (k-1) th ordered observations. Note: Integer rounding rule, for a non-integer x.yz..., if y > 5, round up to x+1 ; if y < 5, round up to x. This algorithm can be implemented in the following program typed in RPN mode (See Chapter 21 for programming information): ■*: SORT DUP SIZE ^ p X n *: n p * ^ k * IF k CEIL k FLOOR - NOT THEN X k GET X k 1 + GET + 2 / ELSE k 0 RND X SWAP GET END :*■ * Page 18-14 which well store in variable %TILE (percent-tile). This program requires as input a value p within 0 and 1, representing the lOOp percentile, and a list of values. The program returns the 1 OOp percentile of the list. Example 1 - Determine the 37% percentile of the list {21013512367 9}. In RPN mode, enter 0.27 (^{21013512367 9} [enter} |%fflJO. In ALG mode, enter %TILE(0.27,{2, 1 ,0, 1 ,3,5, 1 ,2,3,6,7,9}. The result is 1 . The STAT soft menu All the pre-programmed statistical functions described above are accessible through a STAT soft menu. The STAT soft menu can be accessed by using, in RPN mode, the command: 96 MENU You can create your own program, say !!=!:!i!i!!i!ii!i!!l!i, to activate the STAT soft menu directly. The contents of this program are simply: £ 96 MENU 3\ The STAT soft menu contains the following functions: Pressing the key corresponding to any of these menus provides access to different functions as described below. The DATA sub-menu The DATA sub-menu contains functions used to manipulate the statistics matrix ZDATA: The operation of these functions is as follows: 2+ : add row in level 1 to bottom of ZDATA matrix. Z- : removes last row in SDATA matrix and places it in level of 1 of the stack. The modified ZDATA matrix remains in memory. CLE : erases current ZDATA matrix. Page 18-15 ZDAT: places contents of current ZDATA matrix in level 1 of the stack. C5DZDAT: stores matrix in level 1 of stack into ZDATA matrix. The ZPAR sub-menu The ZPAR sub-menu contains functions used to modify statistical parameters. The parameters shown correspond to the last example of data fitting. Intercept: 3.995048333 Slope: -.579206331203 hlodel: EXPFIT The parameters shown in the display are: Xcol: indicates column of ZDATA representing x (Default: 1) Ycol: indicates column of SDATA representing y (Default: 2) Intercept: shows intercept of most recent data fitting ((Default: 0) Slope: shows slope of most recent data fitting (Default: 0) Model: shows current data fit model (Default: UNFIT) The functions listed in the soft menu keys operate as follows: XCOL: entered as n EI5EH, changes Xcol to n. YCOL: entered as n EH31, changes Ycol to n. ZPAR: shows statistical parameters. RESET: reset parameters to default values INFO: shows statistical parameters The MODL sub-menu within ZPAR This sub-menu contains functions that let you change the data-fitting model to UNFIT, LOGFIT, EXPFIT, PWRFIT or BESTFIT by pressing the appropriate button. The 1 VAR sub menu The 1VAR sub menu contains functions that are used to calculate statistics of columns in the SDATA matrix. Page 18-16 The functions available are the following: TOT: show sum of each column in ZDATA matrix. MEAN: shows average of each column in ZDATA matrix. SDEV: shows standard deviation of each column in ZDATA matrix. MAXZ: shows maximum value of each column in ZDATA matrix. MINZ: shows average of each column in ZDATA matrix. BINS: used as xs/ Ax, n [BINS], provides frequency distribution for data in Xcol column in ZDATA matrix with the frequency bins defined as [xs,xs+Ax], [xs,xs+2Ax],..., [xs,xs+nAx]. VAR: shows variance of each column in ZDATA matrix. PSDEV: shows population standard deviation (based on n rather than on (n-1)) of each column in ZDATA matrix. PVAR: shows population variance of each column in SDATA matrix. MINZ: shows average of each column in ZDATA matrix. The PLOT sub-menu The PLOT sub-menu contains functions that are used to produce plots with the data in the ZDATA matrix. The functions included are: BARPL: produces a bar plot with data in Xcol column of the ZDATA matrix. HISTP: produces histogram of the data in Xcol column in the SDATA matrix, using the default width corresponding to 1 3 bins unless the bin size is modified using function BINS in the 1 VAR sub-menu (see above). SCATR: produces a scatterplot of the data in Ycol column of the ZDATA matrix vs. the data in Xcol column of the ZDATA matrix. Equation fitted will be stored in the variable EQ. Page 18-17 The FIT sub-menu The FIT sub-menu contains functions used to fit equations to the data in columns Xcol and Ycol of the ZDATA matrix. l: ^| H^iHHI;aiJ;H^IJ;H.VjE4];l;l»l>l The functions available in this sub-menu are: ZLINE: provides the equation corresponding to the most recent fitting. LR: provides intercept and slope of most recent fitting. PREDX: used as y lllillli!!:!:!, given y find x for the fitting y = f(x). PREDY: used as x 111:111!, given x find y for the fitting y = f(x). CORR: provides the correlation coefficient for the most recent fitting. COV: provides sample co-variance for the most recent fitting PCOV: shows population co-variance for the most recent fitting. The SUMS sub-menu The SUMS sub-menu contains functions used to obtain summary statistics of the data in columns Xcol and Ycol of the ZDATA matrix. IX : provides the sum of values in Xcol column. ZY : provides the sum of values in Ycol column. ZXA2 : provides the sum of squares of values in Xcol column. SYA2 : provides the sum of squares of values in Ycol column. ZX*Y: provides the sum of x-y, i.e., the products of data in columns Xcol and Ycol. NE : provides the number of columns in the SDATA matrix. Example of STAT menu operations Let ZDATA be the matrix shown in next page. • Type the matrix in level 1 of the stack by using the Matrix Writer. • To store the matrix into SDATA, use: illliEi!! C3D BED Page 18-18 Calculate statistics of each column: EEED EH39: lil'iiYil'ii IffiTH produces [38.5 87.5 82799.8] produces [5.5. 12.5 11828.54...] produces [3.39... 6.78... 21097.01 ...] produces [10 21.5 55066] produces [1.1 3.7 7.8] produces [1 1.52 46.08 445084146.33] produces [3.142... 6.284... 19532.04...] produces [9.87... 39.49... 381500696.85. Data: 1.1 3.7 7.8 3.7 8.9 101 2.2 5.9 25 5.5 12.5 612 6.8 15.1 2245 9.2 19.9 24743 10.0 21.5 55066 Generate a scatterplot of the data in columns 1 and 2 and fit a straight line to it: ■■!:!r:-vr:i :i:!lll!:«v":« resets statistical parameters 6: Kcol: 1- Vcol: 2. Intercept: 0. Slope: 0. Model: L INF IT ll^llHJlfEJJll^llllti^HiliJ [nxtJ mm MSm ESSE produces scatterplot draws data fit as a straight line Page 18-19 nr*m'^:T:Tjjgjj«n,uir*i,Tji SliluSa returns to main display Determine the fitting equation and some of its statistics: siiiii fill iiiiiH 3 1 IIBII! jjjCHHj,j.j produces ' i.5+2*xf produces Intercept: 1.5, Slope: 2 produces 0.75 produces 3. 50 produces 1 .0 produces 23.04 produces 1 9.74... Obtain summary statistics for data in columns 1 and 2: ilillii! i!]3I!:!l!: produces 38.5 produces 87.5 produces 280.87 produces 1 370.23 produces 61 9.49 produces 7 Fit data using columns 1 (x) and 3 (y) using a logarithmic fitting: ® BED Em 3 mSM select Ycol = 3, and lllll Emm select Model = Logfit II Hcol: 1. Vcol: 3. Intercept: 1.5 Slope: 2. Model: LOGFIT nijTrjjTrriT^jiiii^iynui Page 1 8-20 f , ,.,-r *\ !:sii!ls:i"!i:": :"":'::ivi:": produce scattergram of y vs. x show line for log fitting Obviously, the log-fit is not a good choice. ili!]!!!!!!!!!! returns to normal display. • Select the best fitting by using: BIB mm mm iiliiiilii! shows EXPFIT as the best fit for these data P1 6: Kcol: 1. Vcol: 3. Intercept: 2. 6545321 32 Slope: .992727735591 Model: EXPFIT { nxt ) IliYil Hp |::1"111|]T| am 2300 mm 5 0 (jvxT) lllijElj! 113333 I1I3I1 produces '2.6545*EXP(0.9927*X)' produces 0.99995... (good correlation) produces 6.81 39 produces 463.37 produce scattergram of y vs. x show line for log fitting To return to STAT menu use: [nxtJ mEM To get your variable menu back use Page 18-21 Confidence intervals Statistical inference is the process of making conclusions about a population based on information from sample data. In order for the sample data to be meaningful, the sample must be random, i.e., the selection of a particular sample must have the same probability as that of any other possible sample out of a given population. The following are some terms relevant to the concept of random sampling: • Population: collection of all conceivable observations of a process or attribute of a component. • Sample: sub-set of a population. • Random sample: a sample representative of the population. • Random variable: real-valued function defined on a sample space. Could be discrete or continuous. If the population follows a certain probability distribution that depends on a parameter 9, a random sample of observations (X1,X2,X3,... , Xn), of size n, can be used to estimate 0. • Sampling distribution: the joint probability distribution of X1,X2,X3,... , Xn. • A statistic: any function of the observations that is quantifiable and does not contain any unknown parameters. A statistic is a random variable that provides a means of estimation. • Point estimation: when a single value of the parameter 9 is provided. • Confidence interval: a numerical interval that contains the parameter 9 at a given level of probability. • Estimator: rule or method of estimation of the parameter 9. • Estimate: value that the estimator yields in a particular application. Example 1 - Let X represent the time (hours) required by a specific manufacturing process to be completed. Given the following sample of values of X: 2.2 2.5 2.1 2.3 2.2. The population from where this sample is taken is the collection of all possible values of the process time, therefore, it is an infinite population. Suppose that the population parameter we are trying Page 1 8-22 to estimate is its mean value, u.. We will use as an estimator the mean value _ | n of the sample, X, defined by (a rule): X = — • / Xx . n i=i For the sample under consideration, the estimate of ja is the sample statistic x = (2.2+2.5+2. 1+2. 3+2. 2)/5 = 2.36. This single value of X, namely x = 2.36, constitutes a point estimation of the population parameter ju. Estimation of Confidence Intervals The next level of inference from point estimation is interval estimation, i.e., instead of obtaining a single value of an estimator we provide two statistics, a and b, which define an interval containing the parameter 0 with a certain level of probability. The end points of the interval are known as confidence limits, and the interval (a,b) is known as the confidence interval. Definitions Let (C\,CU) be a confidence interval containing an unknown parameter 9. • Confidence level or confidence coefficient is the quantity (1-a), where 0 < a < 1 , such that P[Q < 6 < CJ = 1 - a, where P[ ] represents a probability (see Chapter 1 7). The previous expression defines the so- called two-sided confidence limits. • A lower one-sided confidence interval is defined by Pr[Q < 0] = 1 - a. • An upper one-sided confidence interval is defined by Pr[0 < CJ = 1 - a. • The parameter a is known as the significance level. Typical values of a are 0.01, 0.05, 0.1, corresponding to confidence levels of 0.99, 0.95, and 0.90, respectively. Confidence intervals for the population mean when the population variance is known Let X be the mean of a random sample of size n, drawn from an infinite population with known standard deviation a. The 100(1 -a) % [i.e., 99%, 95%, 90%, etc.], central, two-sided confidence interval for the population mean ju is ( X-za/2-a/Vn , X+za/2-a/Vn ), where za/2 is a standard normal variate that is exceeded with a probability of a /2. The standard error of the sample mean, X, is -a/Vn. Page 1 8-23 The one-sided upper and lower 100(1 -a) % confidence limits for the population mean u. are, respectively, X+za-a/Vn , and X-za-a/Vn . Thus, a lower, one-sided, confidence interval is defined as (-00 , X+za-a/Vn), and an upper, one-sided, confidence interval as (X-za-a/Vn,+oo). Notice that in these last two intervals we use the value za, rather than za/2. In general, the value zk in the standard normal distribution is defined as that value of z whose probability of exceedence is k, i.e., Pr[Z>zk] = k, or Pr[Z<zk] = 1 - k. The normal distribution was described in Chapter 17. Confidence intervals for the population mean when the population variance is unknown Let X and S, respectively, be the mean and standard deviation of a random sample of size n, drawn from an infinite population that follows the normal distribution with unknown standard deviation a. The 100-(l-a) % [i.e., 99%, 95%, 90%, etc.] central two-sided confidence interval for the population mean ju, is ( X- tn.l a/2 -S /Vn , X+ tn.l a/2 -S/Vn ), where tn.l a/2 is Student's t variate with v = n-1 degrees of freedom and probability a/2 of exceedence. The one-sided upper and lower 100- (1-a) % confidence limits for the population mean \i are, respectively, X + tn_W2 -S/Vn , and X- tn_W2 S /Vn. Small samples and large samples The behavior of the Student's t distribution is such that for n>30, the distribution is indistinguishable from the standard normal distribution. Thus, for samples larger than 30 elements when the population variance is unknown, you can use the same confidence interval as when the population variance is known, but replacing a with S. Samples for which n>30 are typically referred to as large samples, otherwise they are small samples. Confidence interval for a proportion A discrete random variable X follows a Bernoulli distribution if X can take only two values, X = 0 (failure), and X = 1 (success). Let X ~ Bernoulli(p), where p Page 1 8-24 is the probability of success, then the mean value, or expectation, of X is E[X] = p, and its variance is Var[X] = p(l-p). If an experiment involving X is repeated n times, and k successful outcomes are recorded, then an estimate of p is given by p'= k/n, while the standard error of p' is ap>= V(p-(l-p)/n) . In practice, the sample estimate for p, i.e., p' replaces p in the standard error formula. For a large sample size, n>30, and n-p > 5 and n-(l-p)>5, the sampling distribution is very nearly normal. Therefore, the lOO(l-a) % central two-sided confidence interval for the population mean p is (p'+za/2-ap<, p'+za/2-cy ). For a small sample (n<30), the interval can be estimated as (p'-tn.-| a/2-ap',p'+tn. l,a/2,c>p')- Sampling distribution of differences and sums of statistics Let S] and S2 be independent statistics from two populations based on samples of sizes n] and n2, respectively. Also, let the respective means and standard errors of the sampling distributions of those statistics be jus1 and u.S2, and as1 and aS2, respectively. The differences between the statistics from the two populati ons, S]-S2, have a sampling distribution with mean u. $i-s2 — mi ~ juS2, and standard error a S1_S2 = (as12+ aS22)1/2. Also, the sum of the statistics Tt+T2 has a mean u. S1+S2 = u.s1 +u.S2, and standard error asl+S2 = (as12 + Estimators for the mean and standard deviation of the difference and sum of the statistics S] and S2 are given by: _2 2 ° S\ , ° S2 In these expressions, and X2 are the values of the statistics and S2 from samples taken from the two populations, and as12 and aS22 are the variances of the populations of the statistics S] and S2 from which the samples were taken. Page 1 8-25 Confidence intervals for sums and differences of mean values If the population variances a^and a22 are known, the confidence intervals for the difference and sum of the mean values of the populations, i.e., jut+u^, are given by: + ^,(X1±X2) + za/2 For large samples, i.e., n} > 30 and n2 > 30, and unknown, but equal, population variances c]2= a22, the confidence intervals for the difference and sum of the mean values of the populations, i.e., u^iu^, are given by: {Xx±X2)-zal2 . + ^^Xx±X2) + zal2 ■ + ■ If one of the samples is small, i.e., < 30 or n2 < 30, and with unknown, but equal, population variances o2 = a22, we can obtain a "pooled" estimate of the variance of |a1±jLi2, as sp2 = [(nrl )-s12+(n2-l )-s22]/( n1+n2-2). In this case, the centered confidence intervals for the sum and difference of the mean values of the populations, i.e., (ii+(i2, are given by: ((X, ±X2)-tVta/2 -s2p, (Xi ±X2) + tv>a/2 -s]) where v = n!+n2-2 is the number of degrees of freedom in the Student's t distribution. In the last two options we specify that the population variances, although unknown, must be equal. This will be the case in which the two samples are taken from the same population, or from two populations about which we suspect that they have the same population variance. However, if we have Page 1 8-26 reason to believe that the two unknown population variances are different, we can use the following confidence interval ((Jf, ± x2 ) - tVra/2 ■ 4_±j2 , (xx ± x2 ) + tv,a/2 ■ 4_±j2 ) where the estimated standard deviation for the sum or difference is and n, the degrees of freedom of the t variate, are calculated using the integer value closest to [(512/n1)/(n1-l)] + [(522/n2)/(/72-l)] Determining confidence intervals The application 6. Conf Interval can be accessed by using Lr> J_^gi^ SECIIi. The application offers the following options: Confidence intervals a.I-inT: MI-M2.. 3.2-inT: i P.. H.s-inT: Pi-pa.. 5.T-inT: i H_. e.T-inT: m-wa.. These options are to be interpreted as follows: 1. Z-INT: 1 ju.: Single sample confidence interval for the population mean, ju, with known population variance, or for large samples with unknown population variance. 2. Z-INT: jli1-|li2.: Confidence interval for the difference of the population means, jar \i2/ with either known population variances, or for large samples with unknown population variances. Page 1 8-27 3. Z-INT: 1 p.: Single sample confidence interval for the proportion, p, for large samples with unknown population variance. 4. Z-INT: pi- p2.: Confidence interval for the difference of two proportions, prp2/ for large samples with unknown population variances. 5. T-INT: 1 ju.: Single sample confidence interval for the population mean, ju, for small samples with unknown population variance. 6. T-INT: |ul-ja2.: Confidence interval for the difference of the population means, u.r ju2, for small samples with unknown population variances. Example 1 - Determine the centered confidence interval for the mean of a population if a sample of 60 elements indicate that the mean value of the sample is x = 23.2, and its standard deviation is s = 5.2. Use a = 0.05. The confidence level is C = 1-a = 0.95. Select case 1 from the menu shown above by pressing IEIIIIIL Enter the values required in the input form as shown: conF. im. = i KnoHn t 23.3 5.2 60. Press IllSIill to obtain a screen explaining the meaning of the confidence interval in terms of random numbers generated by a calculator. To scroll down the resulting screen use the down-arrow key ^3? . Press 1132!! when done with the help screen. This will return you to the screen shown above. To calculate the confidence interval, press The result shown in the calculator is: mmiS.Z ConFid«n« inttrva L mm critics z=±l. 959964 n Hin =£1.93424 u hox =£4.61576 ^■^■IlMiiFiffniiiwnnafliM Page 1 8-28 The result indicates that a 95% confidence interval has been calculated. The Critical z value shown in the screen above corresponds to the values ±za/2 in the confidence interval formula ( X-za/2-a/Vn , X+za/2-a/Vn ). The values u. Min and u. Max are the lower and upper limits of t