You are on page 1of 87

About Exercise 1

1
Task 11: Navigating and Customizing the PTC Mathcad Workspace ............................ 2
Task 12: Using the Help Center ................................................................................. 3

The PTC Mathcad user interface is designed to make your work intuitive and
simple. Most of the commands in PTC Mathcad are on the Ribbon. You can
customize your workspace by minimizing or maximizing the Ribbon and by adding
commands that you frequently use to the Quick Access Toolbar. To learn more
about a Ribbon command, you can read its tooltip and access context-sensitive
Help. After completing this exercise, you will be able to:
Navigate the PTC Mathcad workspace
Use the Help effectively
Proceed to Task 11

1
Task 11: Navigating and Customizing
the PTC Mathcad Workspace
In this exercise you are required to navigate the PTC Mathcad workspace and Help
Center. For your convenience, download a copy of this PDF file, open it from your
computer, and then continue.

1. To save this file, on the PDF toolbar, click .


2. Open the saved file and continue by following the steps below.
3. In PTC 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.
Note
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.

4. 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.
5. 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.
Note
By default the Quick Access Toolbar is to the right of the PTC Mathcad Button
and above the Ribbon.
6. To remove the added button, right-click it, and select Remove from Quick
Access Toolbar.

Proceed to Task 12.

2
Task 12: Using the Help Center
Opening and Navigating the Help

1. Click the Help icon on the top-right corner of the Ribbon. The Help
Center opens.
2. Use the Table of Contents on the left side to navigate the Help Center.
3. In the Search box, type copy math and click Search.
4. From the search results, open the Help topic To Copy Math Examples from
the Help.
5. Perform the steps in the topic and then close the Help Center.
6. On the Math tab, in the Regions group, place the pointer on the Solve Block
button. The command tooltip appears.
7. While the tooltip is visible, press F1. The Help topic About Solve Blocks
opens.
8. In the 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.

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.
Note
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. To save the blank worksheet, click . The Save As dialog box opens.
2. Type a name for the file, keep the default .mcdx file extension selected, and
save the worksheet in the data_files directory.

About Exercise 1 3
Note
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.
3. Open the Help and type Example: Column, Normal Probability, and Box
Plots in the Search box. Click Search and open the topic from the search
results.
4. To copy the first expression in the topic Example: Column, Normal Probability,
and Box Plots to your worksheet, point to the expression graphic and click.
The expression is copied to the clipboard.

Note
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.
Note
This example uses the external data file furnace.csv. If your working
directory is not set to the data_files folder, the worksheet displays
calculation errors.
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.

4
Task 21: Entering and Evaluating an Equation Page 1 of 2

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

2 recommended topics
PTC Learning Connector
Mathcad Prime 3.0 - Application Orientation
Get Started Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

Task 21: Entering and Evaluating an Equation


1. Click . A blank worksheet opens with a grid and a blue crosshair. This crosshair indicates the insertion
point for the next math region, text region, plot, image, or solve block. As you click the grid, or as you
press the Arrow keys, the blue crosshair changes position.
2. Type 19.

A math region is created, as indicated by the border around the number 19.
3. Click outside of the math region. The border disappears and the blue crosshair reappears.

4. Click on the number 19 to 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).

Type 5.

Do not insert spaces. PTC Mathcad inserts space around each operator as needed.
6. To insert the exponentiation operator, on the Math tab, in the Operators and Symbols group, click
Operators. The Operators list opens. Click xn. A placeholder appears.

Type 2.

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 19 and 52, press Spacebar 3 times. The group is complete when all the required terms
are highlighted.

8. To insert the multiplication operator, type * (asterisk).

http://127.0.0.1:61783/tutorials_en/tutorials/gst/task2-1_entering_and_evaluating_an_equation.html 9/13/2014
Task 21: Entering and Evaluating an Equation Page 2 of 2

PTC Mathcad inserts parentheses to indicate that you multiply the whole group.
9. To insert the cosine function, type 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 , 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).

The evaluation operator and the result are displayed. To delete the result, you must first select the equal
sign and then press Delete or Backspace.
Proceed to Task 22.

http://127.0.0.1:61783/tutorials_en/tutorials/gst/task2-1_entering_and_evaluating_an_equation.html 9/13/2014
Task 22: Editing an Equation Page 1 of 3

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

3 recommended topics
PTC Learning Connector
Mathcad Prime 3.0 - Application Orientation
Get Started Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

Task 22: Editing an Equation


1. To edit the equation you entered in the previous task, you must activate its math region. Click the region.
A light-gray rectangle expands around the activated region:

Note
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 52,
are grouped.

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.

4. To delete or replace the root expression, double-click the nth root operator, and press Backspace or
Delete.
5. To undo the delete operation, press Ctrl+Z.
6. You no 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.

7. Practice moving the cursor around and in and out of the math region by pressing the Arrow keys,
Ctrl+Arrow keys, or the Home and End keys. Finish on the exponentiation operator ^.

8. To delete the exponentiation operator, press Backspace or Delete. The 5 and the 2 become one integer.

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.

http://127.0.0.1:61783/tutorials_en/tutorials/gst/task2-2_editing_an_equation.html 9/13/2014
Task 22: Editing an Equation Page 2 of 3

9. To group the cosine function and its argument, drag the pointer over cos().

10. To insert the integral operator, press Ctrl+Shift+I. The operator appears with 3 additional placeholders
that are highlighted in blue:

11. Move the cursor to the lower and the upper limit placeholders for the integral operator, and type a lower
limit (0) and an upper limit (0.5 ) of integration, respectively.

12. Delete the cosine function argument, , and replace it with another Greek letter, such as . 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.

Place the cursor next to the cosine function argument and ensure that on the Math tab, in the Style
group, Labels is set to (none).

Note
Task 32 describes how to use labels.
13. To define the variable of integration, in the remaining placeholder, type the same Greek letter as in step
9.

14. To insert the division operator, place the cursor to the left of 52 and then type / (slash). A division bar
appears with a placeholder above it.

15. In the placeholder, type 1.

16. To group the math terms of the equation, drag the cursor from left to right:

17. Type /. A division bar appears with a placeholder below it.

http://127.0.0.1:61783/tutorials_en/tutorials/gst/task2-2_editing_an_equation.html 9/13/2014
Task 22: Editing an Equation Page 3 of 3

18. In the placeholder, type 2.

Notice how the position of the cursor influences the outcome. In step 11, you placed the cursor to the left
of 52. Then when you inserted the division operator, 52 became the denominator. In step 13, 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:

Note
You can type 2 and 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 as a single variable. You must first insert , then insert the multiplication operator or
the scaling operator, and finally insert .
Proceed to Exercise 3.

http://127.0.0.1:61783/tutorials_en/tutorials/gst/task2-2_editing_an_equation.html 9/13/2014
Task 31: Defining and Evaluating Variables Page 1 of 2

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

2 recommended topics
PTC Learning Connector
Mathcad Prime 3.0 - Application Orientation
Get Started Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

Task 31: Defining and Evaluating Variables


1. Type v.

2. To insert 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
another literal subscript at the end of the name.

4. To insert the definition operator, type : (colon).

This operator looks different from the evaluation operator. It is used to assign a math expression to a
name.
5. Type 40^3. To move the cursor out of the exponent, press the Right Arrow key. Type s.

6. To highlight the name, click the variable name and then press Spacebar.

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. To evaluate the variable, type = (equal sign).

Notice that the s is now blue. PTC Mathcad recognized that the s is a unit (second).
9. Type an expression that contains the variable and evaluate it.

http://127.0.0.1:61783/tutorials_en/tutorials/gst/task3-1_defining_and_evaluating_variables.html 9/13/2014
Task 31: Defining and Evaluating Variables Page 2 of 2

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 unit. The result is dimmed. If you click outside the math region, the s appears again to balance
the equation.

11. To evaluate the math region in minutes, in the empty unit placeholder, type min and then press Enter.
The result is recalculated to match the new unit.

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.

13. To decrease the number of decimal points in the result, select 1 decimal place from the Display Precision
list.

Note
To apply result formatting globally, click a blank spot in the worksheet, and then set your preferred result
formatting options.
Proceed to Task 32.

http://127.0.0.1:61783/tutorials_en/tutorials/gst/task3-1_defining_and_evaluating_variables.html 9/13/2014
Task 32: Ordering Regions and Applying Labels Page 1 of 2

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

No recommended topics
PTC Learning Connector

View Knowledge Base results


Get Started
Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

Task 32: Ordering Regions and Applying Labels


1. In a new worksheet, enter the following expressions. Leave some space around the variable definitions.

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.

http://127.0.0.1:61783/tutorials_en/tutorials/gst/task3-2_ordering_regions_and_applying_labels.html 9/13/2014
Task 32: Ordering Regions and Applying Labels Page 2 of 2

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, it is 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 33.

http://127.0.0.1:61783/tutorials_en/tutorials/gst/task3-2_ordering_regions_and_applying_labels.html 9/13/2014
Task 33: Defining and Evaluating Functions Page 1 of 2

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

2 recommended topics
PTC Learning Connector
Mathcad Prime 3.0 - Application Orientation
Get Started Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

Task 33: Defining and Evaluating Functions


Evaluating Built-In Functions and Disabling Math Regions
1. To name a variable , type q and then press Ctrl+G. To assign a value to , insert the definition operator
and then type 67. On the Math tab, in the Units group, click Unit. The Unit list opens. Click (degree
symbol).

Note
Another way to insert degrees is to type deg after 67. When you evaluate degrees, the result is returned
in radians:

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.

4. Change the angle definition to /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.

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

http://127.0.0.1:61783/tutorials_en/tutorials/gst/task3-3_defining_and_evaluating_functions.html 9/13/2014
Task 33: Defining and Evaluating Functions Page 2 of 2

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.

2. Insert the definition operator and then type the following expression:

In this function, cm denotes centimeters, and x and y are the arguments of function f. You can define one
function in terms of another function as long as their arguments match. Here, the argument of sin is x,
and x is also an argument of function f.
3. Evaluate function f at x = /2 and y = 2kg.

An error is returned. PTC Mathcad performed unit checking on the function and found that the units of x or
y were not compatible with the function definition (x must be an angle and y must be a length).
4. Evaluate function f at x = /5 and y = 3in.

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 b are 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.
A triangle 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.199cm2. Initially, the result is returned
in m2, so you must convert the units to cm2.
Proceed to Exercise 4.

http://127.0.0.1:61783/tutorials_en/tutorials/gst/task3-3_defining_and_evaluating_functions.html 9/13/2014
Task 41: Inserting Vectors Page 1 of 2

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

No recommended topics
PTC Learning Connector

View Knowledge Base results


Get Started
Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

Task 41: Inserting Vectors


Vectors are matrices with only one row or column. They are used to store one-dimensional data sets.
1. To insert the matrix operator, type [ (left square bracket) for a 1element array.

2. Type 2 4 6 5 9, pressing Tab between each number to insert a new row.

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 6 matrix.

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.

5. Evaluate the following expression using your preferred method to enter vectors:

6. To calculate the dot product of two vectors, multiply them together.

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.

http://127.0.0.1:61783/tutorials_en/tutorials/gst/task4-1_inserting_vectors.html 9/13/2014
Task 41: Inserting Vectors Page 2 of 2

Proceed to Task 42.

http://127.0.0.1:61783/tutorials_en/tutorials/gst/task4-1_inserting_vectors.html 9/13/2014
Task 42: Defining Matrices Page 1 of 3

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

No recommended topics
PTC Learning Connector

View Knowledge Base results


Get Started
Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

Task 42: Defining Matrices


1. To define matrix A, type A:[

2. Type 1 4 2, pressing Shift+Spacebar between each number.

3. To insert a row, press Shift+Enter, or place the pointer on the last element of the matrix (2 in this case)
and press Tab.

Note
To edit matrices from the Ribbon, on the Matrices/Tables tab, in the Rows and Columns group, select one o
the options.
4. Place the cursor in the leftmost empty placeholder. Type 5 6 2 7 9 1 8 5 4, pressing Tab between each
number.

5. Type B and then insert the definition operator.

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 3 matrix.

7. Type the following numbers in the empty placeholders:

http://127.0.0.1:61783/tutorials_en/tutorials/gst/task4-2_defining_matrices.html 9/13/2014
Task 42: Defining Matrices Page 2 of 3

8. Define matrix C. Assign to this variable an expression that contains A and B.

When you add matrices, they must be of the same size. Here, both A and B are 4 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,0=

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 ORIGIN is 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

When you evaluate C, you can see the elements that you have redefined:

Range Variables and Complex Numbers


1. To create two range variables, type i:0..1 and then j:0..2

A range 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.

http://127.0.0.1:61783/tutorials_en/tutorials/gst/task4-2_defining_matrices.html 9/13/2014
Task 42: Defining Matrices Page 3 of 3

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.

You must include a scaling or multiplication operator between the integers and the i or the j. Otherwise,
PTC Mathcad identifies the terms 2i and 3j as imaginary numbers:

Note
To change the format of complex results, on the Math Formatting tab, in the Results group, select a format
from the Complex Values list.

Proceed to Task 43.

http://127.0.0.1:61783/tutorials_en/tutorials/gst/task4-2_defining_matrices.html 9/13/2014
Task 43: Extracting Data from Matrices Page 1 of 2

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

One recommended topic


PTC Learning Connector
Mathcad Prime 3.0 - Application Orientation
Get Started Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

Task 43: Extracting Data from Matrices


1. Define the following matrix.

2. Type X. To insert the row operator, press Ctrl+Shift+R. Type 0 in the empty placeholder and then
evaluate the expression.

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:

3. To extract the number of rows and columns from matrix X, call the rows and cols built-in functions.

4. To extract the numbers from matrix X, call the submatrix function.

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.

http://127.0.0.1:61783/tutorials_en/tutorials/gst/task4-3_extracting_data_from_matrices.html 9/13/2014
Task 43: Extracting Data from Matrices Page 2 of 2

You can combine functions and operators in expressions. For example, you can extract the lowest number
from the second column of matrix Y:

Practice
Before you move on to the next exercise, define M, v, and P using different methods for inserting arrays.

Extract the second row of P and its highest number. You can check your result by evaluating P. Redefine the
first element of P by a string, such as "header".
Proceed to Exercise 5.

http://127.0.0.1:61783/tutorials_en/tutorials/gst/task4-3_extracting_data_from_matrices.html 9/13/2014
Task 51: Creating a Plot with Multiple Traces Page 1 of 3

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

3 recommended topics
PTC Learning Connector
Mathcad Prime 3.0 - Plotting
Get Started Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

Task 51: Creating a Plot with Multiple Traces


1. Define the function below. Insert the absolute value operator.

2. On the Plots tab, in the Traces group, click Insert Plot. An empty plot appears.

3. In the y-axis placeholder, to the right of the plot, type 18 and drag the y-axis legend to the left.
4. In the 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.

http://127.0.0.1:61783/tutorials_en/tutorials/gst/task5-1_creating_a_plot_with_multiple_traces.html 9/13/2014
Task 51: Creating a Plot with Multiple Traces Page 2 of 3

5. Place the cursor adjacent to the 8 in 18. Click Add Trace. A new y-axis placeholder appears below the
current one.

Note
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 16 - 0.05 x2 in the y-axis placeholder. Press Enter. A second trace appears.

http://127.0.0.1:61783/tutorials_en/tutorials/gst/task5-1_creating_a_plot_with_multiple_traces.html 9/13/2014
Task 51: Creating a Plot with Multiple Traces Page 3 of 3

7. Insert two y-axis placeholders and type the following y-axis expressions.

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 52.

http://127.0.0.1:61783/tutorials_en/tutorials/gst/task5-1_creating_a_plot_with_multiple_traces.html 9/13/2014
Task 52: Formatting a Plot Page 1 of 6

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

5 recommended topics
PTC Learning Connector
Mathcad Prime 3.0 - Plotting
Get Started Setup

Copy Expressions
Start using Mathcad Prime 3.0 with these free
tutorials!

Task 52: Formatting a Plot


1. Open the Excel sheet shipping_data. Highlight the cells that contain data from A1 to C9, and copy your
selection to the clipboard. To paste the data into a table, in a new PTC Mathcad worksheet, press Ctrl+V.

In a 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 name of the data sets and of the units where needed.

http://127.0.0.1:61783/tutorials_en/tutorials/gst/task5-2_formatting_a_plot.html 9/13/2014
Task 52: Formatting a Plot Page 2 of 6

Use tables to define column vectors. Afterward, you can work with the column vectors in your worksheet:

Copy Expressions

3. On the 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.
4. In the 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 traces appear. Notice that kg
appears automatically in the unit placeholder next to Weight.

5. Click Value. On the Plots tab, in the Styles group, select a shade of red from the Color Scheme list. Select
a cross from the Symbol list. The settings you chose are saved and appear on the Plots tab.
Click Charges. Click Symbol.

http://127.0.0.1:61783/tutorials_en/tutorials/gst/task5-2_formatting_a_plot.html 9/13/2014
Task 52: Formatting a Plot Page 3 of 6

Copy Expressions

6. Click Weight. Select (none) from the Line Style list. Both traces are formatted at once.

7. In the Axes group, click Logarithmic Scaling. The x-axis scaling becomes logarithmic. Click Charges and
once again, click Logarithmic Scaling. Both axes now have a logarithmic scale.

http://127.0.0.1:61783/tutorials_en/tutorials/gst/task5-2_formatting_a_plot.html 9/13/2014
Task 52: Formatting a Plot Page 4 of 6

Copy Expressions

8. On the y-axis, click the topmost tick mark value, 1000000. In the Format Plot Values group, select
Scientific from the Result Format list.
Click Weight, and then select Scientific from the Result Format list.

9. Drag each axis to a new location. The axis snaps to a tick mark on the other axis.

http://127.0.0.1:61783/tutorials_en/tutorials/gst/task5-2_formatting_a_plot.html 9/13/2014
Task 52: Formatting a Plot Page 5 of 6

Copy Expressions

10. Save the worksheet under the name shipping.mcdx.


11. To close shipping.mcdx and to open a new worksheet, in the Quick Access Toolbar, click New.

Practice
Before you move on to the next exercise, copy and paste the following expressions to your worksheet.

Create the following plot.

http://127.0.0.1:61783/tutorials_en/tutorials/gst/task5-2_formatting_a_plot.html 9/13/2014
Task 52: Formatting a Plot Page 6 of 6

Copy Expressions

Proceed to Exercise 6.

http://127.0.0.1:61783/tutorials_en/tutorials/gst/task5-2_formatting_a_plot.html 9/13/2014
Task 61: Inserting and Formatting Text Page 1 of 1

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

2 recommended topics
PTC Learning Connector
Mathcad Prime 3.0 - Application Orientation
Get Started Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

Task 61: Inserting and Formatting Text


1. Open the shipping.mcdx worksheet you saved in Task 52.
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.
2. Place the blue crosshair on the top-left corner of the worksheet grid and press Ctrl+Shift+T to add a text
block. You can also insert a text block by clicking the Text Block button on the Math tab in the Regions
group. A text block stretches across the full page.
3. Type the following text as a title for the worksheet: Import from Mexico to the state of Vermont in May
2009.
4. Click outside the text block region to continue.
5. Place the blue insertion crosshair above the data table and press Enter a few times to add space. You can
press Delete or Backspace to remove unnecessary space between regions.
6. 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. $
7. To format the title text style, click the title and select the text.
8. On the Text Formatting tab, in the Text Font group, select the following options:
Font: Arial
Font size: 20
Font style: Bold
On the Text Formatting tab, in the Paragraph group, select Center Text.
9. Continue by formatting the text in the text box.
10. To format the worksheet header, double-click the area above the grid.
11. On the Document tab, in the Headers and Footers group, click Saved Date and select the mm/dd/yyyy date
format. The date when the file was saved is inserted in the header.
12. Click File and select Name to insert the file name in the header.
13. Insert the page number in the worksheet footer.
14. Save the worksheet.
Proceed to Task 62.

http://127.0.0.1:61783/tutorials_en/tutorials/gst/task6-1_inserting_and_formatting_text.html 9/13/2014
Task 62: Inserting Page Breaks and Images Page 1 of 1

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

One recommended topic


PTC Learning Connector
Mathcad Prime 3.0 - Application Orientation
Get Started Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

Task 62: Inserting Page Breaks and Images


1. In the 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.

Congratulations! You have completed the Getting Started Tutorial.

http://127.0.0.1:61783/tutorials_en/tutorials/gst/task6-2_inserting_page_breaks_and_images.html 9/13/2014
Task 11: Creating a Program Page 1 of 2

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

One recommended topic


PTC Learning Connector
Mathcad Prime 3.0 - Programming Mathematical Expressions
Get Started Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

Task 11: Creating a Program


1. To insert a new program, on the Math tab, in the Operators and Symbols group, click Programming. The
programming operators list opens. Click | Program. A program structure appears.

2. Type localX.

The local variable localX is defined only within the program. You cannot refer to it outside the program.
3. On the Math tab, in the Operators and Symbols group, click Programming. The programming operators list
opens. Click Local Assignment and type 5.

This is the local assignment operator. The definition operator is not applicable inside a program.

Note
You can define a local program variable with the same name as a variable on the worksheet, but PTC
Mathcad treats these as two different variables.
4. To evaluate the program, press =. PTC Mathcad displays the evaluation of the last line of the program.

5. Place the cursor at the end of the assignment expression.

6. Press Enter. A new program line appears.

7. Type 2*localX and press F5 to calculate. PTC Mathcad recalculates the program.

Note
No matter how long your program is, the result is always displayed at the top right of the program.
8. To assign the last expression calculated in the program, assign the program to a variable as shown below.

http://127.0.0.1:61783/tutorials_en/tutorials/prgmt/task1-1_starting_a_program.html 9/13/2014
Task 11: Creating a Program Page 2 of 2

Proceed to Task 12.

http://127.0.0.1:61783/tutorials_en/tutorials/prgmt/task1-1_starting_a_program.html 9/13/2014
Task 12: Defining Functions Page 1 of 1

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

One recommended topic


PTC Learning Connector
Mathcad Prime 3.0 - Programming Mathematical Expressions
Get Started Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

Task 12: Defining Functions


1. Define a function that checks whether a number is positive:

After you define a function, you can call it and use it with parameters, such as numbers and variables.
2. Call the function with different values and verify that it returns 1 for positive numbers and 0 for
nonpositive numbers as shown below.

3. Define a function that calculates the greatest common divisor and the difference of two numbers:

Note
You can use all PTC Mathcad built-in functions inside a program.
4. Check the value of f(57,48).

The function output is a two-element vector. The first number is the greatest common divisor of the two
input numbers and the second number is the difference between them.
Proceed to Task 13.

http://127.0.0.1:61783/tutorials_en/tutorials/prgmt/task1-2_defining_functions.html 9/13/2014
Task 13: Using Operators Page 1 of 2

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

One recommended topic


PTC Learning Connector
Mathcad Prime 3.0 - Programming Mathematical Expressions
Get Started Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

Task 13: Using Operators


Using Operators and Units
Use PTC Mathcad built-in operators to calculate the area of a sector of circle as shown below.

1. Create a new program and define a local variable r to be 1 meter.

Note
PTC Mathcad identifies the letter m as a unit.
2. Define the angle as 23 degrees.

3. Insert the definite integral operator.

4. Add the required values in the integral placeholders and multiply the integral by 1/2 as shown below.

http://127.0.0.1:61783/tutorials_en/tutorials/prgmt/task1-3_using_operators.html 9/13/2014
Task 13: Using Operators Page 2 of 2

5. Evaluate the program to get the area of the sector.

Using PTC Mathcad Built-In Functions and Matrices


1. Create a new program and define two vectors as shown below.

2. On the Functions tab, in the Statistics list, click mean. The function is added with empty placeholders.

3. Calculate the mean of m1 and m2 elements and delete the remaining placeholders.

Practice
Before you move on to the next exercise, define a function f that receives a vector v.
Function f is a program that uses PTC Mathcad built-in functions. It returns a three-element vector containing
the vectors length, the maximal element in the vector v, and the median of vector v.
Proceed to Exercise 2.

http://127.0.0.1:61783/tutorials_en/tutorials/prgmt/task1-3_using_operators.html 9/13/2014
Task 21: Writing If Statements Page 1 of 2

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

2 recommended topics
PTC Learning Connector
Mathcad Prime 3.0 - Programming Mathematical Expressions
Get Started Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

Task 21: Writing If Statements


Write a function reverse that modifies the value of its argument from BLACK to WHITE and vice versa.
1. Create a new function reverse that accepts a variable var.

2. To add an if statement, on the Math tab, in the Operators and Symbols group, click Programming. The
programming operators list opens. Click if.

Note
You can type the name of a programming operators, such as "if, and then press Ctrl+J to convert the
name to a programming operator with all its placeholders.
3. Condition that if the value of var is BLACK, the function returns the value WHITE as shown below. To add
the Boolean equal operator for comparison, on the Math tab, in the Operators and Symbols group, click
Operators. The operators list opens. Click = Equal To.

4. To add another if statement, position the cursor as shown below and press Enter.

If the cursor is positioned right after WHITE and you press Enter, PTC Mathcad adds a line inside the if
block.
5. Specify the opposite case as shown below.

Note
PTC Mathcad supports nested if statements.

http://127.0.0.1:61783/tutorials_en/tutorials/prgmt/task2-1_Writing_If_Statements.html 9/13/2014
Task 21: Writing If Statements Page 2 of 2

6. Call reverse and change the value of a variable myvar as shown below.

Keep the file open and proceed to Task 22.

http://127.0.0.1:61783/tutorials_en/tutorials/prgmt/task2-1_Writing_If_Statements.html 9/13/2014
Task 31: Writing For Loops Page 1 of 1

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

2 recommended topics
PTC Learning Connector
Mathcad Prime 3.0 - Programming Mathematical Expressions
Get Started Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

Task 31: Writing For Loops


Use for loops to modify several elements in a vector using a single expression.
1. Define a function f that accepts a variable vec and create a new program.
2. To define an empty for loop, on the Math tab, in the Operators and Symbols group, click Programming, and
then click for.

Note
You cannot modify the operator (belongs to). This operator is a part of the for statement syntax.
3. Specify an iterator i and a range of values (0..2) as shown below.

Note
The range of values can also be a single value, a vector, or a matrix defining the range of values.
The default origin of a vector or a matrix in PTC Mathcad is 0.
4. Assign zero to the first three elements of the vector as shown below.

5. Calculate the result of f for the vector below.

Proceed to Task 32.

http://127.0.0.1:61783/tutorials_en/tutorials/prgmt/task3-1_Writing_For_Loops.html 9/13/2014
Task 32: Writing While Loops Page 1 of 4

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

2 recommended topics
PTC Learning Connector
Mathcad Prime 3.0 - Programming Mathematical Expressions
Get Started Setup

Copy Expressions
Start using Mathcad Prime 3.0 with these free
tutorials!

Task 32: Writing While Loops


Writing a Basic While Function
Write a function sigma that sums all the numbers from 0 to n.
1. Define a function sigma that accepts a variable n and create a new program.

2. To add an empty while loop, on the Math tab, in the Operators and Symbols group, click Programming, and
then click while.

3. Specify that the while loop should continue as long as n>0 and should decrement n by 1 inside the loop.

Note
Unlike for loops, you must increment or decrement the while iterator.
4. To add the current iterator value to the sum, type the following line as shown below, right after the while
statement.

5. Return the value of sum.

Note
Update the iterator last; otherwise, you miss the first iteration addition.
6. Calculate the value of sigma for 5.

http://127.0.0.1:61783/tutorials_en/tutorials/prgmt/task3-2_Writing_While_Loops.html 9/13/2014
Task 32: Writing While Loops Page 2 of 4

As expected, the program is equivalent to the following sum:

Copy Expressions
Adding Continue Statements
Add continue statements to keep the loop running but to skip a specific iteration.
Write a function that sums all the numbers from 0 to n, except for numbers that can be divided by 17.
1. Copy the above function and rename it to sigma_not17.

2. Inside the while loop, add a new line under the while statement.

3. Add an if statement and type the expression below.

4. To avoid endless looping, decrement n by 1.


5. To add a continue statement, on the Math tab, in the Operators and Symbols group, click Programming, and
then click continue.

6. Calculate the value of sigma_not17 for 16 and 17.

http://127.0.0.1:61783/tutorials_en/tutorials/prgmt/task3-2_Writing_While_Loops.html 9/13/2014
Task 32: Writing While Loops Page 3 of 4

Adding Break Statements


Write a program that sums all numbers and exits the loop when the counter is greater than 20.
Copy Expressions
1. Define a variable sum and create a new program.

2. To add an empty while loop, on the Math tab, in the Operators and Symbols group, click Programming, and
then click while.

3. Specify that the while loop should run forever.

Note
A while loop runs as long as the value of the expression inside the parenthesis is not 0.
4. Initialize sum and i.

5. Add the value of the iterator i to a variable sum and increment i by 1 inside the loop.

6. Return the value of sum.

Note

http://127.0.0.1:61783/tutorials_en/tutorials/prgmt/task3-2_Writing_While_Loops.html 9/13/2014
Task 32: Writing While Loops Page 4 of 4

Currently this loop is infinite.


7. To break the loop, type if i > 20 and add the break statement. To add a break statement, on the Math tab,
in the Operators and Symbols group, click Programming, and then click break.

Copy Expressions

8. Calculate sum.

9. To break the loop and exit the program, select the break statement and on the Math tab, in the Operators
and Symbols group, click Programming, and then click return, to modify it to a return statement. Type sum
in the placeholder as shown below.

Note
Use return to immediately exit a program.

Practice
Before you move to the next task, write a function fact(n) that implements a factorial function using a while
loop. Define the loop to run as long as n is greater than 1. Inside the loop, multiple n by a variable product
(saving the factorial result) and decrement n by 1.

Note
In PTC Mathcad, program variables are set to 0 by default. In the beginning of the program, you must assign
1 to product. Otherwise, the program will yield 0 for all arguments.
Proceed to Task 33

http://127.0.0.1:61783/tutorials_en/tutorials/prgmt/task3-2_Writing_While_Loops.html 9/13/2014
Task 33: Writing Try-On-Error Statements Page 1 of 2

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

2 recommended topics
PTC Learning Connector
Mathcad Prime 3.0 - Programming Mathematical Expressions
Get Started Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

Task 33: Writing Try-On-Error Statements


Use try-on-error to specify what should be done if an error occurs while the program is performed. For
example, dividing a number by 0 is an error.
1. Define a function f(x) and create a new program.

2. To add a try block, on the Math tab, in the Operators and Symbols group, click Programming, and then click
try.

Note
When you add a try block, PTC Mathcad adds an on-error block.
3. Type 1/2x.

The try block is the function PTC Mathcad performs when no error occurs. It can contain several
expressions.
4. Place the cursor inside the on error block, and on the Math tab, in the Operators and Symbols group, click
Constants. Select the infinity sign ().

5. Calculate the value of f(x) for various values as shown below.

http://127.0.0.1:61783/tutorials_en/tutorials/prgmt/task3-3_Writing_Try_On_Error_Statements.html 9/13/2014
Task 33: Writing Try-On-Error Statements Page 2 of 2

Congratulations! You have completed the Programming Tutorial.

http://127.0.0.1:61783/tutorials_en/tutorials/prgmt/task3-3_Writing_Try_On_Error_Statements.html 9/13/2014
About Exercise 1 Page 1 of 1

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

No recommended topics
PTC Learning Connector

View Knowledge Base results


Get Started
Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

About Exercise 1
Use PTC Mathcad solvers and solve blocks to solve systems of equations and to find the roots of a function.
Solvers are similar to PTC Mathcad built-in functions. They require a specific set of arguments, and they
provide one command to solve a problem. Each solver is designed to solve a specific problem. Solve blocks,
on the other hand, are special areas constructed of multiple regions. In these regions, you can define your
problem in natural notation. You can solve a greater variety of problems with solve blocks than with solvers.
You can parameterize your solve blocks and call them later in your worksheet. After completing this exercise,
you will be able to perform the following tasks:
Solve a linear or a nonlinear system of equations
Find the roots of a function
Parameterize a solve block
Proceed to Task 11.

http://127.0.0.1:61783/tutorials_en/tutorials/st/about_exercise_1.html 9/13/2014
About Exercise 2 Page 1 of 1

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

No recommended topics
PTC Learning Connector

View Knowledge Base results


Get Started
Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

About Exercise 2
With solve blocks, you can perform optimization. You can find the parameters that minimize or maximize a
function and you can add constraints to restrict the optimization. After completing this exercise, you will be
able to perform the following tasks:
Maximize or minimize a function
Add constraints when optimizing a function
Proceed to Task 21.

http://127.0.0.1:61783/tutorials_en/tutorials/st/about_exercise_2.html 9/13/2014
About Exercise 3 Page 1 of 1

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

No recommended topics
PTC Learning Connector

View Knowledge Base results


Get Started
Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

About Exercise 3
You can solve stiff and non-stiff ordinary differential equations (ODEs) with solvers or with solve blocks. In
addition, you can calculate the Jacobian. After completing this exercise, you will be able to perform the
following tasks:
Solve stiff and non-stiff ODEs
Model ODEs in State-Space
Parameterize ODEs
Work with the Jacobian
Proceed to Task 31.

http://127.0.0.1:61783/tutorials_en/tutorials/st/about_exercise_3.html 9/13/2014
About the Solving Tutorial Page 1 of 1

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

No recommended topics
PTC Learning Connector

View Knowledge Base results


Get Started
Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

About the Solving Tutorial


With PTC Mathcad solvers and solve blocks, you can perform solving and optimization. You can find the
solution for a system of equations with multiple unknowns, and you can parameterize the equations to
analyze the parameters impact on the solution. You can work with linear and nonlinear equations and with
differential equations. You can also maximize or minimize a function. The tutorial is composed of three
sequential exercises:
Exercise 1: Solve systems of equations and find the roots of functions
Exercise 2: Optimize functions
Exercise 3: Solve ordinary differential equations
Complete the exercises in order. Proceed to Exercise 1.

http://127.0.0.1:61783/tutorials_en/tutorials/st/about_the_solving_tutorial.html 9/13/2014
Task 11: Linear System of Equations Page 1 of 5

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

One recommended topic


PTC Learning Connector
Mathcad Prime 3.0 - Symbolics and Solving
Get Started Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

Task 11: 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:

They intersect as shown in the following plot:

You want to find the coordinates of the crossing point (x, y) where the following equations hold true:

http://127.0.0.1:61783/tutorials_en/tutorials/st/task1-1_linear_system_of_equations.html 9/13/2014
Task 11: Linear System of Equations Page 2 of 5

The equations can be rearranged so that the variables are on the left of the equations:

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:

The arrays M and v are known, but X is unknown. X is a 2-element vector representing the x and y
coordinates of the crossing point.

Solving with Matrix Calculation


1. Define the matrix M and the vector v.

2. Define X in terms of M and v.

3. Evaluate X.

The x value of the crossing point is 5.714 and the y value is -0.714.

Solving with a Solver


Solvers are functions for solving specific problems. You can use lsolve to find the coordinates of the crossing
point.
1. Define the matrix M and the vector v.

2. Call lsolve.

http://127.0.0.1:61783/tutorials_en/tutorials/st/task1-1_linear_system_of_equations.html 9/13/2014
Task 11: Linear System of Equations Page 3 of 5

Solving with a Solve Block


A solve block is an area in which you define your problem in natural notation. You do not need to rearrange
the equations as you did for matrix calculation and for the solver. Recall the linear functions y1 and y2:

The following solve block calculates the crossing point of the two functions:

1 Guess value for each unknown


2 Constraint for each unknown
3 Solve block function
1. To find the coordinates of the crossing point using a solve block, start by defining the two functions y1 and
y2 in your worksheet.

2. To insert a solve block region, on the Math tab, in the Regions group, click Solve Block.

http://127.0.0.1:61783/tutorials_en/tutorials/st/task1-1_linear_system_of_equations.html 9/13/2014
Task 11: Linear System of Equations Page 4 of 5

To resize a solve block region, you can drag its thick borders. When you move a solve block in your
worksheet, all the regions in the solve block move with it.
3. In the 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.

The first constraint defines the value of x at the crossing point, and the second constraint defines the
value of y at that point.
5. Insert the solve block function name and arguments. Here, type find, and then type x and y as the
function arguments. You must label find as a keyword. Click the word find, and then, on the Math tab, in
the Style group, select Keyword from the Labels list.

http://127.0.0.1:61783/tutorials_en/tutorials/st/task1-1_linear_system_of_equations.html 9/13/2014
Task 11: Linear System of Equations Page 5 of 5

6. Evaluate the solve block.

Proceed to Task 12.

http://127.0.0.1:61783/tutorials_en/tutorials/st/task1-1_linear_system_of_equations.html 9/13/2014
Task 12: Nonlinear System of Equations Page 1 of 3

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

One recommended topic


PTC Learning Connector
Mathcad Prime 3.0 - Symbolics and Solving
Get Started Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

Task 12: 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.

Solving with a Solve Block


1. Press Ctrl+1 to insert a solve block region, and then insert the following items:
The definition of functions y1 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 labeled as a keyword

http://127.0.0.1:61783/tutorials_en/tutorials/st/task1-2_nonlinear_system_of_equations.html 9/13/2014
Task 12: Nonlinear System of Equations Page 2 of 3

Solving with a Solver


Recall the functions y1 and y2:

You can define a new function f (x) = y2(x) - y1(x).

f crosses the x-axis at the same x value as the crossing point of the nonlinear functions. f is a polynomial, so
you can use polyroots instead of the more general root solver to find where f crosses the x-axis.
1. Assign the polynomial coefficients to vector c. The first element of c is the intercept and the next elements
are the coefficients for each power of x, in ascending order.

2. Call polyroots. The real solution (the first element of r) is the x value of the crossing point.

Note
polyroots returns all the solutions, including the complex solutions, at once. Solve blocks return only one

http://127.0.0.1:61783/tutorials_en/tutorials/st/task1-2_nonlinear_system_of_equations.html 9/13/2014
Task 12: Nonlinear System of Equations Page 3 of 3

solution at a time. To find other solutions with solve blocks, you must change the guess values.
3. Evaluate y1 and y2 at x. The result is the same, since it is the y value of the crossing point.

Proceed to Task 13.

http://127.0.0.1:61783/tutorials_en/tutorials/st/task1-2_nonlinear_system_of_equations.html 9/13/2014
Task 13: Finding Roots Page 1 of 2

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

One recommended topic


PTC Learning Connector
Mathcad Prime 3.0 - Symbolics and Solving
Get Started Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

Task 13: Finding Roots


Use the root solver to locate where a function crosses the x-axis. For example, find some of the roots of
sine.

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.

2. Type an argument in each placeholder, and then evaluate the function.

root searches a solution in the interval 4 < x < 8. The solution is slightly greater than 6, as expected from
the plot.

Note
With root, you can find the roots of a function with one unknown only.

http://127.0.0.1:61783/tutorials_en/tutorials/st/task1-3_finding_roots.html 9/13/2014
Task 13: Finding Roots Page 2 of 2

Using root with a Guess Value


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.

2. Type the following expression. You must label root as a keyword.

3. To find the root directly to the right of the origin, define a new guess value.

4. Evaluate the root of sine. A different result is returned.

Proceed to Task 14.

http://127.0.0.1:61783/tutorials_en/tutorials/st/task1-3_finding_roots.html 9/13/2014
Task 14: Parameterizing Solve Blocks Page 1 of 4

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

2 recommended topics
PTC Learning Connector
Mathcad Prime 3.0 - Symbolics and Solving
Get Started Setup

Copy Expressions
Start using Mathcad Prime 3.0 with these free
tutorials!

Task 14: 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.

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.

You can assign the solution to a variable and use it later in your worksheet.

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.

http://127.0.0.1:61783/tutorials_en/tutorials/st/task1-4_parameterizing_solve_blocks.html 9/13/2014
Task 14: Parameterizing Solve Blocks Page 2 of 4

Copy Expressions
With function f, you can evaluate the solution for a specific value of a:

You can also plot function f to visualize how it varies depending on parameter a.

Practice
Before you move on to the next exercise, consider the following problem. Two balls roll towards each other
before colliding:

http://127.0.0.1:61783/tutorials_en/tutorials/st/task1-4_parameterizing_solve_blocks.html 9/13/2014
Task 14: Parameterizing Solve Blocks Page 3 of 4

You can set up a solve block to find the velocities of the balls after collision as follows:

Copy Expressions

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:

The change in energy during the collision:

You can plot the final velocities and the change in momentum and energy in terms of m.a.

http://127.0.0.1:61783/tutorials_en/tutorials/st/task1-4_parameterizing_solve_blocks.html 9/13/2014
Task 14: Parameterizing Solve Blocks Page 4 of 4

Copy Expressions

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.b to ft/s and notice
how the changes affect the plot.
Proceed to Exercise 2.

http://127.0.0.1:61783/tutorials_en/tutorials/st/task1-4_parameterizing_solve_blocks.html 9/13/2014
Task 21: Optimizing Functions Page 1 of 2

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

No recommended topics
PTC Learning Connector

View Knowledge Base results


Get Started
Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

Task 21: Optimizing Functions


Use a solve block to find the maximum of the zeroth order Bessel function of the first kind:

1. Enter the following solve block. Define the guess value for the maximum to be x = 30 and then maximize
the Bessel function J0.

Note
You must enter the function J0 without adding its list of arguments, contrary to the command find.
2. Evaluate xmax.

http://127.0.0.1:61783/tutorials_en/tutorials/st/task2-1_optimizing_functions.html 9/13/2014
Task 21: Optimizing Functions Page 2 of 2

The solve block detects a local maximum at x = 7.016. The actual maximum is at x = 0, as you can see in
the plot above.
3. Change the guess value and evaluate xmax.

The solve block detects the desired solution. When possible, it is good practice to plot the function that
you want to optimize. With this approach, you can choose an appropriate guess value.
Proceed to Task 22.

http://127.0.0.1:61783/tutorials_en/tutorials/st/task2-1_optimizing_functions.html 9/13/2014
Task 22: Optimization with Constraints Page 1 of 2

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

No recommended topics
PTC Learning Connector

View Knowledge Base results


Get Started
Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

Task 22: 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.

2. Define length d, as shown in the illustration above.

3. Enter the following solve block. Define guess values for a and b, define the function for maximizing the
area, and define the condition d < r for keeping the rectangle inside the circle. To solve for a and b, call
maximize.

http://127.0.0.1:61783/tutorials_en/tutorials/st/task2-2_optimization_with_constraints.html 9/13/2014
Task 22: Optimization with Constraints Page 2 of 2

4. Evaluate A, B, and d.

As expected, A = B, so the rectangle is in fact a square. Also, d is equal to r.


Proceed to Task 23.

http://127.0.0.1:61783/tutorials_en/tutorials/st/task2-2_optimization_with_constraints.html 9/13/2014
Task 23: Nonlinear Least Squares Fitting Page 1 of 3

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

No recommended topics
PTC Learning Connector

View Knowledge Base results


Get Started
Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

Task 23: Nonlinear Least Squares Fitting


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 be zero.
1. Define a data set.

2. Define a fitting function, the Weibull density with unknown parameters and .

3. Define the residuals, the difference between the y values from the data set and the y values calculated
with Wb.

4. Define the sum of squares.

5. To find the parameters and that best fit the Weibull function, enter the solve block below. Define guess
values for and , and then call minimize.

http://127.0.0.1:61783/tutorials_en/tutorials/st/task2-3_nonlinear_least_squares_fitting.html 9/13/2014
Task 23: Nonlinear Least Squares Fitting Page 2 of 3

6. Evaluate the solution.

7. Calculate the mean squared error. This value is zero when a true solution exists.

8. Plot the data set and the fitted Weibull function.

9. To fit the parameters using the constraint resid = 0, enter the following solve block:

http://127.0.0.1:61783/tutorials_en/tutorials/st/task2-3_nonlinear_least_squares_fitting.html 9/13/2014
Task 23: Nonlinear Least Squares Fitting Page 3 of 3

You cannot use find here because there is no exact solution for 2 and 2. An error is returned to indicate
that no solution exists. minerr works the same way as find, 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.

11. Compare the results returned by minimize and by minerr.

The results for each parameter are similar.

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 n:

Plot the profit function for 0 < p < 10 before choosing a guess value.
Proceed to Exercise 3.

http://127.0.0.1:61783/tutorials_en/tutorials/st/task2-3_nonlinear_least_squares_fitting.html 9/13/2014
Task 31: Modeling ODEs in State-Space Page 1 of 3

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

One recommended topic


PTC Learning Connector
Mathcad Prime 3.0 - Application Orientation
Get Started Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

Task 31: Modeling ODEs in State-Space


Read the problem defined below, and then, in Task 31 through Task 33, find the solution using the
following methods:
State-Space ODE solver
ODE solver
Solve block

Problem Definition
Consider the classical mass-spring-damper system:

The dynamical equation for this system is given by the following equation:

You can represent this system with a state-space model expressed in the following form:

AState matrix
BInput matrix
COutput matrix
DDirect transmission matrix

http://127.0.0.1:61783/tutorials_en/tutorials/st/task3-1_modeling_ODEs_in_state_space.html 9/13/2014
Task 31: Modeling ODEs in State-Space Page 2 of 3

xState vector
uInput
yMeasured or controlled output

Note
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.

Given that m = 1, b = 0.5, and k = 3, the system equations are as follows:

In a state-space matrix form, the model is written as follows:

State-Space ODE Solver


1. Define the matrices functions A, B, C, and D.

2. Define the input to be the heaviside step function. To insert the step function, type F, and then press
Ctrl+G.

3. Define the initial condition of the two variables. To type i as a literal subscript, on the Math tab, in the
Style group, click Subscript, and then type i.

4. Define time boundaries over which you want to find the system solution.

http://127.0.0.1:61783/tutorials_en/tutorials/st/task3-1_modeling_ODEs_in_state_space.html 9/13/2014
Task 31: Modeling ODEs in State-Space Page 3 of 3

5. Define the number of points at which you want to find the solution, excluding ti.

6. Call the statespace function.

The first column of the matrix sol contains the time at which the solution is found. Its remaining columns
contain the state variables x1 and x2 at that time.
7. Extract t, x1, and x2 from matrix sol.

8. Plot the solution for x1 over time.

The plot shows the transient response characteristics such as the rise time, the overshoot, and the settling
time.
Proceed to Task 32.

http://127.0.0.1:61783/tutorials_en/tutorials/st/task3-1_modeling_ODEs_in_state_space.html 9/13/2014
Task 32: Solving ODEs with ODE Solvers Page 1 of 2

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

One recommended topic


PTC Learning Connector
Mathcad Prime 3.0 - Application Orientation
Get Started Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

Task 32: Solving ODEs with ODE Solvers


In the previous task, you solved the mass-spring-damper system with a state-space ODE solver. You can
also use ODE solvers to solve this problem. Recall that the dynamical equation was as follows:

The system parameters were m = 1, b = 0.5, and k = 3. The input was a heaviside step function, u(t) = (t).
You can rewrite the second-order equation in terms of first-order ODEs:

1. Define a vector function specifying the right side of the system.

The arguments of D are t, the independent variable, and X, the vector of dependent variables:

2. Define the initial values for x1 and x2.

3. Define the initial and the final times over which to evaluate the solution.

4. Define the number of time steps.

5. Call the AdamsBDF solver to evaluate the solution.

Alternatively, you can replace the AdamsBDF solver by another ODE solver. For more information
refer to the About Differential Equation Solvers topic in the Help.
The solution is a 3-column matrix with the time, the displacement, and the velocity of the system for

http://127.0.0.1:61783/tutorials_en/tutorials/st/task3-2_solving_ODEs_with_ODE_solvers.html 9/13/2014
Task 32: Solving ODEs with ODE Solvers Page 2 of 2

each of the N steps:

6. Extract the time and the displacement from Sol and plot them one against the other.

The AdamsBDF solver is a hybrid solver. It starts with the non-stiff Adams solver. If it identifies the
problem as stiff, it switches to the stiff BDF solver.
Proceed to Task 33.

http://127.0.0.1:61783/tutorials_en/tutorials/st/task3-2_solving_ODEs_with_ODE_solvers.html 9/13/2014
Task 33: Solving ODEs with Solve Blocks Page 1 of 3

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

One recommended topic


PTC Learning Connector
Mathcad Prime 3.0 - Application Orientation
Get Started Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

Task 33: 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 c, and the spring constant k.

2. Define the input function u(t).

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.
Call odesolve and label it as a keyword.

Note
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 < t < 10.

http://127.0.0.1:61783/tutorials_en/tutorials/st/task3-3_solving_ODEs_with_solve_blocks.html 9/13/2014
Task 33: Solving ODEs with Solve Blocks Page 2 of 3

Parameterizing ODEs
1. Copy and paste the solve block to a new spot in your worksheet.
2. Parameterize the initial conditions. You must add one argument per parameter to the function definition.
Here, define y(a, b).

3. Define two functions with different initial conditions.

4. Plot the functions.

http://127.0.0.1:61783/tutorials_en/tutorials/st/task3-3_solving_ODEs_with_solve_blocks.html 9/13/2014
Task 33: Solving ODEs with Solve Blocks Page 3 of 3

Proceed to Task 34.

http://127.0.0.1:61783/tutorials_en/tutorials/st/task3-3_solving_ODEs_with_solve_blocks.html 9/13/2014
Task 34: Solving Multiple ODEs with Solve Blocks Page 1 of 4

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

One recommended topic


PTC Learning Connector
Mathcad Prime 3.0 - Application Orientation
Get Started Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

Task 34: Solving Multiple ODEs with Solve Blocks


Solve Van der Pol's 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.

2. Enter the following solve block. Remember to label odesolve as a keyword.

3. Plot the solution.

http://127.0.0.1:61783/tutorials_en/tutorials/st/task3-4_solving_multiple_ODEs_with_solve_blocks.ht... 9/13/2014
Task 34: Solving Multiple ODEs with Solve Blocks Page 2 of 4

4. Copy and paste the solve block and parameterize the initial conditions.

5. Extract solutions for several initial conditions.

6. Plot the solutions.

http://127.0.0.1:61783/tutorials_en/tutorials/st/task3-4_solving_multiple_ODEs_with_solve_blocks.ht... 9/13/2014
Task 34: Solving Multiple ODEs with Solve Blocks Page 3 of 4

The periodic solution (blue) is approached spirally by every other solution.


7. Copy and paste the initial solve block and parameterize the system parameter .

8. Extract solutions for several system parameters.

http://127.0.0.1:61783/tutorials_en/tutorials/st/task3-4_solving_multiple_ODEs_with_solve_blocks.ht... 9/13/2014
Task 34: Solving Multiple ODEs with Solve Blocks Page 4 of 4

9. Plot the solutions.

Proceed to Task 35.

http://127.0.0.1:61783/tutorials_en/tutorials/st/task3-4_solving_multiple_ODEs_with_solve_blocks.ht... 9/13/2014
Task 35: Working with the Jacobian Page 1 of 3

eLearning Knowledge Base Your System Administrator has Installed: Search Learning Connector

One recommended topic


PTC Learning Connector
Mathcad Prime 3.0 - Application Orientation
Get Started Setup

Start using Mathcad Prime 3.0 with these free


tutorials!

Task 35: 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. Define a function to integrate.

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.

You can introduce new variables to transform the plane and to simplify the integral.

The region of integration for these new variables has borders that are parallel to the axes.

http://127.0.0.1:61783/tutorials_en/tutorials/st/task3-5_working_with_the_jacobian.html 9/13/2014
Task 35: Working with the Jacobian Page 2 of 3

3. Define x and y in terms of u and v.

When you convert variables for multiple integrals, you must calculate the Jacobian to scale the
integration.
4. Define a vector function F(u, v).

5. Evaluate the Jacobian matrix at a and b.

6. Calculate the Jacobian, the determinant of J. Insert the determinant operator.

7. Reformulate function f in terms of the new coordinates.

8. Scale the integral with the absolute value of the Jacobian, and evaluate the result.

http://127.0.0.1:61783/tutorials_en/tutorials/st/task3-5_working_with_the_jacobian.html 9/13/2014
Task 35: Working with the Jacobian Page 3 of 3

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) = 2 and
x(0) = 3. Set up a second solve block to optimize the function returned by the first solve block.
You can check your answer by plotting the function returned by the first solve block between 0 < t < 1. You
can add units as long as you ensure that the units are compatible throughout your calculations.

Congratulations! You have completed the Solving Tutorial.

http://127.0.0.1:61783/tutorials_en/tutorials/st/task3-5_working_with_the_jacobian.html 9/13/2014

You might also like