0% found this document useful (0 votes)
18 views88 pages

Mathcad: Getting Started

The document provides instructions for solving nonlinear and linear systems of equations using various methods in Mathcad, including solve blocks, solvers, and matrix calculations. It details the steps for defining functions, inserting guess values, and applying constraints to find intersection points of functions. Additionally, it covers formatting worksheets and inserting mathematical expressions within text regions.

Uploaded by

n
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
18 views88 pages

Mathcad: Getting Started

The document provides instructions for solving nonlinear and linear systems of equations using various methods in Mathcad, including solve blocks, solvers, and matrix calculations. It details the steps for defining functions, inserting guess values, and applying constraints to find intersection points of functions. Additionally, it covers formatting worksheets and inserting mathematical expressions within text regions.

Uploaded by

n
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 88
122925, 3:11 PM “Task 1-2: Nonlinear System of Equations Totals > Solving > Task 1-2: Nonlinear System of Equations Task 1-2: Nonlinear System of Equations ‘As seen in the previous task, solve blocks provide a natural environment for easily defining problems. Solve blocks are more general than solvers or matrix calculation. For example, find the coordinates of the crossing point of two nonlinear functions. yl (2) :=—17+0.8 2” yi(a)=U-2+01 2° yl) u2(x) Solving with a Solve Block 1. Press Ctrl+7 to insert a solve block region, and then insert the following items: ° The definition of functions y7 and y2 © Guess values for the coordinates of the crossing point based on the graph » Two constraints for the two unknowns © The solve block function find, automatically assigned the keyword label ‘ntps:fsuppor pte. combhelpiathcadi0.O/eniindex himitpage/PTC_ Mathcad Help/Tutofalsisv_tutratlask'-2rontinear_system_of_equatons him 1/3 “Task 1-2: Nonlinear System of Equations 32225, 3:11 Pt aT 40.8 2° 11-2+0.12° yi (@) =v2(e) y =u (2) o.e4 find (ry) | “AL “| Solving with a Solver Recall the functions y7 and y2 h(a (a) =11-240.12" You can define a new function f(x) = y2(x) -y1(x. F(x)=(11-2+04 2')—(ar+os v) 58-2-082° +01 2° fi The newly defined function fcrosses the x-axis at the same x value as the crossing point of the nonlinear functions. fis a polynomial, so you can use the polyroots function instead of the more general root solver to find where fcrosses the x-axis. 1. Assign the polynomial coefficients to vector c. The first element of cis the intercept and the next elements are the coefficients for each power of x, in ascending order. 58 -1 [ I “=|_09. l i | " 2. Call the polyroots function, r_system_ol equations himit 2/3 ‘ntps:tsupport pte. comhelpiathcadi0,Oieniindex himitpage/PTC_ Mathcad, Help/Tutoralsisv_tutoraltaskt-2_rontine 122925, 3:11 PM “Task 1-2: Nonlinear System of Equations [-6.644 1 rs=polyroots(c)=| 7.322+5.804i| | 7.322-5.804i] ‘B+ The polyroots function returns a vector of all real and complex solutions, and the real solutions are listed first. + On the other hand, solve blocks return one solution at a time. To find other solutions, you must try other guess values 3. Calculate the horizontal and vertical coordinates of the intersection point (hv). 6.644 ut (r,})=—11.885 4. Use a vertical and a horizontal marker to show the intersection point on the plot. Proceed to Task 1-3. Was this helpful? © © ‘ntps:tsupport pte. comhelpiathcadi0,Oieniindex himitpage/PTC_ Mathcad, Help/Tutoralsisv_tutoraltaskt-2_rontine (_system_o_equations hii 122925, 3:11 PM ‘Task 1-1: Linear System of Equations Tutorials > Solving > Task 1~1: Linear System of Equations Task 1-1: Linear System of Equations Read the problem defined below, and then find the solution using the following methods: + Matrix calculation + Solver + Solve block Problem Definition The following functions are linear functions t 75) Mase 78) y2(x)=-0.82+1 They intersect as shown in the following plot: u(x) u2(x) You want to find the coordinates of the crossing point (x, y) where the following equations hold true: ‘ntps:fsuppor pte. combhelpiathcadi0,Ofenlindex himitpage/PTC_ Mathcad _Help/Tutofalsisv_tutrallask'-1_linear_system_of_equalions.himi# 1/6 122925, 3:11 PM “Task 1-1: Linear System of Equations (e785) Bet] The equations can be rearranged so that the variables are on the left side of the equations: OS rty= The equations can be rewritten in terms of vectors and matrices: ‘ Each vector and matrix in the equation above can be represented by a variable: MX The arrays Mand vare known, but Xis unknown. Xis a 2-element vector representing the xand y coordinates of the crossing point. Solving with Matrix Calculation 1. Define the matrix Mand the vector v, lt 2. Define Xas the product of the inverse of matrix Mand vector v. X=M ew 3. Evaluate x. [ey] The x value of the crossing point is 5.714 and the y value is -0.714. Solving with a Solver ‘ntps:fsupport pte. comhelpiathcadi0,Ofeniindex himitpage/PTC_ Mathcad _Help/Tutofasisv_tutorattaskt-t_tinear_system_¢ 218 ‘za, 3:11 Pm Task 1-1: Linear Sytem of Equations Solvers are functions for solving specific problems. You can use the Isolve builtin function to find the coordinates of the crossing point. 1. Define matrix Mand vector v. 2e-[ 2. Call the Isolve function. 5.714 0.714 Solving with a Solve Block Ma solve (AM A solve block is an area in which you define your problem using natural notation. You do not need to rearrange the equations as you did for matrix calculation and for the solver. Recall the linear functions y7 and y2 y2(a) = 0.3041 The following solve block uses the find function to calculate the crossing point of the two functions: wel — —f1 ysl — ul (2) =y2(2) >] u=yl (2) —— snacen=| 9] [3] Where: 1. Guess value for each unknown 2. Constraint for each unknown 3. Solve block function 1. To find the coordinates of the crossing point u functions y7 and y2in your worksheet. ‘ntps:fsupport pte. comhelpiathcadi0,Ofeniindex himitpage/PTC_ Mathcad _Help/Tutofasisv_tutorattaskt-t_tinear_system_¢ ais 122925, 3:11 PM “Task 1-1: Linear System of Equations 2. To insert a solve block region, on the Math tab, in the Regions group, click Solve Block. t Guess Values aa Constraints Solver To resize a solve block region, you can drag one of its three square handles. When you move a solve block in your worksheet, all the regions in the solve block move with it. 3. _ Inthe solve block region, type guess values for your problem. PTC Mathcad uses the guess values as the starting point for finding the solution. 4, Type the constraints that limit the problem. You must use the Boolean operators when you define constraints. Insert the Boolean equal to operator. 46 ‘ntps:fsupport pte. comhelpiathcadi0,Ofeniindex himitpage/PTC_ Mathcad _Help/Tutofasisv_tutorattaskt-t_tinear_system_¢ 122925, 3:11 PM ul (a) =02 (x) y=ul (2) The first constraint defines the value of xat the crossing point, and the second constraint defines the value of yat that point. 5. Insert the solve block function name and arguments. Here, type find, and then type x and yas the function arguments. The label of find is automatically set to keyword. ul (a) =02 (x) y =i (x) find (2, ») 6. Evaluate the solve block, ul (a) =02 (x) y=ul (2) Find (= o-[ 554] Proceed to Task 1-2. ‘ntps:fsupport pte. comhelpiathcadi0,Ofeniindex himitpage/PTC_ Mathcad _Help/Tutofasisv_tutorattaskt-t_tinear_system_¢ ‘Task 1-1: Linear System of Equations 56 122925, 3:11 PM ‘Task 1-1: Linear System of Equations Was this helpful? © Q ‘ntps:tsupport pte. comihelpimathcadi0.O/enlindex himitpage/PTC_ Mathcad _Help/Tutofasisv_tutrallask'-1_linear_system_of_oqualions.himi# 6/6 122925, 3:11 PM ‘Task 6-4: Formatting a Worksheet Tutorials > Getting Started > Task 6-4: Formatting a Worksheet Task 6-4: Formatting a Worksheet Global Formatting of Math Regions 1. Open anew worksheet and type in the following two math regions. n+5 y The default math font is Mathcad UniMath Prime, the default font size is 11, and the default font color is black. 2. Insert a text region (Font=Arial, Font Size=10) that contains a math region. The sum ofx and y iss ¢+y=11 3. Insert another math region for evaluating y. y=8 4. Click anywhere in the worksheet, excluding the math or text regions. On the Math Formatting tab, in the Math Font group, select 16 from the Font Size drop-down menu. The size of math in all the math regions becomes 16. The size of the text remains unchanged. Te3. y=rtd The sum of xandy is: t+-y=11 y=8 Global Formatting of Text Regions 1. Click anywhere in the worksheet, excluding the math and text regions 2. On the Text Formatting tab, in the Text Font group, select 20 from the Font Size drop-down menu. The size of text remains unchanged. 3. Insert a new text region and type in the shown text. The font size of the new text is 20 ‘ntps:tsupport pte. comhelpiathcadi10loniindex himitpage/PTC. Mathcad_Help/Tutoralsigs_tutorialtaské-4_formatting_a_worksheet hemi 4 7025, 51 PM Task 54 Forating a Worksheet w=3 y=at5 The sum ofxandyis: e+ Yy=11 y=8 New size of text. Congratulations! You have completed the Getting Started Tutorial. Was this helpful? © Q ‘ntps:tsupport pte. comhelpiathcadi10loniindex himitpage/PTC. Mathcad_Help/Tutoralsigs_tutorialtaské-4_formatting_a_worksheet hemi 9122125, 3:10PM “Task 6-3: Inserting and Formatting Math in Text ‘Tutorials > Getting Started > Task 6-3: Inserting and Formatting Math in Text Task 6-3: Inserting and Formatting Math in Text Inserting Math in Text Regions 1. Open anew worksheet, and then insert the following math expression m=1kg 2. On the Math tab, in the Regions group, click Text Box to insert a text box re¢ 3. Type in the following text. This is the math equation that sums up the theory of relativity 4. Onthe Math tab, in the Regions group, click Math to insert a math region inside the text box region, and type the equation E’=m.c*. 5 the math equation that sums up the theory of relativity: Z:=m-c'] PTC Mathcad treats the entered math region as any other math region in the worksheet. 5. Type in the following text and evaluate E. Kg B=(8.988-10") J Evaluate energy E when 6. Select the math region and then on the Math Formatting tab, in the Math Font group, select Wide Latin from the Font drop down list. The math expression takes on the selected formatting option Evaluate energy E when m=1kg E2=($.988-107°) a 7. Select the math region and then on the Math Formatting tab, in the Math Font group, select red from the Font Color drop down palette. The math expression takes on the selected formatting option. Evaluate energy E when m=1kg. -(S.986-107°).7 8. Select the math region and then on the Math Formatting tab, in the Math Font group, select yellow from the Highlight Color drop down palette. The math expression region takes on the selected formatting option. 9. Select the math region and then on the Math Formatting tab, in the Results group, select (Engineering) from the Result Format drop down list. The math expression takes on the ntpsifsupport pe comvhelplmatcad0.Olelindex himlpage/PTC_ Mathcad Hop/Tuorillgs tloraltask3.insetng_and,formating_math int. 12 9122725, 3:10PM “Task 6-3: Inserting and Formatting Math in Text selected formatting option. 9 B-(69.876-10") 7 10. Select the math region and then on the Math Formatting tab, in the Math Font group, click Decrease Font Size twice. The font size of the expression becomes 9. Evaluate energy E when m=1kg 2=(85.876 20%) a Evaluate energy E when 11. Select the math region and then on the Math Formatting tab, inthe Math Font group, click Remove Format. The format of the math expression is restored. Evaluate energy E when m=1 kg E=(89.876- 10").J Proceed to Task 6-4. Was this helpful? G Q ntps:ifsupport.pe.comvhelpimatheadi0, lenlindex.hmMpage/PTC_ Mathcad, Help/Tutoalsigs_tuloraltasks-3ingerting_and formating math... 212 9122125, 3:10PM. Task 62: Inserting Page Breaks an Images ‘Tutorials > Getting Started > Task 6-2: Inserting Page Breaks and Images Task 6-2: Inserting Page Breaks and Images 1. Inthe shipping.mcdx worksheet, place the blue insertion crosshair below the plot and press Ctrl+Enter to insert a page break. You can also insert a page break by clicking Add Page Break ‘on the Document tab, in the Spacing group. 2. To insert an image in the new page, click Image on the Document or the Math tab. A button labeled Browse for Image appears in the worksheet. Click the button and browse for an image to insert. 3. Insert an image and save the file. 4. Insert a text block above the image and type in a paragraph of text. The text block pushes the image down the page as it expands. Proceed to Task 6-3. Was this helpful? © 9 -ntps:ifsupport.pe.comhelpimatheadi0,Olentindex.himpage/PTC_ Mathcad, Help/Tutoraligs_tulorialtask6-2.ineeting_page_breaks_and_images... 1/4 9122125, 3:10PM Task 6-1: Inserting and Formating Text Tutorials > Getting Started > Task 6-1: Inserting and Formatting Text Task 6-1: Inserting and Formatting Text In the Worksheet Area Open the shipping.mcdx worksheet you saved in Task 5-2 The data in this worksheet describes the weight, value, and freight charges of imported goods ‘that were shipped from Mexico to the state of Vermont in May 2009. The data is taken from the Bureau of Transportation Statistics. To add a title, click on the top-left comer of the worksheet grid and press Ctrl+Shift+T. A text block stretches across the full page. Alternatively, on the Math tab, in the Regions group, click Text Block. Type the following text: Import from Mexico to the state of Vermont in May 2009. To format the title text style, select the title text and then, on the Text Formatting tab, in the Text Font group, select the following options: © Font: Arial ° Font size: 16 Font style: Bold © On the Text Formatting tab, in the Paragraph group, select Center Text To add space, click between the title and the data table and press Enter a few times. You can press Delete or Backspace to remove unnecessary space between regions. To insert a text box in the space between the title and the table, press Ctrl+T. Add the following text for describing the data in the table: Weight. Commodity weight in kilograms Value: Commodity value in U.S. $ Charges: Aggregate shipping charges on imports in U.S. $ Format the text in the text box as needed Save the worksheet. In the Header or Footer Area anne To insert and format text in the worksheet header, double-click the area above the grid Alternatively, on the Document tab, in the Headers and Footers group, click Header. To insert the date when the file was last saved, click the top-left corner of the header area, and then on the Document tab, in the Headers and Footers group, click Saved Date and select the mm/dd/yyyy date format. To insert the file name, click below the saved date region, and then click File and select Name. Scroll to the bottom of the worksheet, and then double-click in the center of the footer area. To insert the page number, click # Page Number and select Page #. Save the worksheet Proceed to Task 6-2. ‘ntps:fsupport pte. comhelpimathcadi0.Olonlindex himitpage/PTC. Mathcad, Help/Tutofasigs tutorial 1k6-4_inertng_and formatting texthimi# 4/2 122125, 3:10 PM Task 6-1: Inserting and Formating Text Was this helpful? © Q ‘ntpe:ifsupport.pte.convhelpimatheadi0, lenlindex.himMpage/PTC_ Mathcad, Help/Tutoalsigs_tulorialitaké-+_ingerting_and formatting exthimié 212 9122125, 3:10PM “Task 6-2: Formatting a Pot Tutorials > Getting Started > Task 5-2: Formatting a Plot Task 5-2: Formatting a Plot 1. Open the Excel sheet shipping_data. Highlight the cells that contain data from A170'U3, are copy your selection to the clipboard. To paste the data into a table, in a new PTC Mathcad worksheet, press Ctrl+V. 2608 11 881592 79 © 19707101 3155 117092 298 1769331 9364336 18000 299704 660375 3110 3080 4ATA0A 996047 1087 559 76468 4349 Ina table, each column is a data set. The first row contains the name of each data set, the second row defines the units of each data set (if any), and the remaining rows contain the data. 2. Add the names of the data sets and their units where needed. Weight Value Charges (ks) 6626982 1280 BM 92 7 19707101 3155 117092298 1769531 $3646 18900 290704 660375 15642 S110 3080 200 47404 996047 1087 559 761684340 3. Use tables to define column vectors. Afterward, you can work with the column vectors in your worksheet ‘ntps:fsupport pte.comhelpiathcadi0,Ofeniindex himitpage/PTC_ Mathcad _Help/Tutoasigs_tutoralitaskS-2.formattin_a_plot nimi 18 9122125, 3:10PM “Task 6-2: Formatting a Pot Weight= 4, Onthe Plots tab, in the Traces group, click insert Plot and select XY Plot. An empty XY plot region appears. Drag the y-axis legend to the left of the plot, if necessary. 5. Inthe y-axis placeholder, type Value. To insert a new y-axis expression, press Shift+Enter and then type Charges. Click the x-axis placeholder and then type Weight. Press Enter. The following two traces appear. Notice that the kg unit appears automatically in the unit placeholder next to Weight. 6. Click Value. On the Plots tab, in the Styles group, select the color red from the Trace Color list. Select the solid square symbol from the Symbol list Click Charges. Click Symbol and select a cross. ‘ntps:fsupport pte.comhelpiathcadi0,Ofeniindex himitpage/PTC_ Mathcad _Help/Tutoasigs_tutoralitaskS-2.formattin_a_plot nimi 218 9122125, 3:10PM “Task 6-2: Formatting a Pot Vatue Charges Weight (kg) 7. Click Weight. Select (none) from the Line Style list. Both line traces disappear. Weight (kg) 8. Restore the line traces to Value and Charges. Click Value then in the Axes group, click Logarithmic Scaling, The scale of the y-axis changes to logarithmic. Click Weight then Logarithmic Scaling to change the scale of the x-axis to logarithmic. ‘ntps:fsupport pte.comhelpiathcadi0,Ofeniindex himitpage/PTC_ Mathcad _Help/Tutoasigs_tutoralitaskS-2.formattin_a_plot nimi ais 9122125, 3:10PM “Task 6-2: Formatting a Pot set} ee Vatue a Pe =" ° weight (kg) 9. To restore the scientific scale to the y-axis, click Value then in the Axes group, click Logarithmic Scaling. To restore the scientific scale to the x-axis, click Weight then click Logarithmic Scaling Vatue Charges Weight (kg) 10. Drag each axis to a new location between any two tick marks. Each axis snaps to a tick mark on the other axis, ‘ntps:fsupport pte.comhelpiathcadi0,Ofeniindex himitpage/PTC_ Mathcad _Help/Tutoasigs_tutoralitaskS-2.formattin_a_plot nimi 46 9122125, 3:10PM “Task 6-2: Formatting a Pot Vatue Charges Weight (kg) 11. To force the axes to cross at 0, click Value then in the Axes group, click Cross Axes at 0,0. The axes return to their previous positions. 12. Save the worksheet under the name shipping.mcdx. 13. To close shipping .mcdx, press Ctrl+W. Practice Before you move on to the next exercise 1. Copy and paste the definitions of vectors X and ¥to your worksheet. 2. Copy and paste the definitions of y(x) and /to your worksheet. Breall 40 3. Manually create the following plot. ‘ntps:fsupport pte.comhelpiathcadi0,Ofeniindex himitpage/PTC_ Mathcad _Help/Tutoasigs_tutoralitaskS-2.formattin_a_plot nimi 56 9122125, 3:10PM “Task 6-2: Formatting a Pot Proceed to Exercise 6. Was this helpful? © 9 ‘ntps:fsupport pte. comhelpimathcadi0.Olentindex.himitpage/PTC. Mathcad, Help/Tutofalsigs_ tutorial iaskS-2_formatting_a_plot him 68 9122125, 3:10PM “Task 6-1: Creating @ Plt wth Mutiple Traces ‘Tutorials > Getting Started > Task 5-1: Creating a Plot with Multiple Traces Task 5-1: Creating a Plot with Multiple Traces 1. Define the function below. Insert the absolute value operator. u(x) =2 |x| +sin (x) 2. On the Plots tab, in the Traces group, click insert Plot, and select XY Plot. An empty plot appears. 3. Inthe y-axis placeholder, to the left or right of the plot, type 18. Select and drag the y-axis, legend to the left, if necessary. 4. Inthe x-axis placeholder, to the bottom of the plot, type x. Press Enter or click outside the plot region. A line trace appears. You can move from one placeholder to the next by pressing Tab or Shift+Tab. Ignore the unit placeholders for this task. -ntpe:ifsuppor.pte.comvhelpimatheadi0,Olenlindex.hmMpage/PTC_ Mathcad, Help/Tutoalsigs_tuloraltakS-*_creating_a_plot_with_mutiple lace... 1/4 9122125, 3:10PM “Task 6-1: Creating @ Plt wth Mutiple Traces 18 5. Place the cursor to the right of 78. Click Add Trace. A new y-axis placeholder appears below the current one. 1s | When you place the cursor to the leftmost insertion point of an axis expression, and then you add an axis expression, the axis placeholder appears above the current one. 6. Type 76 - 0.05 x in the y-axis placeholder. Press Enter. A second trace appears. ntpe:ifsupport.pe.comhelpimatheadi0,Olenlindex.himlpage/PTC_ Mathcad, Help/Tutoaligs_tulorialtakS-*_creating_a_plot_with_mutiple tace... 214 9122125, 3:10PM “Task 5-1: Creating @ Plt with Mutiple Traces 18. 16-0.05 x 7. _ Insert two additional y-axis placeholders and type the following two expressions. 8 To change the trace color of an expression, such as y(3), click the expression and then on the Plots tab, in the Styles group, click Trace Color, and select a color. ntps:ifsupport.pte.comvhelpimatheadi0.Olenlindex.hmlpage/PTC_ Mathcad, Help/Tutoalsigs_tuloralitaskS-*_creating_a_plot_with_mutiple tace.... 3I4 9122125, 3:10PM Task 5-4 rating @ Plot with Muliple Traces + The axis expressions can contain built-in or user-defined functions. + The y-axis expressions must have the same independent variable as the x-axis expressions. Here, the independent variable is x. + You can use one axis-expression to define more than one trace, such as the x-axis expression for this plot. Proceed to Task 5-2. Was this helpful? © Q ‘ntps:tsupport pte. comhelpimathcadi0,Ofoniindex himitpage/PTC_ Mathcad,_Help/Tutoralsigs_ tutorial iaskS-1_ereating_a_plot_with_mutiple_tace... 4/4 9122125, 3:10PM Task 4-8: Extracting Data om Matrices Tutorials > Getting Started > Task 4-3: Extracting Data from Matrices. Task 4-3: Extracting Data from Matrices 1. Define the following matrix. ea is 1 0 204 3 6 4 5 9 7 2 6 2. Type X. To insert the row operator, press Ctrl+Shift+R. Type O in the empty placeholder and then evaluate the expression. xe. [«a? «BY «O” «D>? The first row of matrix X contains strings. You can use strings for adding headers in matrices. The rules for editing strings are slightly different than for editing numbers. For example, you can insert spaces in a string: “abe de f g” 3. To extract the number of rows and columns from matrix X, call the rows and cols buil functions. m rows (X) ts (X) 4. To extract the numbers from matrix X, call the submatrix function. submatrix (X,1,m—1,0,n—1) T1810 a 24 3 at 645 9 15 7216 The arguments for submatrix are as follows: the name of the matrix, the indices of the first and of the last rows to extract, the indices of the first and of the last columns to extract. Function arguments are described in the Help. 5. To extract the highest number from matrix Y, call max. 6. To extract the second column of Y, insert the column operator. The keyboard shortcut for the column operator is Ctrl+Shift+C. -ntpe:ifsuppor.pte.comvhelpimatheadi0,Olenlindex.hmMpage/PTC_ Mathcad, Help/Tutoalsigs_tuloraltaskt-3 extracting data from_matices.himit 112 9122125, 3:10PM Task 4-8: Extracting Data om Matrices You can combine functions and operators in expressions. For example, you can extract the lowest number from the second column of mattix ¥: min( ot) Practice Before you move on to the next exercise, define M, v, and Pusing different methods for inserting arrays. 4 8 M=\5 l2 P=Mew wees Extract the second row of Pand its highest number. You can check your result by evaluating P. Redefine the first element of Pby a string, such as “header Proceed to Exercise 5. Was this helpful? © 9 ntps:ifsupport.pte.comvhelpimatheadi0,lenlindex.hmMpage/PTC_ Mathcad, Help/Tutoalsigs_tuloraltask4-3 extracting data from_matices.nimit 212 9122125, 3:09 PM Task 4-2: Defining Matrices Tutorials > Getting Started > Task 42: Defining Matrices: Task 4-2: Defining Matrices 1. To define matrix A, type Al Asl] 2. Type 1 42, pressing Shift+Spacebar between each number. Ax[1 42] 3. To insert a row, press ShifttEnter, or place the pointer on the last element of the matrix (2 in this case) and press Tab. fe |B To edit matrices from the Ribbon, on the Matrices/Tables tab, in the Rows and Columns group, select one of the options. 4, Place the cursor in the leftmost empty placeholder. Type 5 6 2 7 9 18 5 4, pressing Tab between each number. 4 wee 5. Type Band then insert the definition operator. Bs 6. On the Matrices/Tables tab, in the Matrices and Tables group, click Insert Matrix. To insert a matrix with 4 rows and 3 columns, drag the pointer for a 4 x 3 matrix 7. Type the following numbers in the empty placeholders: or e 8. Define matrix C. Assign to this variable an expression that contains A and B. ‘ntps:fsupport pte. comhelpiathcadi10.lonlindex himitpage/PTC._ Mathead_Help/Tutoralsigs_tutorialtasks.2_defining_matices himit 4 9122125, 3:09 PM Task 4-2: Defining Matticas 10 18 15) 18 237 2427 wn 28 17 20 BAL BH When you add matrices, they must be of the same size, Here, both A and Bare 4 x 3 matrices. 9. Evaluate elements of matrix C. © To evaluate the first element of matrix C, type C, insert the Matrix Index operator, and then type 0,0= + To evaluate the third element of the first column, type C, insert the Matrix Index operator, and then type 2, © To evaluate the second element of the second column, type C, insert the Matrix Index operator, and then type 1,1= The indices are counted from the top leftmost element. The indices of the first element are controlled by the system variable ORIGIN. You can change ORIGIN on the Calculation tab or in your worksheet. The default value of ORIGINis 0, so the indices of the first matrix element are (0,0). 10. Assign new values to these three elements. For the first element, type C, insert the Matrix Index operator, and then type 0,0:0 Cc =o When you evaluate G you can see the elements that you have redefined: 0 18 15 1k o0 7 027. 28 17 20 Range Variables and Complex Numbers 1. To create two range variables, type i:0..1 and then j:0..2 ‘ntps:fsupport pte. comhelpiathcadi10.lonlindex himitpage/PTC_ Mathead_Help/Tutoralsigs_tutorialtask.2_defining_matices himit 24 9122125, 3:09 PM Task 4-2: Defining Matticas Arange variable defines a number sequence. You can define range variables using the range operator or the step range operator. For more information on the difference between these two ‘operators, refer to the Operators book in the Help. 2. To display the sequence of numbers associated with each range variable, evaluate the range variables. When you evaluate a range variable, its sequence of numbers is presented as a column vector. However, range variables and column vectors have different properties. For example, you cannot plot a range variable against a column vector. 3. To define several matrix elements at once, insert the range variables as indices, and then refer to the range variables in the math expression. BH, 2014305 You must include a scaling or multiplication operator between the integers and the /or the j Otherwise, PTC Mathcad identifies the terms 2/and 3/as imaginary numbers: i +3) |B To change the format of complex results, on the Math Formatting tab, in the Results group, select a format from the Complex Values list. 5j 5} 5) 5j 5) 5) Proceed to Task 4-3. Was this helpful? © Q ‘ntps:fsupport pte. comhelpiathcadi10.lonlindex himitpage/PTC._ Mathead_Help/Tutoralsigs_tutorialtasks.2_defining_matices himit 122125, 3.09 PM Task 4-2: Defining Matrices bitps1/support pte. comhelpmathcad10,0/enindex himifpage/PTC. Mathcad, HelpTutorialsigs_tutor haskd-2_defning_matices mit aa 9122125, 3:09 PM “Task 4-1: Inserting Vectors Tutorials > Getting Started > Task 41: Inserting Vectors Task 4-1: Inserting Vectors Vectors are matrices with only one row or column. They are used to store one-dimensional data sets. 1. Toinsert the matrix operator, type [ (left square bracket) for a 1-element array. {] 2. Type 24659, pressing Tab between each number to insert a new row. [ eaeee 3. For a matrix template, on the Matrices/Tables tab, in the Matrices and Tables group, click Insert Matrix. To insert a row vector with 1 row and 6 columns, drag the pointer for a 1 x 6 matrix. [ 1 4. Type the following numbers in the empty placeholders. To move from one placeholder to the other, press Tab to move forward or Shift+Tab to move backward, or press the Arrow keys. [8 4.01 33 2) 5. Evaluate the following expression using your preferred method to enter vectors: Ei u 6. Tocalculate the dot product of two vectors, multiply them together. i 7. To group the two vectors, place the cursor to the left of the math region, and then press Spacebar twice. On the Math tab, in the Operators and Symbols group, click Operators and select the Vectorization operator from the Vector and Matrix list. Enter = to evaluate the expression. The vectors are multiplied term-by-term, =74 3 24 6|Jo|"| o 7) 7] [49 ‘ntps:tsupport pte. comhelpimathcadi10.loniindex humitpage/PTC. Mathcad_Help/Tutoralsigs_tutorialtas4-1_inserting_vectors tit 4. 9122125, 3:09 PM “Task 4-1: Inserting Vectors Proceed to Task 4-2. Was this helpful? © ‘ntps:fsupport pte. comhelpimathcadi0.O/eniindex humitpage/PTC. Mathcad _Help/Tutofasigs_ tutorial iask-+_inserting_vectorshtmit 9122125, 3:09 PM Task 2-4: Defining and Evaluating Functions Tutorials > Getting Started > Task 3-4: Defining and Evaluating Functions. Task 3-4: Defining and Evaluating Functions Evaluating Built-In Functions and Disabling Math Regions 1. Toname a variable 8, type q and then press Ctrl+G. To assign a value to 8, insert the definition operator and then type 67. On the Math tab, in the Units group, click Unit. The Unit list opens. Under the Angle category, click * (Degree). O=67° |B Another way to insert degrees is to type deg after 67. When you evaluate degrees, the result is returned in radians: 67 °=1.169 67 deg=1.169 2. Evaluate the built-in sine function for this angle. For a list of built-in functions, on the Functions. tab, in the Functions group, click All Functions. 3. Select the math region. On the Calculation tab, in the Controls group, click Disable Region. The disabled math region is dimmed sin(0)—0.921 4. Change the angle definition to 1/6. The disabled region is not recalculated to account for the change in the angle. 5. Select the disabled region, and then click Disable Region to toggle the control. The result is recalculated one ntps:ifsupport.pte.comvhelpimatheadi0, lenlindex.hmMpage/PTC_ Mathcad, Help/Tutoaligs_tuloraltask-4_defining_and evaluating functions.h... 4/3 9122125, 3:09 PM Task 2-4: Defining and Evaluating Functions You can disable any region to freeze its result at a point in time. When you disable a variable definition, other regions that use this variable return an error until you reactivate the variable definition, Defining New Functions and Checking Units You can generalize a math expressions by assigning it to a function. You first define the function and its arguments, and then evaluate it at specific points. 1. Insert a function name and the list of its arguments. f(x,y) 2. Insert the definition operator and then type the following expression: f In this function, cm denotes centimeters, and xand yare the arguments of function f You can define one function in terms of another function as iong as their arguments match. Here, the argument of sin is x, and xis also an argument of function f 3. Evaluate function fat x=1/2 and y=2kg. ry)=5 em+sin(x)-y checking on the function and found that the n definition (x must be an angle and y must ‘An error is returned, PTC Mathcad performed ur units of x and yare not compatible with the fun bea length) 4, Evaluate function fat x=n/Sand y=3in At 3 «| =0.095 m The result is returned in meters because the default unit system is the SI system. To change unit system, on the Math tab, in the Units group, select a new system from the Unit System list. Practice Before moving on to the next exercise, calculate the area of a triangle: + The general formula for the area of a triangle is 1/2: a b- sin(@), where a and bare the length of two of the sides of the triangle, and is the angle between these sides. Define a 3-argument function for calculating the area of triangles. + Atriangle has two sides of 5mm and 1.5cm, and the angle between them is 32°. Define these variables. Make sure you type in all the units, including the degree for the angle. + Evaluate the function for this triangle and check that its area is 0.799cr®. Initially, the result is returned in m2, so you must convert the units to cm. ntps:ifsupport.pte.comvhelpimatheadi0, lenlindex.himMpage/PTC_ Mathcad, Help/Tutoaligs_tuloraltask3-4_defining_and evaluating functions.h... 218 9122125, 3:09 PM Task 2-4: Defining and Evaluating Functions Proceed to Exercise 4. Was this helpful? © ‘ntps:fsupport pte. comhelpimathcadi0.Ofoniindex himitpage/PTC._ Mathcad,_Help/Tutofasigs_ tutorial 1ask3-4_defining_and_evaluatng functions.h.. 313 9122125, 3:09 PM “Task 3-3: Ordering Regions and Apolying Labels ‘Tutorials > Getting Started > Task 3-3: Ordering Regions and Applying Labels Task 3-3: Ordering Regions and Applying Labels 1. Ina new worksheet, enter the following expressions. Leave some space around the variable definitions. da 2. Select the math region with the result a= 2, 3. To move the math region above and below and to the left and to the right of the other math regions, press the Arrow keys. Notice how the following rules influence the result of the math region’ » PTC Mathcad only recognizes variable definitions that are above or to the left of the variable evaluation. Otherwise an error is returned. The only exception to that rule is for built-in constants. For example, type c =. The result returned is the speed of light. © When you redefine a variable, the new definition applies from that point onward, to its right and below. » You can redefine a variable in terms of itself. 4, To differentiate between several math types, such as variables, functions, or units, apply labels to their names. For example, label the first a as a unit. Place the cursor next to each name, and on the Math tab, in the Style group, select a new label from the Labels list. The format of the letter a changes to reflect the change in label. 5. Repeat steps 2 and 3 and notice how labels affect the result of the math region. «In some cases PTC Mathcad automatically assigns labels to elements. For example, when you insert a function, a constant, or a unit from the Ribbon, itis already labeled + The label format for a particular math type is the same throughout the worksheet. To customize label formats, you can use the options on theMath Formatting tab, in the Label Styles group. © For more information on labels, refer to the Help. Proceed to Task 3-4. ntps:ifsupport.pte.comvhelpimatheadi0,lenlindex.hmMpage/PTC_ Mathcad, Help/Tutoalsigs_tuloraltak’-+ ordering regions_and_appiying lab... 1/2 9122125, 3:09 PM “Task 3-8: Ordering Regions and Apolying Labels Was this helpful? © Q ntps:ifsupport.pte.comvhelpimatheadi0,Olenlindex.hmMpage/PTC_ Mathcad, Help/Tutoalsigs_tuloraltask3-3 ordering regions_and_appiying lab... 212 6122125, 3:08 PM ‘Task 3-2: Defining and Evaluating Global Variablos Tutorials > Getting Started > Task 3-2: Defining and Evaluating Global Variables Task 3-2: Defining and Evaluating Global Variables 1. Typex. 2. To insert a global definition operator, on the Math tab, in the Operators and Symbols group, 10. n ‘ntps:fsupport pte. comhelpimathcadi0.Oleniindex himitpage/PTC. Mathcad, Help/Tutofasigs_ tutorial click Operators and then select the Global Definition operator from the Definition and Evaluation category. Alternatively, press Ctrl+Shift+~. Type 3. Variable xis now defined globally throughout the worksheet. © Evaluate x. @: In a new math region below the previous math region, type x and then insert the local definition operator followed by 5. The local definition fails because variable xis already defined globally. Evaluate x again. @: Variable xreturs its globally defined value. Define variable z locally and assign it the value of 1 2 Define variable yas a function of z, =74+8 The global definition of y fails because variable z must be defined globally. Define a new variable w globally and set it to 6. w Define variable vas a function of w. usT+w Evaluate variable u, u=13 1k3-2_defring_and evaluating global_varl.. 4/2 6122125, 3:08 PM Task 3-2: Defining and Evaluating Global Variables The definition and evaluation of u works because it is defined in terms of another globally defined variable. Proceed to Task 3-3. Was this helpful? © ‘ntps:fsupport pte. comhelpimathcadi0.Oleniindex himitpage/PTC. Mathcad, Help/Tutofasigs_ tutorial 1a83-2_defining_and_evaluatng_global_var.. 212 6122125, 3:08 PM ‘Task 2-4: Defining and Evaluating Variables Tutorials > Getting Started > Task 3-1: Defining and Evaluating Variables Task 3-1: Defining and Evaluating Variables 1. Typev. 2. Toinsert a literal subscript, on the Math tab, in the Style group, click Subscript. The cursor moves below the line of text. Type a 3. To return the cursor to its normal position, click Subscript. Type the rest of the variable name, inserting the letter e as another literal subscript at the end of the name. vyriabl, 4. To insert the definition operator, type : (colon). vgriabl, = This operator looks different from the evaluation operator. Itis used to assign a math expression to a name. 5. Type 403, To move the cursor out of the exponent, press the Right Arrow key. Type s. A0* 8 v,riabl, 6. Tohighlight the name, click the variable name and then press Spacebar. v,riabl;: 7. To copy the name, press Ctrl+C. To paste the name in a new math region, click below the variable definition and then press Ctrl+V. 8. Toevaluate the variable, type = (equal sign). Notice that the color of sis now blue. PTC Mathcad recognizes sas the time unit second. 9. Type an expression that contains the variable and evaluate it. v,riabl, 18 fir 84 min $= = 77506 ntpe:ifsupport.pte.comvhelpimatheadi0, leniindex.himMpage/PTC_ Mathcad, Help/Tutoalsigs_tulorialtask3-1_defining_and evaluating varables.h... 1/2 2225, 308 PA Task 3-1: Defining and Evaluating Variables All the terms in the addition must have compatible units. The final result is returned in seconds. For a list of units, on the Math tab, in the Units group, click Units. 10. Delete the time unit s. The result is dimmed. If you click outside the math region, the s appears again to balance the equation. _ | veriabl, 18tor + M-min¢ “= | 11. To evaluate the math region in time units of minutes, in the empty unit placeholder, type min and then press Enter. The result is recalculated to match the new unit. vgriabl, 1S fr 84 min SS = 1291.77 mie 12. To format the result, you must first select or activate the math region. To change the display of the result, on the Math Formatting tab, in the Results group, select Scientific from the Result Format list vyriabl, 18 hr +34 rnin + (1202-104 min 13. To decrease the number of decimal points in the result, select 1 decimal place from the Display Precision list. vriabl, | To apply result formatting globally, click a blank spot in the worksheet, and then set your preferred result formatting options. Proceed to Task 3-2. Was this helpful? © ntpe:ifsupport.pte.comhelpimatheadi0.Olenlindex.himltpage/PTC_ Mathcad. Help/Tutoraligs_tulorialtask3-*_defiing_and_evaluating_varables.h, 22. 122125, 3.08 PM ‘Task 2-3: Formatting Math ‘Tutorials > Getting Started > Task 2-3: Formatting Math Task 2-3: Formatting Math Changing the Math Font 1. Open anew worksheet and type in a math expression The default math font is Mathcad UniMath Prime, the default font size is 11, and the default font color is black. 2. Select the math region and then on the Math Formatting tab, in the Math Font group, click Wide Latin from the Font drop-down menu. The math expression takes on the selected font. eS 3. Select 14 from the Font Size drop-down menu. The math expression takes on the selected font size. x=S 4. Select red from the Font Color drop-down palette. The math expression takes on the selected font color. x=-S 5. Select yellow from the Highlight Color drop-down palette. The math region takes on the selected background color. i g 6. Click the “7 Remove Format button. The original formatting of the math expression and region is restored. 7. Click the Increase Font Size button four times. Each click increases the font size by 1, so the final font size is 15. ei=5 8. Click the Decrease Font Size button four times. The math expression takes on a font size of 11 Hitpss/support pte. com/helpmathcad10.0/enindex himtpagelPTC, Mathcad_HolpTutorialsigs_tuorialtask2-3_formatting_math html 18 6122125, 3:08 PM ‘Task 2-3: Formatting Math Changing the Result Format 1.__ Insert the following math definition and then evaluate it. 4567.0123 4 w=3.457-10 On the Math Formatting tab, in the Results group, Result Format shows the default result format (General), the default Display Precision of (3), and the default off state of Show Trailing Zeros. 2. Select the evaluated math region and then select (Decimal) from the Result Format drop-down menu. Repeat by selecting (Scientific), (Engineering), and (Percent). The math expression changes its display format accordingly: (Decimal) (Scientific) (Engineering) 34567.012 ABT 10" 2=34.567+10° 3. Select the evaluated math region and then click Clear Format. The format is restored to (General) 4, Select § from the Display Precision drop-down menu. The result is displayed with only 4 digits to the right of the decimal point because the Sth digit happens to be a zero and the Show Trailing Zeros is disabled, 4567-10" 2 5. Click the Show Trailing Zeros button. The trailing zero now appears in the displayed result, 2 =3.45670+ 10" Click the Show Trailing Zeros button once more to disable it. 6. Select 8 from the Display Precision drop-down menu. The result is displayed with 8 digits to the right of the decimal point. 567012310" @: 7. Select 15 from the Display Precision drop-down menu. The result is displayed with 8 digits to the right of the decimal point which constitute all the digits in the original number. 2=3.45670123-10" 8. Click the Show Tralling Zeros button. Trailing zeros are used to reach the specified Display Precision of 15. 156701230000000-10" ‘ntps:tsupport pte. comhelpimathcadi10.Ofoniindex.himitpage/PTC_ Mathcad, Help/Tutofalsigs_tutorialitask2-3 formatting math Minit 6122125, 3:08 PM ‘Task 2-3: Formatting Math Proceed to Exercise 3. Was this helpful? © ‘ntps:fsupport pte. comhelpimathcadi0.Oloniindex.himitpage/PTC. Mathcad _Help/Tutofalsigs_ tutorial 1ai2-3 formatting_math mint 6122125, 3:08 PM ‘Task 2-2: Edting an Equation Tutorials > Getting Started > Task 2-2: Editing an Equation Task 2-2: Editing an Equation 1. To edit the equation you entered in the previous task, you must activate its math region. Click the region. A dashed-line rectangle appears around the activated region’ (1945?) «cos (ar) =—44-| | For formatting a region, it is enough to select it. Click your worksheet and drag the pointer across the region. A dark-gray rectangle expands around the selected region: 2. Click the addition operator. The operator is now blue, and both of its operands, the math terms 19 and 5, are grouped. (19+ 5?)-cos()=—a4. 3. To replace the addition operator with the square root and nth root operator, type \ (backslash) and then press Enter. The result is automatically recalculated (Ns*) -cos(m 4, To delete or replace the root expression, double-click the nth root operator, and press Backspace or Delete. 5. Toundo the delete operation, press Ctrl#Z. 6. Youno longer need the parentheses around the first term. You can select one of the parentheses and then press Delete or Backspace. Both of the parentheses are deleted at once. Click outside the math region. The result is automatically recalculated 1185 » 5° sos (x) =—1.185 7. Practice moving the cursor around and in and out of the math region by pressing the Arrow keys, Ctri+Arrow keys, or the Home and End keys. Finish on the exponentiation operator * aS 5? «cos (x) =—1.185 8 To delete the exponentiation operator, press Backspace or Delete. The Sand the 2become one integer. Click outside the math region. The result is automatically recalculated. "V2 «cos (m) 1 ‘ntps:fsupport pte. comhelpiathcadi0,Ofoniindex himitpage/PTC. Mathcad _Help/Tutofasigs_tutoralitask2-2_edling_an_equation.htmit 4 6122125, 3:08 PM ‘Task 2-2: Edting an Equation 10. n. 12, 13. 14, 15, When you delete an operator, the outcome depends on the operator and on the operands. For more information refer to the Operators book in the Help. To group the cosine function and its argument, drag the pointer over cos(r). To insert the integral operator, press Ctrl+Shift+l. The operator appears with 3 additional placeholders that are highlighted in blue: "\i52- [cos(x)d |= Move the cursor to the lower and the upper limit placeholders for the integral operator, and type a lower limit of 0 and an upper limit of 0.5rt of integration, respectively. "Vise [eos (or) do= Delete the cosine function argument, n, and replace it with another Greek letter, such as a. Type the Roman letter a and then press Ctrl+G, For a list of symbols, on the Math tab, in the Operators and Symbols group, click Symbols. "\i52- [cos (a) di= Place the cursor next to the cosine function argument a and ensure that on the Math tab, in the Style group, Labels is set to (-). |B Task 3-2 describes how to use labels. To define the variable of integration, in the remaining placeholder, type the Greek letter a. Click outside the math region. The result is automatically recalculated. 6. 52+ fcos(a)da=1.231 a To insert the division operator, place the cursor to the left of 52and then type / (slash). A division bar appears with a placeholder above it. we Oe Ge yi Jem) la In the placeholder, type 1 and then press Enter. ‘ntps:fsupport pte. comihelpiathcadi0.Ofoniindex himitpage/PTC_ Mathcad _Help/Tutofasigs_tutoralitask2-2_edling_an_equation.htmit 24 6122125, 3:08 PM ‘Task 2-2: Edting an Equation ase aE + fc da=0.812 Ve aon ) da: 16. To group the math terms of the equation, drag the cursor from left to right: Va: Jone 17. Type /. A division bar appears with a placeholder below it 18. n of the cursor influences the outcome. In step 14, you placed the cursor to the left of 52. Then when you inserted the division operator, 52became the denominator. In step 16, you placed the cursor to the right of the group. Then when you inserted the division operator, the group became the numerator. Practice Before moving on to the next exercise, enter and evaluate the following equation: dad in|—* | co00(0)' + sin(o)" | . ‘ntps:fsupport pte. comihelpiathcadi0.Ofoniindex himitpage/PTC_ Mathcad _Help/Tutofasigs_tutoralitask2-2_edling_an_equation.htmit aa 6122125, 3:08 PM ‘Task 2-2: Edting an Equation | You can type 2 and rt without inserting the multiplication operator. PTC Mathcad recognizes an implied multiplication and it automatically inserts the scaling operator between the two terms. However, PTC Mathcad identifies n@ as a single variable. You must first insert n, then insert the multiplication operator or the scaling operator, and finally insert e. Proceed to Task 2-3. Was this helpful? © 9 ‘ntps:fsupport pte. comhelpiathcadi0,Ofoniindex himitpage/PTC. Mathcad _Help/Tutofasigs_tutoralitask2-2_edling_an_equation.htmit 4 9122125, 3:07 PM. “Task 2-1: Entering and Evaluating an Equation Tutorials > Getting Started > Task 2-1: Entering and Evaluating an Equation Task 2-1: Entering and Evaluating an Equation 1. Click 1. A new blank worksheet opens with a grid and a blue crosshair. This crosshair indicates the insertion point for the next region, such as a math or text region. As you click the grid, or as you press the Arrow keys, the blue crosshair changes position. 2. Type 19 19) ‘Amath region is created, as indicated by the border around the number 79. 3. Click outside of the math region. The border disappears and the blue crosshair reappears. 19 ‘ 4. Click on the number 79to activate the math region again. Notice the blue cursor. Use the arrow keys to move the cursor to the rightmost insertion point of the math region, as in step 2. 5. To insert the addition operator, type + (plus sign) 19+| Type 5. 1945 Do not insert spaces. PTC Mathcad inserts space around each operator as needed, 6. Toinsert the exponentiation operator, on the Math tab, in the Operators and Symbols group, click Operators. The Operators list opens. Click », A placeholder appears. 1945! Type 2, 1945" When you point to an operator in the Operators list, a tooltip appears with a short description of the operator and its keyboard shortcut. 7. To group the terms 79 and 5%, press Spacebar 3 times. The group is complete when all the required terms are highlighted. 1945" 8. To insert the multiplication operator, type * (asterisk). ntpe:ifsupport.pte.comhelpimatheadi0,Olenlindex.himMpage/PTC_ Mathcad, Help/Tutoalsigs_tulorialitask2-7_entering_and_evaliating_an_equall.. 1/2 9122125, 3:07 PM. “Task 2-1: Entering and Evaluating an Equation 2 (19+5") | PTC Mathcad inserts parentheses to indicate that you multiply the whole group. 9. To insert the cosine function, type cos. (19+5?) -cos 10. To add an argument to the cosine function, type ( for the left and right parentheses. The pair of parentheses appears with an empty placeholder in the middle. Notice that empty placeholders also appeared in steps 5, 6, and 8 when you entered an operator. In most cases, when you see such a placeholder, you must fill it in before you can evaluate the expression. 11. To insert the constant n, type p, and then press Ctrl+G. For a list of constants, on the Math tab, in the Operators and Symbols group, click Constants. 12. To evaluate the expression, type = (equal sign). (i9+s? The evaluation operator and the result are displayed. To delete the result, press Backspace to select the result and the equal sign and then press Delete. Proceed to Task 2-2. Was this helpful? © Q -ntpe:ifsupport.pte.comvhelpimatheadi0,lenlindex.hmMpage/PTC_ Mathcad, Help/Tutoalsigs_tutorialitask2-7_entering_and_evaliating_an_equall.. 212 9122125, 3:07 PM. “Task 1-2: Using the Help Center Tutorials > Getting Started > Task 1-2: Using the Help Center Task 1-2: Using the Help Center Opening and Navigating the Help Click the Help icon —2)Jon the top-right corner of the Ribbon. The Help Center opens. Use the Table of Contents on the left side to navigate the Help Center. In the Search box, type “copy math” and click Search. From the search results, open the Help topic To Copy Math Examples from the Help. Perform the steps in the topic and then close the Help Center. On the Math tab, in the Regions group, place the pointer on the Solve Block button. The command tooltip appears. While the tooltip is visible, press F1. The Help topic About Solve Blocks opens. 8. Inthe Related Links list, click Example: Solve Blocks with Inequality Constraints, The Help topic opens. 9. Read the Example Help topic, minimize the Help Center window, and continue by following the steps below. eae erna ~ Copying Math Expressions from Help Examples The Help contains many examples that demonstrate the use of PTC Mathcad and its functions and operators. You can copy the math expressions in the Help examples into your worksheet and then experiment with the math. | To find examples with copyable math in the Help Center, include the word “example” with your search term, for instance, “example temperature”. Help topics whose title start with ‘the word "Example" contain copyable math Some examples read external data files. All the external data files are in data_files.zip. To work with copied math expressions that reference an external file, you must first set the data_files directory as your current working directory. You set your current working directory by saving a worksheet to that directory. 1. Tosave the blank worksheet, click 2! The Save As dialog box opens. 2. Type aname for the file, keep the default .mcdx file extension selected, and save the worksheet in the data_files directory. | To verify that the current working directory is set properly, type the string CWD= in the worksheet. The current working directory appears between quotation marks. ‘ntps:fsupport pte. combhelpiathcadi0,O/enlindex himitpage/PTC_ Mathcad, Help/Tutoasigs_tutoralitaskt-2_using_the_he hime 4. 822125, 307 PA “Task 1-2: Using the Help Center 3. Open the Help and type Example: Read and Write CSV Files in the Search box. Click Search and open the topic from the search results. This example uses the csv. txt data file. 4. To copy the first expression in the topic Example: Read and Write CSV Files to your worksheet, point to the expression graphic and click. The expression is copied to the clipboard Mi = RBADCSV (“csv.tet") | You must click the graphic to copy the expression to the clipboard. Do not press Ctrl+C. 5. To paste the expression, click inside the worksheet and press Ctrl+V. Alternatively, right-click the worksheet and select Paste from the shortcut menu. The expression is copied to the worksheet. 6. To copy all the math expressions in the example, click Copy Expressions on the top-right of the Help example. 7. Click inside the worksheet and press Ctrl+V. All expressions are copied to the worksheet. 8. Edit the pasted math expressions to see how results change. 9. Save the worksheet and keep it open. Open the Getting Started Tutorial in the Help Center and proceed to Exercise 2, Was this helpful? © 9 ‘ntps:fsupport pte. comhelpiathcadi10.Ofonlindex himitpage/PTC_ Mathcad,_Help/Tutofalsigs_tutoraltaskt-2_using_t 9122125, 3:07 PM. Task 11: Navigating and Customizing the PTC Mathcad Workspace Tutorials > Getting Started > Task 1-1: Navigating and Customizing the PTC Mathcad Workspace Task 1-1: Navigating and Customizing the PTC Mathcad Workspace In this exercise you are required to navigate the PTC Mathcad workspace and Help Center. 1. InPTC Mathcad, examine the Math tab, and click other Ribbon tabs to view their buttons and commands. All operators, functions, units, symbols, matrices, and plot features are available from the Ribbon. Place the pointer over a Ribbon item to view more information on specific commands. |B Each Ribbon tab is divided into groups. For example, on the Math tab, in the Operators and Symbols group, you can find the Operators, Symbols, Programming, Constants, and ‘Symbolics lists. 2. Click the PTC Mathcad Button @ to view the list of commands in it, and then examine the Quick Access Toolbar located next to the PTC Mathcad Button. 3. To add a button to the Quick Access Toolbar, on the Math tab, in the Regions group, right-click the Text Block icon, and select Add to Quick Access Toolbar from the shortcut menu. | By default the Quick Access Toolbar is to the right of the PTC Mathcad Button and above the Ribbon. 4. To remove the added button, right-click it, and select Remove from Quick Access Toolbar. Proceed to Task 1-2. Was this helpful? © Q -ntps:ifsupport.pte.comvhelpimatheadi0,lenlindex.htmpage/PTC_ Mathcad. Help/Tutoallgs_tutoriataskt-+_navigating_and_customizing_the_m. a 9122125, 3:12PM ‘ask 2-2: Optimization wih Constraints ‘Tutorials > Solving > Task 2-2: Optimization with Constraints Task 2-2: Optimization with Constraints Use a solve block to find the width and length of a rectangle with a maximum area enclosed in a circle. 1. Define the radius of the circle. ‘i 2. Define length d, as shown in the illustration above. a(a,b) 2 3. Insert a solve block, define guess values for @ and b, define the area function, and define the constraint d < rfor keeping the rectangle inside the circle. To solve for a and 6, call the maximize function. area (a,b) -=a+b (a,b) Solving > Task 2-1: Optimizing Functions: Task 2-1: Optimizing Functions Use a solve block to find a number of maxima points of the zero™ order Bessel function of the first kind Jo. When possible, it is a good practice to plot the function that you want to optimize. With this, approach, you can choose the appropriate guess values. 1 Plot the JO function. 0 (x) The JO function has many maxima and minima points. Specifying a guess value helps in finding the closest one. Insert a solve block, define the guess value for the maximum to be x7=5, and then use the maximize function to find the maximum around x7. aleh ‘maz = maximize (JO,x1) | Contrary to the find function, you must enter the JO function without its list of arguments. Caloulate the horizontal and vertical coordinates of the first maximum by evaluating Xnax1 and JO(%max1) Outside the solve block. hl:=marl =7.016 v1=J0(mazl)=0.3 ‘ntps:fsupport pte. comhelpimathcadi10,lonlindex himitpage/PTC. Mathcad _Help/Tutoralsishv_tutriavtask2-1_optimizing functions mi 18 9122125, 3:12PM “Task 2-1: Optimizing Functions 4. Copy the definitions of x7 and max7 outside the solve block. 5. Change the guess value and find the correspon maa2:= maximize (JO ,x2) Calculate the horizontal and vertical coordinates of the second maximum by evaluating Xmax2 and JO(%ax2) outside the solve block. h2:=mar2=—13,324 v2:=J0(maz2) =0.218 7. Plot both maximum points on the original plot. Using the maximize Function Outside Solve Blocks. When you do not have to specify constraints, you can use the maximize function outside solve blocks. 1. Type the first guess value and recalculate the corresponding maximum point. al ‘ntps:fsupport pte. comhelpimathcadi10,lonlindex himitpage/PTC. Mathcad _Help/Tutoralsishv_tutriavtask2-1_optimizing functions mi 9122125, 3:12PM “Task 2-1: Optimizing Functions maz 016 maximize (JO 21) 2. Type the second guess value and recalculate the corresponding maximum point. -15 maz2:= maximize (,J0,22)=—13.324 The same maximum points are returned by the maximize function. Proceed to Task 2-2. Was this helpful? © ‘ntps:fsupport pte. comhelpimathcadi10,lonlindex himitpage/PTC. Mathcad _Help/Tutoralsishv_tutriavtask2-1_optimizing functions mi 9122125, 3:12PM “Task 1-4: Parameterizing Solve Blocks Tutorials > Solving > Task 14: Parameterizing Solve Blocks Task 1-4: Parameterizing Solve Blocks A solve block can be a self-contained region of your worksheet, but it can also interact with the worksheet. For example, you can define the guess values in math regions coming before the solve block region. a0 find (2) =1.414 If you define a guess value inside the solve block region, it is defined locally. It does not affect the value of the variable in the worksheet. a0 find (2) =1414 2=0 You can assign the solution to a variable and use it later in your worksheet. r2= 14d You can assign the solution to a function that has the same arguments as the parameters of the solve block. Here, the parameter is a. ‘ntps:fsupport pte. comihelpiathcadi0.O/enlindex himitpage/PTC_ Mathcad _Help/Tutofasisv_tutrallask'-# parametering_soWe blocks hime 1/5, 9122125, 3:12PM “Task 1-4: Parameterizing Solve Blocks With function f you can evaluate the solution for a specific value of a: f (7) =2.646 You can also plot function fo visualize how it varies depending on parameter a 0,0.2..20 Practice Before you move on to the next exercise, consider the following problem. Two balls roll towards each other before colliding: ‘ntps:tsupport pte. comihelpiathcadi0.O/enlindex himitpage/PTC Mathcad, Help/Tutofasisv_tutrallask'-# parameterzing_soWe_blocks.himlt 2/5, 9122125, 3:12PM “Task 1-4: Parameterizing Solve Blocks ub ao maasub+m.b-(—ub) ma a) +m.b-v.b 4 marna’++m.benb? s+ marva’+) mow? 2 2 2 2 V (ma) find (v.a,0.0) v.a(m.a)=V (ma) v-b(m.e)=V (ma), + The guess values have units compatible with the solve block solution. + The constraints are the conservation of momentum and the conservation of energy. + The solve block solution, V(m.a), is a vector function. v.a and v.b are labeled as functions, so they can be distinguished from variables in the following calculations. ‘The change in momentum during the collision: —n.b)) —(m.a+(—v.a(m.a)) +m.bev.b(m.a)) AP(m.a)=(mo-natmb The change in energy during the collision: 2) (mas(v-a(m.a))’ +m.b-(v-b(m)))) AB (ma 4 2 = (meu? +m.bou. 2 ‘ntps:fsupport pte. combhelpiathcadi0,Ofoniindex himitpage/PTC_ Mathcad, Help/Tutofasisv_tutoratlask'-# parameterzing_soWe blocks hint 3/5 9122125, 3:12PM “Task 1-4: Parameterizing Solve Blocks You can plot the final velocities and the change in momentum and energy in terms of m.a. mara 1 kgslel kg..2 kg s v.a(ma) (=) v.b(ma) (2) Click Copy Expressions on the top-right corner of this topic. To paste the expressions in a new worksheet, click the worksheet and then press Ctrl+V. Change the value of u.a to 2, and the unit of u.bto ft/s and notice how the changes affect the plot. Proceed to Exercise 2. Was this helpful? © Q ‘ntps:fsupport pte. comihelpiathcadi0.Ofoniindex himitpage/PTC_ Mathcad Help/Tutofasisv_tutoratlask'-# parametering_soWe_blocks.himlt 4/5 122125, 3:12 PM “Task 1-4: Parameterizing Solve Blocks hitpseupport pte.com/helpmathcadi10.0/enindex himlpagelPTC. Mathcad, Help Tutorials tuterlaltask'-4_parameterzing_sole_bocks nimi 5/5 122925, 3:11 PM “Task 1-3: Finding Roots Tutorials > Solving > Task 1-3: Finding Roots Task 1-3: Finding Roots Use the root solver to locate where a function crosses the x-axis. For example, find some of the roots of a sinusoidal signal. sin(t) . Using root with an Interval 1. To insert the root function, on the Functions tab, in the Functions group, click Solving. The Solving list opens. Select root. The root function appears labeled as a keyword. root (/,0,1,") 2. Type an argument in each placeholder, and then evaluate the function. root (sin (z),2,4,8) =6.283 root searches for a solution in the specified interval 4 < x < 8. The solution is slightly greater than 6, as expected from the plot. |= With root, you can find the roots of a function with one unknown only. Using root with a Guess Value ‘ntps:fsupport pte. combhelpimathcadi10,Ofenlindex himitpage/PTC._ Mathcad,_Help/Tutofasisv_tutriatlask'-3_ finding roots Mime 4 ‘za, 3:11 Pm “ask 1-2: Fncing Roots Instead of working with intervals, you can define a guess value and then call root. As for solve blocks, the guess value is the point where root starts its solving routine 1. To find the root directly to the left of the origin, start with a guess value of ~4 m4 2. Type the following expression. root (sin (z) ,2) 3.142 3. To find a root to the right of the origin, define a new guess value. @ 4. Evaluate the root of sine. A different result is returned. root (sin (2) 7) =6.283 Proceed to Task 1-4. Was this helpful2 © Q ‘ntps:fsupport pte. combhelpimathcadi10,Ofenlindex himitpage/PTC._ Mathcad,_Help/Tutofasisv_tutriatlask'-3_ finding roots Mime 6122125, 3:13 PM “Task 3-6: Working wih the Jacobian Tutorials > Solving > Task 3-5: Working with the Jacobian Task 3-5: Working with the Jacobian The Jacobian is used by some of PTC Mathcad's ODE solvers. With the Jacobian, you can convert variables for multiple integrals. Consider the following region over which you want to integrate a function. The equations for each border are also shown. 1 f(e.v) 2. Integrate the function over the region. You must divide the integral in two, first integrating over the left-side of the x-y plane, and then over its right-side. J Jr@auars] fre.) ayar= 1.667 You can introduce new variables to transform the plane and to simplify the integral. us +u The region of integration for these new variables has borders that are parallel to the axes. ‘ntps:tsupport pte. comhelpimathcadi0.Olonlindex himitpage/PTC._ Mathcad _Help/Tutofasisv_tutoriattask3-S_working_with_the_jacobian Mimi 18 6122125, 3:13 PM “Task 3-6: Working wih the Jacobian 3. Define x and yin terms of uand v. uty eu) w(use)= 2 When you convert variables for multiple integrals, you must calculate the Jacobian to scale the integration. 4. Define a vector function F(t, v) y feu.) ewn[real 5. Evaluate the Jacobian matrix at a and b. Jacob on fs] [es “| 6. Calculate the Jacobian, the determinant of J. Insert the determinant operator. Dz |Wil= 7. Reformulate function fin terms of the new coordinates. (x(u,v) ,u(u,e)) g(u,v)s ‘ntps:fsupport pte. combhelpiathcadi0,Ofeniindex himitpage/PTC_ Mathcad, Help/Tutoalsisv_tutoraltask3-S_working_with_the jacobian.himi# 28 6122125, 3:13 PM “Task 3-6: Working wih the Jacobian 8. Scale the integral with the absolute value of the Jacobian, and evaluate the result. With the new variables, only one integral is needed to integrate the function. Practice Before you finish the tutorial, find the time it takes for an object thrown up in the air to reach its highest point. Set up a solve block with the differential equation x” =-9.8 and with the initial conditions x(0) = 2and x(0) = 3. Set up a second solve block to opti the first solve block. ize the function returned by You can check your answer by plotting the function returned by the first solve block between 0 Solving > Task 3-4: Solving Multiple ODEs with Solve Blocks Task 3-4: Solving Multiple ODEs with Solve Blocks Solve the Van der Pol equation. It describes the position and the velocity of a nonlinear spring system 1. Define the system parameter € and the time at which to end the solving. T=12 2. Insert a solve block and enter the Van der Pol equation. Use the odesolve function to solve for X and Y as functions of time. 2) =e-(1-y()’) 2 -v y(t) =2(t) (0) =0 y (0) =2 odesolve a(t] [5 3. Plot the solution. ‘ntps:tsuppor pte. comihelpiathcadi0.O/enlindex himitpage/PTC_ Mathcad _Help/Tutofalsisv_tutorattask3-4_solving_mutiple ODES with solve. 1/4 6122125, 3:13 PM “Task 3-4: Soling Multiple ODEs wih Solve Blocks x) yO 4. Copy and paste the solve block and parameterize the initial conditions. v(t) =e-\l—y(t) ) 2-0) y(t) =2(t) 2(0) =o y (0) =b *(a,b) =odesoive]| *(9 | 7} Pe Bea (sk 5. Extract solutions for several initial conditions. [z}-rn a 6. Plot the solutions. =F (-0.1,0.3) t 0,0.05..6 ntps:ifsuppor.pte.comhelpimatheadi0,Oleniindex.himpage/PTC_ Mathcad, Help/Tutoalisy_tutoralask3-4_soWng_muliple_ODES_wih solve. 24 6122125, 3:13 PM “Task 3-4: Soling Multiple ODEs wih Solve Blocks y(t) ¥ . y2(t) y3(4) z1(0) 22(t) 23 (dl) The periodic solution (red) is approached spirally by every other solution. 7. Copy and paste the initial solve block and parameterize the system parameter e. oy e-(1-y(y')-n) v0 v()=2(0) 2(0)=0 (0) =2 Fle) 2(t)] cn 9 8 Extract solutions for several system parameters. [at] [a }7FO 122) qs) b2J™ [23] {ys -FO 9. Plot the solutions. ntps:ifsuppor.pte.comhelpimatheadi0,Oleniindex.himpage/PTC_ Mathcad, Help/Tutoalisy_tutoralask3-4_soWng_muliple_ODES_wih solve. aa 6122125, 3:13 PM “Task 3-4: Soling Mutiple ODEs wih Solve Blocks wo) ‘ x 2 () 220) I l(t) #2 (t) #3(t) Proceed to Task 3-5. Was this helpful? ntps:ifsuppor.pte.comhelpimatheadi0,Oleniindex.himpage/PTC_ Mathcad, Help/Tutoalisy_tutoralask3-4_soWng_muliple_ODES_wih solve. 4 6122125, 3:13 PM ‘Task 3-8: Salving ODEs with Solve Blocks ‘Tutorials > Solving > Task 3-3: Solving ODEs with Solve Blocks Task 3-3: Solving ODEs with Solve Blocks As for solving systems of equations in solve blocks, you can use natural notation for solving ODEs. Use a solve block and a new input function to solve the mass-spring-damper system. 1. Define the mass m, the damping coefficient ¢, and the spring constant k. k 2. Define the input function u(t). wef onl a) 3. Enter the following solve block. On the Math tab, in the Operators and Symbols group, click Operators and then click the Prime Operator to enter the derivatives of x. Define the initial conditions of your problem, and then call the odesolve function. mon"(t) +e+2'(t) +k-a(t) =u(t) 2(0)= (0) =0 a= odesolve (x (t) .20) |B When solving ODEs in solve blocks, you must define initial or boundary conditions for your problem instead of guess values. 4. Plot the solution over the range 0 Solving > Task 3-1: Modeling ODEs in State-Space Task 3-1: Modeling ODEs in State-Space Read the problem defined below, and then, in Task 3-1 through Task 3-3, find the solution using the following methods: + State-Space ODE solver + ODE solver + Solve block Problem Definition Consider the classical mass-spring-damper system: k eH Vv vit) (=a) b The dynamical equation for this system is given by the following equation: mey"(t) +b-y'(t) +key (t) =u(t) You can represent this system with a state-space model expressed in the following form 4 3 (t) =A(t)-2(t) + B(t)-wlt) dt y(t) =C (t) -2(t) +D(t)-u(t) Where: + A-State matrix + BeInput matrix + C-Output matrix ‘ntps support pe comelpimathcad10.0leindex himlipage!PTC_Mathcad Help/Tutoasis_tutoatlask3-1_madeling_ ODES in state spacent... 14 ans, 312 PM “ask 2-1: Madang ODES in State-Space + D—Direct transmission matrix + x-—State vector + u-Input + y-Measured or controlled output | You can obtain the linear system above by linearizing the state and the output nonlinear equations that model the system dynamics. Use two state variables for this second order system. a(t) =y(t) x, (t) =y'(t) Given that m = 7, b = 0.5, and k = 3, the system equations are as follows x (t) =n, (t) Y(t) =-3 +2) (1) —0.5+a, (t) +ult) Ina state-space matrix form, the model is written as follows: 1, (t) dah (2i3)+ ML.]] ue State-Space ODE Solver 1. Define the matrix functions 4, 8, C, and D. B(t) -] cW@=[1 0] Dit)=0 2. Define the input to be the heaviside step function. To insert the step function, type F, and then press Ctrl+G. ‘ntps:fsuppor pte. combhelpiathcadi0.Ofoniindex himitpage/PTC_ Mathcad _Help/Tutofalsisv_tutorattask3-1_modeling_ODES.in_state_space.ht.. 2/4 9122125, 3:12PM ‘Task 3-1: Modeling ODES in State-Space u(t v(t) 3. Define the initial condition of the two variables. To type ias a literal subscript, on the Math tab, in the Style group, click Subscript, and then type i ‘| 0 4. Define time boundaries over which you want to find the system solution. 5, Define the number of points at which you want to find the solution, excluding tf. npoints:= 500 6. Call the statespace function. sol = statespace (: tity npoints A, Bu) The first column of matrix so/ contains the time at which the solution is found. Its remaining columns contain the state variables x7 and x2 at that time. 7. Extract t, x7, and x2 from matrix sol. wl=soll") sol?) o o 0 0.06 0.002 0.059 oz 0.007 o.16 os 0.016 0.169 024 0.027 022 03 0.012 0.266 0.36 zi= |0.059 0.309 0.2 0.079 0.346 0.8 0.101 0.379 oa 0.24 0.407 06 0.49 oan 0.66 0.76 ons 8 ‘ntps:tsupport pe. combhelpiathcadi0.O/eniindex himitpage/PTC_ Mathcad, Help/Tutoalsisv_tutoratlask3-t_modeting_ODES | Calculate the mean and maximum values of x7. mn:=mean (21) =0.331 _state_space ht. aa 9122125, 3:12PM ‘Task 3-1: Modeling ODES in State-Space mer 544 iax(x1) 9. Plot x7 over time and use markers to show its mean and maximum values. al The plot shows the transient response characteristics such as the rise time, the overshoot, and the settling time. Proceed to Task 3-2, Was this helpful? © O ‘ntps:tsuppor pte. combhelpiathcadi0.Ofeniindex himitpage/PTC_ Mathcad, Help/Tutoalsisv_tutorattask3-t_modeling_ODES | _state_space ht. 4 9122125, 3:12PM “Task 2-3: Nonlinear Least Squares Fiting Tutorials > Solving > Task 2-3: Nonlinear Least Squares Fitting Task 2-3: Nonlinear Least Squares Fitting Copy Expressions Fit the parameters of a function that models a data set. Use a solve block to minimize the residuals between the data set and the fitted function. As with other optimization problems, you can also rearrange the problem to look for a root. Here, set the residuals to zero, 1. Define a data set. fo1s2] [01] lo.sz2] | 0.2581 lost! —Jo.sast loz! —losoe! oso! — 0.606 iosi! _lo.ez2! Vaz | =! o.509/ | 1.46 | [os 3 j 165 | joa [1.839] ] 0.316 [2029) | 0.29 | [2219] [0.195] 2. Define a fitting function, the Weibull, with unknown parameters a and B. Wo(u,a,A)=a-6-u?!-exp(-a-u’) 3. Define the residuals, the difference between the v values from the data set and the v values calculated with Wb. —Wo(u,a,B) 4. Define the sum of squares. resid (a8) SSB («,9):= Dresid a.) 5. To find the parameters a and B that best fit the Weibull function, insert a solve block, define guess values for a and B, and then call the minimize function. 0.8 {ett = minimize (SSE,@,8) 6. Evaluate the solution. [at] _fo.502] tay i2 J ‘ntps:fsuppor pte. comhelpiathcadi0.Ofonlindex himitpage/PTC_ Mathcad, Help/Tutofasisv_tutorattask2-3_rontinear least squares_fittng Mimi 1/3 9122125, 3:12PM “Task 2-3: Nonlinear Least Squares Fiting 7. Calculate the mean squared error. This value is zero when a true solution exists. length (u) SSE(a1,A1) _ 9 yg9 n-2 8. Plot the data set and the fitted Weibull function. 4=0,0.1..4 . Wo(i,a1,A1) 9. To fit the parameters using the constraint resid = 0, use the minerr function instead of the minimize function [a2 You cannot use the find function here because there is no exact solution for a2 and B2. An error is returned to indicate that no solution exists. The minerr function works the same way as the find function, except that it returns an approximate solution if it fails to converge to the solution within a set number of iterations. 10. Calculate the mean squared error for the new parameters. SSE (02,2) _9 999 n-2 11. Compare the results returned by minimize and by minerr. titpsstsupport pe comhelpfathcad10.Ofrindex himifpage/PTC_ Mathcad Hep/Tutorlis_tutravtask2-2_ pontine (least squares_fting mit 2/3 9122125, 3:12PM “Task 2-3: Nonlinear Least Squares Fiting [a2—a1]_[ 0 1 [32-21 |= |-0.0000000014 | Practice Before you move on to the next exercise, find the price for an item assuming that you want to maximize profit, n- p. The relationship between the number of items sold and the price is described by the function r: n(p)=100 (p— 10)" +1000 Plot the profit function for 0

You might also like