Anda di halaman 1dari 114

y

Fo

rP

TC

In

te

rn

al

se

nl

Mathcad Prime 3.0 Essentials

Authored and published using

In

te

rn

al

se

nl

Copyright 2013 PTC Inc. and/or Its Subsidiary Companies. All Rights Reserved.
User and training guides and related documentation from PTC Inc. and its subsidiary companies (collectively
"PTC") are subject to the copyright laws of the United States and other countries and are provided under a license
agreement that restricts copying, disclosure, and use of such documentation. PTC hereby grants to the licensed
software user the right to make copies in printed form of this documentation if provided on software media, but
only for internal/personal use and in accordance with the license agreement under which the applicable software
is licensed. Any copy made shall include the PTC copyright notice and any other proprietary notice provided
by PTC. Training materials may not be copied without the express written consent of PTC. This documentation
may not be disclosed, transferred, modified, or reduced to any form, including electronic media, or transmitted or
made publicly available by any means without the prior written consent of PTC and no authorization is granted
to make copies for such purposes.
Information described herein is furnished for general information only, is subject to change without notice, and
should not be construed as a warranty or commitment by PTC. PTC assumes no responsibility or liability for any
errors or inaccuracies that may appear in this document.
The software described in this document is provided under written license agreement, contains valuable trade
secrets and proprietary information, and is protected by the copyright laws of the United States and other
countries. It may not be copied or distributed in any form or medium, disclosed to third parties, or used in any
manner not provided for in the software licenses agreement except with written prior approval from PTC.
UNAUTHORIZED USE OF SOFTWARE OR ITS DOCUMENTATION CAN RESULT IN CIVIL DAMAGES AND
CRIMINAL PROSECUTION. PTC regards software piracy as the crime it is, and we view offenders accordingly.
We do not tolerate the piracy of PTC software products, and we pursue (both civilly and criminally) those who do
so using all legal means available, including public and private surveillance resources. As part of these efforts,
PTC uses data monitoring and scouring technologies to obtain and transmit data on users of illegal copies of our
software. This data collection is not performed on users of legally licensed software from PTC and its authorized
distributors. If you are using an illegal copy of our software and do not consent to the collection and transmission
of such data (including to the United States), cease using the illegal version, and contact PTC to obtain a legally
licensed copy.
Important Copyright, Trademark, Patent, and Licensing Information: See the About Box, or copyright notice,
of your PTC software.
UNITED STATES GOVERNMENT RESTRICTED RIGHTS LEGEND
This document and the software described herein are Commercial Computer Documentation and Software,
pursuant to FAR 12.212(a)-(b) (OCT95) or DFARS 227.7202-1(a) and 227.7202-3(a) (JUN95), and are provided
to the US Government under a limited commercial license only. For procurements predating the above clauses,
use, duplication, or disclosure by the Government is subject to the restrictions set forth in subparagraph (c)(1)(ii)
of the Rights in Technical Data and Computer Software Clause at DFARS 252.227-7013 (OCT88) or Commercial
Computer Software-Restricted Rights at FAR 52.227-19(c)(1)-(2) (JUN87), as applicable. 01282013
PTC Inc., 140 Kendrick Street, Needham, MA 02494 USA

TC

PRINTING HISTORY

Document No.
TRN-4010-M02-EN-LM-P01

Fo

rP

Printed in the U.S.A

Date
10/21/2013

Description
Initial Printing of:
Mathcad Prime 3.0 Essentials

About PTC University


Welcome to PTC University!
With an unmatched depth and breadth of product development knowledge, PTC University helps
you realize the most value from PTC products. Only PTC University offers:

se

nl

An innovative learning methodology - PTCs Precision Learning Methodology is a proven


proprietary approach used by PTC to develop and deliver learning solutions.
Flexible Delivery Options PTC University ensures you receive the same quality training programs
regardless of the learning style. Our extensive experience, innovative learning techniques, and
targeted learning modules facilitate the rapid retention of concepts, and higher user productivity.
Premier Content and Expertise A thorough instructor certification process and direct access to the
PTC product development and PTC consulting organizations means that only PTC courses can
give you highly-qualified instructors, the most up-to-date product information and best practices
derived from thousands of deployments.
Global Focus PTC University delivers training where and when you need it by providing over 100
training centers located across 35 countries offering content in nine languages.
Delivering Value A role-based learning design ensures the right people have the right tools to do
their jobs productively while supporting the organizations overall performance goals.

al

The course you are about to take will expose you to a number of learning offerings that PTC
University has available. These include:

In

te

rn

Instructor-led Training (ILT) - The ideal blend of classroom lectures, personal demonstrations,
hands-on workshops, assessments, and post-classroom tools.
Pro/FICIENCY - This Web-based, skills assessment and development-planning tool will help
improve your skills and productivity.
eLearning Libraries - 24/7 access to Web-based training that will compliment your instructor-led
course.
Precision LMS - A powerful learning management system that will manage your eLearning Library
and Pro/FICIENCY assessments.

TC

PTC University additionally offers Precision Learning Programs. These are corporate learning
programs designed to your organizations specific goals, current skills, desired competencies and
training preferences.

Fo

rP

Whatever your learning needs are, PTC University can help you get the most out of your PTC
products.

PTC Telephone and Fax Numbers


North America

se

nl

Education Services Registration


Tel: (888) 782-3773
Fax: (781) 370-5307
Technical Support (Monday - Friday)
Tel: (800) 477-6435
Fax: (781) 707-0328
License Management and Contracts
Tel: 877-ASK-4-PTC (877-275-4782)
Fax: (781) 707-0331

Europe

Technical Support, License Management, Training & Consulting


Tel: +800-PTC-4-HELP (00-800-78-24-43-57)

Asia

al

Please refer to http://www.ptc.com/services/training/contact.htm for contact information.

Fo

rP

TC

In

te

rn

In addition, you can access the PTC Web site at www.ptc.com. Our Web site contains the latest
training schedules, registration information, directions to training facilities, and course descriptions.
You can also reach technical support, and register for online service options such as knowledge
base searches, reference libraries and documentation. You can also find general information about
PTC, PTC Products, Consulting Services, Customer Support, and PTC Partners.

Precision Learning
The Precision Learning Methodology
PTC developed the Precision Learning methodology to provide you with an effective, comprehensive
learning experience. This methodology is based on a cycle of learn, assess and improve.

al

se

nl

Learning via PTC courses available in multiple formats, including:


Live Classroom (either in-center or on-site)
Virtual Class (live training delivered over the Web)
Web-based Training
Assessing using Pro/FICIENCY, PTCs Web-based skills assessment and development planning
tool.
Improving through the review of self-paced learning materials available in PTC University.

rn

This methodology is continued in PTC University subscriptions, offering a comprehensive library of


self-paced and virtual courses corresponding to PTC products.

te

Precision Learning Programs offer you the ability to create a customized training program, focused
on measuring the increase in your effectiveness with PTC products.

In

More information is available for all of these offerings in the training section of PTC.com at
http://www.ptc.com/services/training/index.htm.

Precision Learning In The Classroom

TC

PTCs classes are based on the proven instructional design principal of Tell Me, Show Me, Let
Me Do:

rP

Topics are introduced through a short presentation, highlighting the key concepts.
These key concepts are then reinforced by seeing them applied in the software application.
You then apply the concepts through structured exercises.

Fo

After the course, a Pro/FICIENCY assessment is provided in order for you to assess your
understanding of the materials. The assessment results will also identify the class topics that
require further review.
At the end of the class, you will either take a Pro/FICIENCY assessment via your PTC University
account, or your instructor will provide training on how to do this after the class.

Precision Learning After the Class


Each student that enrolls in a PTC class has a PTC University account. This account will be
automatically created if you do not already have one. As part of the class, you receive additional
content in your account:

A Pro/FICIENCY assessment from the course content that generates a Recommended Learning
Report based on your results.
A Web-based training version of the course, based on the same instructional approach of lecture,
demonstration and exercise. The Recommended Learning Report will link directly to sections
of this training that you may want to review.
Please note that Web-based training may not be available in all languages. The Web-based training
is available in your account for one year after the live class.

Precision Learning Recommendations


PTC uses a role-based training approach. The roles and the associated training
are graphically displayed in a curriculum map. Curriculum maps are available
for numerous PTC products and versions in the training section of PTC.com at
http://www.ptc.com/services/edserv/learning/paths/index.htm.

nl

Please note that a localized map may not be available in every language and that the map above is
partial and for illustration purposes only.

Fo

rP

TC

In

te

rn

al

se

Before the end of the class, your instructor will review the map corresponding to the course you
are taking. This review, along with instructor recommendations, should give you some ideas for
additional training that corresponds to your role and job functions.

For Students: How to Use this Course Handbook


Guide Layout
The information in this guide is organized as topics to aid students in finding information after the
class is complete. Each topic is divided into the following sections:

se

nl

Concept this section contains the initial introduction to the topic and is presented during the
class lecture.
Theory this sections provides detailed information introduced in the Concept.
Procedure This section provides step-by-step instructions on how to complete the topic within
MATHCAD. Procedures are short, focused, and simple exercises that cover the specific
topics to which they apply. Procedures are found in this Student Handbook only. Not every topic
has a Procedure as there are knowledge topics that can not be exercised.
Exercise Exercises are longer than procedures, and may cover multiple topics, so not every
topic will have an associated exercise. Exercises are typically more involved and use more
complicated models. Exercises are found in the printed Exercise Guide and the online exercise
HTML files.
Additionally, these topics are organized into modules. Except for the first module, all modules are
grouped to keep similar functionality together.

Fo

rP

TC

In

te

rn

al

The first module is a process module. In this module, you will find the generic process used to solve
the common types of Behavioral Modeling problems.

Training Agenda

12
13
14
15
16
17
18
19
20
21
22

3-D Plotting
Boolean Conditions
Symbolics
Solving
Optimization
Differential Equations
Programming
Data Exchange
Data Analysis
Project Day 2
Challenge Exercise Solutions

nl

Getting Started
Documenting and Formatting
Entering and Editing Math
Variables
Functions
Range Variables
Controlling Calculations
Vectors and Matrices
Units
2-D Plotting
Project Day 1

01
02
03
04
05
06
07
08
09
10
11

se

Module
Module
Module
Module
Module
Module
Module
Module
Module
Module
Module

Day 1

al

rn

te

In

Fo

rP

TC

Module
Module
Module
Module
Module
Module
Module
Module
Module
Module
Module

Day 2

Table of Contents
Mathcad Prime 3.0 Essentials

Entering and Editing Math ........................................................................................................... 3-1


Typing Math ........................................................................................................................ 3-2
Typing Math ........................................................................................................................ 3-3

nl

Variables ...................................................................................................................................... 4-1


Defining and Evaluating a Variable........................................................................................ 4-2

Functions..................................................................................................................................... 5-1
Define and Evaluate a Function ............................................................................................ 5-2

se

Range Variables........................................................................................................................... 6-1


Using a Range Variable........................................................................................................ 6-2
Using A Range Variable ....................................................................................................... 6-4

al

Vectors and Matrices ................................................................................................................... 8-1


Defining and Extracting Elements from an Array .................................................................... 8-2
Using Arrays ....................................................................................................................... 8-5

te

rn

Units ............................................................................................................................................ 9-1


Using Units ......................................................................................................................... 9-2
Using Units ......................................................................................................................... 9-3
Using Temperature Units...................................................................................................... 9-5

In

2-D Plotting................................................................................................................................ 10-1


Plotting Functions in 2-D .................................................................................................... 10-2

TC

Project Day 1........................................................................................................................... 11-1


Structural Engineering Project Day 1................................................................................ 11-2
Mechanical Engineering Project Day 1 ............................................................................. 11-6

rP

3-D Plotting................................................................................................................................ 12-1


Plotting Multiple Traces ...................................................................................................... 12-2
Plotting Multiple Traces ...................................................................................................... 12-5

Fo

Boolean Conditions ................................................................................................................... 13-1


Using Piecewise Continuous Functions ............................................................................... 13-2
Using Piecewise Continuous Functions ............................................................................... 13-4
Symbolics.................................................................................................................................. 14-1
Symbolic Calculation.......................................................................................................... 14-2
Symbolic Calculation.......................................................................................................... 14-4
Solving ...................................................................................................................................... 15-1
Solving for Roots of Equations............................................................................................ 15-2
Solving for Roots of Equations............................................................................................ 15-4
Numerically Solving Systems of Linear Equations ................................................................ 15-5
Numerically Solving Systems of Nonlinear Equations ........................................................... 15-8

Optimization .............................................................................................................................. 16-1


Constrained Optimization ................................................................................................... 16-2
Differential Equations ................................................................................................................ 17-1
Ordinary Differential Equations ........................................................................................... 17-2

Programming............................................................................................................................. 18-1
Looping Constructs............................................................................................................ 18-2
Looping Constructs............................................................................................................ 18-5

nl

Data Analysis............................................................................................................................. 20-1


Interpolating Data .............................................................................................................. 20-2
Regressing Data................................................................................................................ 20-3

se

Project Day 2........................................................................................................................... 21-1


Structural Engineering Project Day 2................................................................................ 21-2
Mechanical Engineering Project Day 2 ............................................................................. 21-3

Fo

rP

TC

In

te

rn

al

Challenge Exercise Solutions..................................................................................................... A-1


Typing Math: Solution ......................................................................................................... A-2
Define and Evaluate a Function: Solution............................................................................. A-4
Using a Range Variable: Solution ........................................................................................ A-5
Using Arrays: Solution ........................................................................................................ A-7
Using Units: Solution .......................................................................................................... A-9
Using Piecewise Continuous Functions: Solution.................................................................A-12
Solving for Roots of Equations: Solution .............................................................................A-14
Numerically Solving Systems of Nonlinear Equations: Solution.............................................A-15
Looping Constructs: Solution..............................................................................................A-18
Interpolating Data: Solution ................................................................................................A-20

y
nl
O
se
U
al

Module 3

Fo

rP

TC

In

te

rn

Entering and Editing Math

2013 PTC

Module 3 | Page 1

Exercise 1: Typing Math


Objectives
After successfully completing this exercise, you will be able to:
Type a mathematical expression in Mathcad.

Scenario

Task 1:

nl

Create the following expression:

Type a mathematical expression.

al

2. Type 1.

Beginning with the next step, execute


each step sequentially without exiting
the Math region created.

se

1. Click in a blank area of the worksheet.

.
.

In

Select Division

te

Operators

rn

operator.
3. Insert the Division
Select the Math tab.
In the Operators and Symbols group, click

Insert operators by selecting the Math

TC

, and
tab, clicking Operators
selecting the desired operator.

rP

4. Insert the Square Root and Nth Root


operator.
5. Type x+ y in the placeholder. To type the

Fo

exponents, insert the Exponentiation


operator.

6. Press SPACEBAR to select the entire


expression. Insert the Multiplication
operator.

7. Type sin. Insert the Parentheses


operator.
8. Type x+ in the argument placeholder.
9. Type cos. Insert the Parentheses
10. Type x in the argument placeholder.

operator.

This completes the exercise.


Module 3 | Page 2

2013 PTC

Exercise 2: Typing Math (CHALLENGE)


Objectives
After successfully completing this exercise, you will be able to:
Type a mathematical expression in Mathcad.
Evaluate a mathematical expression in Mathcad.

Scenario

nl

Create and evaluate a double integral.


Insert the mathematical expression shown.

Task 1:

se

1. Insert the shell of the expression.


2. Fill in the empty placeholders of the expression with the math shown.

To insert the Greek letters, you can use the keyboard shortcuts. Alternately, you can

in the Operators and Symbols group, and

rP

TC

In

te

rn

al

select the Math tab, click Symbols


select the desired Greek letter.

3. When the entire expression has been inserted, evaluate it numerically.

Fo

This completes the exercise.

2013 PTC

Module 3 | Page 3

y
nl
O
se
U
al
rn
te
In
TC
rP
Fo
Module 3 | Page 4

2013 PTC

y
nl
U

se

O
Variables

Fo

rP

TC

In

te

rn

al

Module 4

2013 PTC

Module 4 | Page 1

Exercise 1: Defining and Evaluating a Variable


Objectives
After successfully completing this exercise, you will be able to:

Define an expression.
Evaluate an expression.
Retroactively assign a variable name to an expression.
Evaluate a variable.

nl

Scenario

Create and evaluate the mathematical expression.

rn

Task 1:

al

se

Type the expression shown, evaluate it, retroactively assign the expression to a variable, and
evaluate the variable.

and select Integral

In

click Operators

te

1. Click in a blank area of the worksheet. Select the


Math tab. In the Operators and Symbols group,

TC

2. Type 0 and in the limit placeholders.


To insert you can select the Math
, and select

rP

tab, click Constants


Pi

Fo

3. Type in the expression as shown.

Module 4 | Page 2

2013 PTC

4. To evaluate the integral, click in the region and press =.

rn

al

se

1. Place the cursor on the left side of the expression, as shown.

nl

Retroactively assign the expression to a variable and evaluate the variable.

Task 2:

2. Select the Math tab. In the Operators and Symbols group, click Operators
.

rP

TC

In

te

Definition

and select

Fo

3. Type Var in the placeholder and click outside of the region.

4. To evaluate the variable separately, click in a


blank space in the worksheet below or to the
right of the variable definition. Type Var and
press =.
This completes the exercise.

2013 PTC

Module 4 | Page 3

y
nl
O
se
U
al
rn
te
In
TC
rP
Fo
Module 4 | Page 4

2013 PTC

y
nl
U

se

O
Functions

Fo

rP

TC

In

te

rn

al

Module 5

2013 PTC

Module 5 | Page 1

Exercise 1: Define and Evaluate a Function


(CHALLENGE)
Objectives
After successfully completing this exercise, you will be able to:

nl

Define a user-defined function.


Insert a built-in function.
Evaluate a function.

Scenario

Calculate the area of the parallelogram.

rn

Task 1:

al

se

Calculate the area of the following parallelogram:

In

te

1. Calculate the area of the parallelogram shown


using the values listed above. Note the angle
must be in radians.
The expression for area in terms of a, b, and ,
is shown.

Fo

rP

TC

2. Assign the area expression to a user defined


function AREA with arguments a, b, and .
3. Evaluate the function using the values shown:

This completes the exercise.

Module 5 | Page 2

2013 PTC

y
nl
O
U

se

Range Variables

Fo

rP

TC

In

te

rn

al

Module 6

2013 PTC

Module 6 | Page 1

Exercise 1: Using a Range Variable


Objectives
After successfully completing this exercise, you will be able to:
Define and evaluate a range variable.
Use a range variable in a function calculation.

nl

You must define a range variable, y, going from -1 to 1 in increments of 0.5.

Scenario

Task 1:

You must also define a function and use the range variable in the function evaluation.
Define the range variable.

al

Select Definition

rn

Operators

operator.
2. Insert the Definition
Select the Math tab.
In the Operators and Symbols group, click

se

1. Click in a blank area of the worksheet and type


the range variable name y.

te

You can insert any operator by selecting


,

In

the Math tab, clicking Operators


and selecting the desired operator.

TC

3. Type the first value of the range followed by a


comma, -1,. Two placeholders and the Range
operator appear.

rP

4. Type the second value in the range, -0.5, in the


first placeholder, and type the last value in the
range, 1, in the second placeholder.
Task 2:

Define and evaluate the function.

Fo

1. Define the function shown.

Module 6 | Page 2

2013 PTC

nl

2. Evaluate the function and range variable side-by-side.

Fo

rP

TC

In

te

rn

al

se

This completes the exercise.

2013 PTC

Module 6 | Page 3

Exercise 2: Using A Range Variable (CHALLENGE)


Objectives
After successfully completing this exercise, you will be able to:

Define a range variable.


Evaluate a range variable.
Define and evaluate a function using a range variable.

nl

Scenario

al

se

Evaluate the centerline deflection of a shaft that is loaded with a concentrated load at the center.
The load varies from 1 to 5 lbs in 0.2 lb increments.

Where:

TC

In

te

rn

I = Moment of Inertia (in4)


I = 10.5
L = Length of the shaft (in)
L = 16
E = Modulus of Elasticity (psi)
E = 10 x 106
W = Load (lbs)
W varies from 1 to 5 lbs in 0.2 lb increments

rP

Do not use units in this exercise.

Fo

This completes the exercise.

Module 6 | Page 4

2013 PTC

y
nl
O
se
U
al

Module 8

Fo

rP

TC

In

te

rn

Vectors and Matrices

2013 PTC

Module 8 | Page 1

Exercise 1: Defining and Extracting Elements from an


Array
Objectives
After successfully completing this exercise, you will be able to:

nl

Define and evaluate an array.


Extract columns from an array.
Recombine the columns to form a new array.

Scenario

Define a 3-by-3 array, M, whose elements are equal to the sum of their corresponding indices.

se

After defining and evaluating array M, extract each of the three columns individually, assign each of
them to a variable, and then add them together, resulting in a vector MV.

Task 1:

Define and evaluate a 3-by-3 array M.

Remember to assign the built-in variable ORIGIN a value of 1.

rn

al

1. Define two range variables, i and j, for rows and


columns, going from 1 to 3 in increments of 1.

te

operator.
Type i and insert the Definition
Type the range variable definition, 1..3, in the
placeholder.
Repeat to define the range variable j.

In

You can also insert the range variable


symbol by selecting the Math tab,

, and selecting

TC

clicking Operators
Range

rP

2. Type the name of the array, M, and insert the


Matrix Index

operator.

Fo

3. In the subscript placeholder, type i,j, representing


the rows and columns of the matrix.

4. Insert the Definition

operator.

5. Type the sum of the indices, i+j, in the


placeholder.

Module 8 | Page 2

2013 PTC

6. In a blank area of the worksheet, type M and


operator to evaluate

insert the Evaluation


the matrix.

operator.

operator.

al

3. Insert the Matrix Column

2. Type the name of the array, M, in the placeholder.

se

1. Type C1 and insert the Definition

Extract each column and assign it to a variable.

Task 2:

nl

Never include the range variable


subscripts when displaying an array.
The subscripts are not part of the
variable name and force Mathcad to
display the array in a table by stacking
the rows into a column.

In

te

rn

4. Type 1 in the placeholder to extract the first


column. Evaluate the variable C1.

Fo

rP

TC

5. Repeat for columns 2 and 3, defining them as


C2 and C3.

Task 3:

Add the extracted columns together and assign the result to a new vector.

1. Type MV and insert the Definition

operator.

2. Type C1+C2+C3 in the placeholder.

2013 PTC

Module 8 | Page 3

3. Type MV and insert the Evaluation


to evaluate the vector MV.

operator

Fo

rP

TC

In

te

rn

al

se

nl

This completes the exercise.

Module 8 | Page 4

2013 PTC

Exercise 2: Using Arrays (CHALLENGE)


Objectives
After successfully completing this exercise, you will be able to:

Define an array.
Evaluate a function using an array.
Create a new array containing the original array and the function results using the augment function.

nl

Scenario

When evaluating a function over a range, Mathcad creates two matrices. One contains the range
variable and one contains the function results. A single matrix containing both is a more desirable
output.

Create a single matrix containing t and the results of f(t).

se

In the following exercise, define a range variable t, from 1 to 10 in increments of 0.5. Place the
range variable, t, in a matrix and use it in the following function:

Fo

rP

TC

In

te

rn

al

This completes the exercise.

2013 PTC

Module 8 | Page 5

y
nl
O
se
U
al
rn
te
In
TC
rP
Fo
Module 8 | Page 6

2013 PTC

y
nl
U

se

O
Units

Fo

rP

TC

In

te

rn

al

Module 9

2013 PTC

Module 9 | Page 1

Exercise 1: Using Units


Objectives
After successfully completing this exercise, you will be able to:

Apply units to a variable.


Evaluate a function using units.
Define a custom unit.

nl

Scenario

Define the resistance function and evaluate.

se

Task 1:

Define a function for resistance using voltage (V) and current (i) as arguments. Evaluate this
function using variables with units assigned. Then define a custom unit and reevaluate the function
using this custom unit.

1. Define a function R1 (for resistance) which takes


V (voltage) and i (current) as arguments.

rn

al

2. Evaluate the function using V = 30V and i = 50


mA.

te

3. Evaluate the function again using the same


arguments, but format the result such that the
units are not simplified.

Define a custom unit and reevaluate the function.

TC

Task 2:

In

4. Evaluate the function using V = 100V and i = 15


mA. Display the result in k.

1. Define a custom unit for V = 10-6V.

rP

2. Evaluate the function for V = 20 V and i = 78


mA.

Fo

This completes the exercise.

Module 9 | Page 2

2013 PTC

Exercise 2: Using Units (CHALLENGE)


Objectives
After successfully completing this exercise, you will be able to:
Define variables using units.
Evaluate a function using units.

Scenario

se

nl

Study the deflection of a beam with both ends simply supported with a concentrated intermediate
load, W, applied a distance, a, from the left end of the beam.

Task 1:

al

Define the beam properties and constants.

rP

TC

In

te

rn

1. Define the following beam properties and constants.

Define the reaction forces, moments, slopes, and deflections at the left and
right ends of the beam, denoted by A and B respectively.

Fo

Task 2:

1. Define the following for the left (A) end of the beam:

2013 PTC

Module 9 | Page 3

Task 3:

Define a formula for the deflection of the beam and evaluate.

nl

2. Define the following for the right (B) end of the beam:

se

1. Define the following formula for the deflection of the beam at point x, where 0 < x < L:

al

The final term in the definition of y(x) is included when the Boolean term, x > a, is
true (or equal to 1 internally). Think of this term as an on/off switch.

te

rn

2. Calculate the deflection at x = L/2. Display the result in inches and millimeters.
3. Calculate a table of deflections for points along the beam, beginning at x = 0 ft and stopping
at x = L = 30 ft. Use a total of 51 points over the range. Display the result in inches and
millimeters.

In

This example was adapted from the Mathcad electronic book Roark's Formulas
for Stress & Strain.

Fo

rP

TC

This completes the exercise.

Module 9 | Page 4

2013 PTC

Exercise 3: Using Temperature Units


Objectives
After successfully completing this exercise, you will be able to:
Define a temperature unit.
Rescale a temperature unit.

Task 1:

Define the initial variables.

se

1. Define the ambient temperature in degrees


Celsius.
Use implied multiplication when
inserting degrees Celsius.

al

2. Define the temperature rise per Watt.

nl

Calculate the temperature at which an electric component fails.

Scenario

rn

3. Define the maximum power rating in Watts.

Task 2:

te

Define the temperature at which the component fails, and evaluate.

In

1. Combine the three variables previously


defined to define the temperature at which the
component fails.

Fo

rP

TC

2. Display the failure temperature in Kelvin,


degrees Celsius, and degrees Fahrenheit.

This completes the exercise.

2013 PTC

Module 9 | Page 5

y
nl
O
se
U
al
rn
te
In
TC
rP
Fo
Module 9 | Page 6

2013 PTC

y
nl
O
U

se

2-D Plotting

Fo

rP

TC

In

te

rn

al

Module 10

2013 PTC

Module 10 | Page 1

Exercise 1: Plotting Functions in 2-D


Objectives
After successfully completing this exercise, you will be able to:
Plot functions in 2-D.

Scenario

nl

Task 1:

Plot a resonance curve as a family of curves for a forced mechanical system.


Define the function and the range of frequency.

1. Define the natural frequency of the system, .

Plot the function.

In

1. Insert a 2-D plot region.


Select the Plots tab.

te

Task 2:

rn

3. Define a range variable for the frequency,


, representing the plot range. Note the
incorporation of into the range.

In the Traces group, click Insert Plot

. A blank plot region

rP

TC

Select XY Plot
appears.

al

se

2. Define the function f(, ) shown, where:


represents the frequency of the system.
represents the damping coefficient.

Fo

2. Type in the x-axis placeholder.

Module 10 | Page 2

2013 PTC

3. Click in the vertical placeholder. Insert four


additional placeholders.
Select the Plots tab.

se

Fo

rP

TC

In

te

This completes the exercise.

rn

al

This exercise was adapted from:


Zill, Dennis G. and Michael R. Cullen.
Advanced Engineering Mathematics.
PWS Publishing Company, Boston:
1992. 197.

4. Type the function in the empty placeholders,


using five different values of , as shown in the
figure. Click outside of the plot region to display
the plot.

nl

four
In the Traces group. click Add Trace
times to add four additional placeholders.

2013 PTC

Module 10 | Page 3

y
nl
O
se
U
al
rn
te
In
TC
rP
Fo
Module 10 | Page 4

2013 PTC

y
nl
O
U

se

Project Day 1

Fo

rP

TC

In

te

rn

al

Module 11

2013 PTC

Module 11 | Page 1

Exercise 1: Structural Engineering Project Day 1


(CHALLENGE)
Objectives
After successfully completing this exercise, you will be able to:

nl

Define variables.
Define and use a table.
Create and evaluate equations.
Define range variables.
Use calculus operators.
Create a 2D plot.

se

Scenario
In this project, you analyze a simply supported beam.

Calculate reactions, moment, slope, and deflection at the supports.

al

Task 1:

Save the completed file. You will use it for the project in day 2.

rP

TC

In

te

rn

1. Define the following beam properties for the


beam shown using a table.
t=20.2 mm
h=903.3 mm
b=303.3 mm
s= 15.1 mm
Ix=325253 cm4
E=120 kN/mm2

Fo

2. Define the dimensions and load for the beam


shown.
L=15 m
a= 5 m
W=18 kN

Module 11 | Page 2

2013 PTC

se

nl

3. Create the equations and calculate the reaction, moment, slope, and deflection at the left
support using the equations shown.

rP

TC

In

te

rn

al

4. Create the equations and calculate the reaction, moment, slope, and deflection at the right
support using the equations shown.

Task 2:

Calculate the deflection, slope, moment, and shear along the length of the beam.

Fo

1. Calculate the deflection along the length of the beam using the equation shown.

2. Differentiate the deflection equation to derive


equation for slope as shown.

2013 PTC

Module 11 | Page 3

3. Differentiate the deflection equation to derive


equation for moment as shown.

Plot the shear, moment, slope, and deflection along the length of the beam.

nl

Task 3:

4. Differentiate the deflection equation to derive


equation for shear as shown.

se
U

Calculate the average shear stress at the intersection between the flange
and the web at the location of maximum shear.

te

Task 4:

rn

al

2. Plot the deflection and slope along the length


of the beam on a 2D plot. Format the plot as
shown.

1. Plot the shear and moment along the length


of the beam on a 2D plot. Format the plot as
shown.

In

1. Assign the maximum shear force, Vmax equal to the reaction at the left support, R1.

Fo

rP

TC

2. Calculate the first moment of the area, Q, using


the equations shown.

3. Calculate the average shear stress at the


intersection between the flange and the web
using the equation shown.

Module 11 | Page 4

2013 PTC

Task 5:

Format the Mathcad document with headers and footers.

1. In the header of the Mathcad document, type Structural Project: Beam Structural
Analysis.
2. In the footer of the document, insert the data and page number.
3. Save the completed file to use in day 2.

Fo

rP

TC

In

te

rn

al

se

nl

This completes the exercise.

2013 PTC

Module 11 | Page 5

Exercise 2: Mechanical Engineering Project Day 1


(CHALLENGE)
Objectives
After successfully completing this exercise, you will be able to:

Define variables.
Create and evaluate equations.
Use operators.
Define range variables.
Create and use matrices.
Create a 2D plot.

nl

Scenario

rn

1. Define the following properties for the shaft.


Youngs Modulus, E = 210 GPA
Outer Diameter, D = 10 cm
Inner Diameter, d = 9 cm
Shaft Length, l = 1 m

Calculate the critical speed of the shaft.

al

Task 1:

se

In this project, you calculate the critical speed of a shaft bearing with an asymmetrical load, and
how the critical speed varies with load location.
Save the completed file. You will use it for the project in day 2.

TC

In

te

2. Define the following load properties for the shaft


shown.
Mass, M = 10 kg
Load Location, a = 50 cm

Fo

rP

3. Calculate the critical speed of the shaft using the equations shown.

Task 2:

Calculate how the critical speed varies with load position and plot the results.

1. Calculate the critical speed of the shaft with changes on load position.
2. Plot the load location vs. critical speed of the shaft.
Module 11 | Page 6

2013 PTC

Task 3:

Format the Mathcad document with headers and footers.

1. In the header of the Mathcad document, type Mechanical Project: Critical Speed of Shaft
Bearing.
2. In the footer of the document, insert the data and page number.
3. Save the completed file to use in day 2.

Fo

rP

TC

In

te

rn

al

se

nl

This completes the exercise.

2013 PTC

Module 11 | Page 7

y
nl
O
se
U
al
rn
te
In
TC
rP
Fo
Module 11 | Page 8

2013 PTC

y
nl
O
U

se

3-D Plotting

Fo

rP

TC

In

te

rn

al

Module 12

2013 PTC

Module 12 | Page 1

Exercise 1: Plotting Multiple Traces


Objectives
After successfully completing this exercise, you will be able to:
Plot data on a 3-D plot.
Plot a function on a 3-D plot.
Format a 3-D plot.

Scenario
Define the function and data to plot.

Task 1:

nl

Plot a set of data and plot a surface that passes through the data points. The plots are formatted
such that the prominent features of both appear.

se

1. Define the function shown.

2. Define the data for the scatter plot, as shown.

Plot the data and function on the same plot.

In

Task 2:

te

rn

al

It is possible to save vertical space in a document by transposing a matrix.

1. Insert a 3D plot region.


Select the Plots tab.

TC

In the Traces group, click Insert Plot


. A blank plot region

rP

Select 3D Plot
appears.

Fo

2. Type the matrix name, Data, in the placeholder.


3. Add a second trace.
Select the Plots tab.
. A
In the Traces group, click Add Trace
second placeholder appears.
Type the function name only, S, with no
arguments, in the placeholder. Click outside
the plot to display the plots.
A QuickPlot always appears over the
default domain of 10 to 10 for the
independent variables.

Module 12 | Page 2

2013 PTC

Format the plot.

Task 3:

1. Enlarge the plot symbols for the matrix plot.


Click in the plot region and select the first
trace, Data.
Select the Plots tab.
In the Styles group, click Trace Thickness

se

te

rn

al

2. Change the plot domain.


Click the x-axis in the axis selector. The
x-axis in the axis selector and in the plot are
highlighted in blue.
Click the tick mark values and edit them to
range from 0 to 3 in steps of 1.
Click the y-axis in the axis selector. The
y-axis in the axis selector and in the plot are
highlighted in blue.
Click the tick mark values and edit them to
range from 0 to 3 in steps of 1.
3. Click outside the region to view the modified plot.

nl

and select a thicker trace.


Rotate the plot to view the data points, if
necessary.

TC

In

4. Edit the color and fill of the surface plot.


Click in the plot region and select the second
trace, S.
Select the Plots tab.
In the Styles group, click Trace Color
and select red.

Fo

rP

In the Styles group, click Surface Fill


and select red.
5. Click outside the region.

2013 PTC

Module 12 | Page 3

6. Hide the axis expressions.


Click in the plot region.
Select the Plots tab.
In the Axes group, click Axis Expressions

nl

to de-select.
7. Click outside the region.

Fo

rP

TC

In

te

rn

al

se

This completes the exercise.

Module 12 | Page 4

2013 PTC

Exercise 2: Plotting Multiple Traces (CHALLENGE)


Objectives
After successfully completing this exercise, you will be able to:

Scenario

nl

Plot a function in three dimensions.


Plot data in three dimensions.
Format a three dimensional plot.

Task 1:

Plot a function and format the resulting plot.

te

rn

al

2. Plot the function on a 3-D plot.


3. Format the plot as follows:
Scale the z axis to range from -75 to 75.
Scale the x axis to range from -4 to 4.
Scale the y axis to range from -4 to 4.
Fill the plot surface with the color red.

se

1. Define the function shown.

Plot data and a function on the same three dimensional plot and format the plot.

Task 2:

In

Plot data on the same plot used in task 1 and format the plot.

rP

TC

1. Define the data shown in three separate matrices and augment the results into one matrix.

Fo

2. Plot the function and data on the same graph.


3. Format the plot so each plot is visible.
Increase the size of the data points.
Edit the color of the data points to red.

Task 3:

Verify your results.

1. Review the following file to verify your results: EC_PlotMultipleTraces_P2_Solution.


This completes the exercise.

2013 PTC

Module 12 | Page 5

y
nl
O
se
U
al
rn
te
In
TC
rP
Fo
Module 12 | Page 6

2013 PTC

y
nl
O
se
U

Boolean Conditions

Fo

rP

TC

In

te

rn

al

Module 13

2013 PTC

Module 13 | Page 1

Exercise 1: Using Piecewise Continuous Functions


Objectives
After successfully completing this exercise, you will be able to:
Create a Piecewise Continuous function.
Plot a Piecewise Continuous function.

Scenario

al

se

nl

The simple beam shown has a length equal to 25 inches. It is loaded with a 10 pound concentrated
load, resulting in the shear diagram shown. Integrating the shear equation results in the moment
equation. The following steps are necessary to create and plot a Piecewise Continuous function to
validate the moment equation:
Create the equation for the shear diagram.
Calculate the moment along the beam by integrating the shear equation.
Plot both equations.

te

Shear Diagram

Create the equation for the shear diagram and plot the equation.

In

Task 1:

rn

Simple Beam

TC

1. Create a range variable, Lx, representing the


location along the beam length. The range
variable increases in increments of 0.1 in.
2. Validate the range variable by evaluating it.

Fo

rP

Remember to change the units to


inches.

Module 13 | Page 2

2013 PTC

3. Create the equation for the shear diagram as a function of Lx. Use Boolean operators to
represent the entire shear diagram in one equation.

se

nl

4. Plot the shear diagram to validate the shear


function.

Task 2:

Calculate the moment along the beam by integrating the shear equation.

Fo

rP

TC

In

te

rn

al

1. Integrate the shear function to determine the moment along the length. Because the shear
function is a step function, it must be integrated in two parts.
First Section
Second Section

2. Plot the moment diagram to validate the moment


function.

This completes the exercise.


2013 PTC

Module 13 | Page 3

Exercise 2: Using Piecewise Continuous Functions


(CHALLENGE)
Objectives
After successfully completing this exercise, you will be able to:

nl

Use Boolean operators to create a Piecewise Continuous function.


Integrate the Piecewise Continuous function.
Plot the function and the integrated function.

Scenario

Task 1:

TC

In

te

rn

al

se

Use Boolean operators to create a Piecewise Continuous function of the velocity of a particle
traveling in the positive x direction at 10 m/sec. As shown in the graph, the particle begins
decelerating at a rate of 20 m/sec2. Then determine the equation for the displacement of the particle
by integrating the velocity equation, and plot both the velocity and displacement curves.

Create the equation for the velocity of the particle.

Fo

rP

1. Create the equation for the velocity as a function of time.


2. Define a range variable for time. Use 0.1 second as the first value in the range.
3. Verify the resulting equation for velocity is correct by graphing it.
Task 2:

Create an equation for the displacement of the particle.

1. Create the equation for the displacement of the particle as a function of time by integrating
the equation for velocity created in Task 1. Integrate the equation from 0 to t.
2. Calculate the displacement of the particle at 5 sec.
3. Plot the displacement of the particle on the same graph created in the previous task.

This completes the exercise.

Module 13 | Page 4

2013 PTC

y
nl
O
U

se

Symbolics

Fo

rP

TC

In

te

rn

al

Module 14

2013 PTC

Module 14 | Page 1

Exercise 1: Symbolic Calculation


Objectives
After successfully completing this exercise, you will be able to:
Solve an expression using symbolics.
Use multiple symbolic keywords in a symbolic calculation.
Retroactively assign and evaluate the results.

Scenario
Symbolically solve for a variable using the solve keyword.

Task 1:

nl

Use the solve and float keywords in a symbolic solution, and retroactively assign and evaluate
the results.

se

1. Type the expression, as shown.


Remember to insert the Equal To
operator.

Add the float keyword to view the result in decimal form.

In

Task 2:

te

rn

al

The results are returned in a 2x1 vector.

2. Place the cursor to the right of the expression and insert the solve keyword. Click outside the
region to evaluate.

rP

TC

1. Using the existing expression, position the cursor to the right of the solve keyword as shown.

Fo

2. Insert the float keyword.

3. Type 4 in the placeholder to approximate the solution to four floating point digits of accuracy.
Click outside the region to evaluate.

Module 14 | Page 2

2013 PTC

Retroactively assign and evaluate the results.

Task 3:

operator.

se

2. Insert the Definition

nl

1. Using the existing expression, position the cursor to the left of the expression, as shown.

rn

al

3. Type R in the placeholder.

operator.

te

4. Extract each root by inserting the Matrix Index

TC

In

Note that an array origin of 1 is used.

Fo

rP

This completes the exercise.

2013 PTC

Module 14 | Page 3

Exercise 2: Symbolic Calculation (CHALLENGE)


Objectives
After successfully completing this exercise, you will be able to:

Solve an expression using symbolics.


Retroactively assign and evaluate the solution results.
Plot the solution.

nl

Scenario

Task 1:

Use the solve and invlaplace keywords to solve a transfer function and calculate the response in
the time domain.
Type the transfer function in Mathcad and perform the calculations described.

se

1. Type in the transfer function shown.

rn

Create a 2-D plot of the poles in the complex plane.

te

Task 2:

al

2. Insert the solve keyword to calculate the poles of the function; that is, the values of s for
which T(s) is undefined.
3. Retroactively assign the result of the previous step to a variable P.

In

1. Insert the Matrix Index


operator to extract each root.
2. Use the built-in Re and Im functions to plot the imaginary part verses the real part of each root.
3. Format the plot such that each pole appears as a red X. You might have to modify the window
of the plot to provide a good view.

Insert the invlaplace keyword to calculate the response in the time domain.
Retroactively assign the result of the previous step to a function R(t).
Define a range variable for t from 0 to 20 in increments of 0.1.
Create a 2-D X-Y plot of R(t) verses t.

rP

1.
2.
3.
4.

Calculate the response in the time domain and plot.

TC

Task 3:

Verify your results.

Fo

Task 4:

1. Review the following file to verify your results: EC_SymbolicCalc_P2_Solution.

This completes the exercise.

Module 14 | Page 4

2013 PTC

y
nl
O
U

se

Solving

Fo

rP

TC

In

te

rn

al

Module 15

2013 PTC

Module 15 | Page 1

Exercise 1: Solving for Roots of Equations


Objectives
After successfully completing this exercise, you will be able to:
Find multiple roots of a function using the built-in root function.

Scenario

nl

Task 1:

Solve for multiple roots of a function using the built-in root function.
Define and plot the function.

se

1. Type in the function shown below.

2. Define a range variable for t ranging from 0 to 3


in increments of 0.01.

Task 2:

TC

In

te

rn

al

3. Plot t verses g(t) to display the roots.

Find the roots of the function and plot.

Fo

rP

1. Find the first root using the two-argument case


of the root function with a guess value of 0.1.

2. Find the second root by changing the guess


value of t to 1.5.

3. Redefine t as a range variable.

Module 15 | Page 2

2013 PTC

se

nl

4. Plot the function g(t) and add two vertical markers to the plot, one at each root.

Fo

rP

TC

In

te

rn

al

This completes the exercise.

2013 PTC

Module 15 | Page 3

Exercise 2: Solving for Roots of Equations


(CHALLENGE)
Objectives
After successfully completing this exercise, you will be able to:

Solve for the roots of an equation using the built-in root function.

nl

Scenario

se

The following function, M(x), represents the moment equation for a concrete beam. The beam is
200 units long.

The roots of this function represent a change in sign for the internal moment in the beam. This is
important in the design of the beam because it identifies where the sections of the beam change
from tension to compression, or compression to tension.
Plot the moment function, and evaluate the roots using the built-in root function.

Fo

rP

TC

In

te

rn

al

This completes the exercise.

Module 15 | Page 4

2013 PTC

Exercise 3: Numerically Solving Systems of Linear


Equations
Objectives
After successfully completing this exercise, you will be able to:

nl

Scenario

Numerically solve a system of linear equations using a solve block.


Use units in the solve block.

al

se

Following Kirchhoffs Law, use a solve block with units to calculate the current traveling in the three
loops of the circuit shown.

Task 1:

rn

Calculate the current in the three loops.

TC

In

te

1. Define the voltage and the 6 resistances in the circuit.

rP

2. Click in a blank area of the worksheet and insert


a solve block.
Select the Math tab.
.

Fo

In the Regions group, click Solve Block


A blank solve block region appears.

2013 PTC

Module 15 | Page 5

nl

3. In the Guess Values section of the solve block,


type dimensionally-appropriate guess values for
the 3 currents, as shown. Use the unit milliamps,
mA.

rn

al

Select the Equal To


operator in
the constraint equations.

se

4. In the Constraints section of the solve block, type


the equations shown describing the relationship
between the voltage, resistance, and current in
the circuit for the three loops.

rP

TC

In

te

5. In the Solver section of the solve block, close the


solve block with a vector containing the unknown
variables assigned to the Find function.

Fo

6. Display the results in milliamps, mA.

Module 15 | Page 6

2013 PTC

nl

7. Remove the units from at least one of the guess


values and observe the results.

Fo

rP

TC

In

te

rn

al

se

This completes the exercise.

2013 PTC

Module 15 | Page 7

Exercise 4: Numerically Solving Systems of Nonlinear


Equations (CHALLENGE)
Objectives
After successfully completing this exercise, you will be able to:

Numerically solve a system of nonlinear equations using a solve block.

nl

Scenario

se

It is known that friction factor, f, pipe roughness, , pipe diameter, D, and Reynolds number, Re,
are related by the following equation.

Using a numeric solve block, calculate the friction factor, assuming the following known quantities:

rn

al

Pipe Diameter
D = 2.5 in
Pipe Roughness
= 8.5 x 10-4 in
Reynolds Number
Re = 104

TC

In

te

Create a plot of friction factor versus Reynolds numbers by calling the solve block iteratively using
the vector of Reynolds numbers provided in the expression shown.

rP

Note that you must establish the call to Find as a function of Reynolds number. For
example: MyFunc(Re) := find( f ).

Fo

This completes the exercise.

Module 15 | Page 8

2013 PTC

y
nl
O
U

se

Optimization

Fo

rP

TC

In

te

rn

al

Module 16

2013 PTC

Module 16 | Page 1

Exercise 1: Constrained Optimization


Objectives
After successfully completing this exercise, you will be able to:
Solve a constrained optimization problem.

Scenario

Solve the following constrained optimization problem.

Solve a constrained optimization problem.

rn

Task 1:

al

se

nl

The desired state is a paper grocery bag with a volume of 1.5 ft3. Calculate the necessary
dimensions of the bag to use the least amount of paper. To simplify the problem, ignore all overlap
used to glue the bags together.

In

te

1. Define the objective function shown for the surface area of the bag (in terms of L, W, and
H) as the area of the base plus the area of the four sides.

TC

2. Insert a solve block.


Select the Math tab.

Fo

rP

In the Regions group, click Solve Block


A blank solve block region appears.

Module 16 | Page 2

2013 PTC

nl

3. In the Guess Values section of the solve block,


define dimensionally-appropriate guess values
for L, W, and H, as shown.

te

rn

al

se

4. In the Constraints section of the solve block,


define the constraints shown using Boolean
operators.

In

5. In the Solver section, close the solve block with


a vector assignment to the minimize function.

TC

You can insert the minimize function


by selecting the Functions tab. In the
,

Fo

rP

Functions group, click Solving


and select minimize.

2013 PTC

Module 16 | Page 3

nl

6. Evaluate and confirm that the constraints are


satisfied.

Fo

rP

TC

In

te

rn

al

se

This completes the exercise.

Module 16 | Page 4

2013 PTC

y
nl
O
se
U
al

Module 17

Fo

rP

TC

In

te

rn

Differential Equations

2013 PTC

Module 17 | Page 1

Exercise 1: Ordinary Differential Equations


Objectives
After successfully completing this exercise, you will be able to:
Solve an ordinary differential equation.

Scenario
Define and solve the ordinary differential equation for the system.

nl

Task 1:

Solve an ordinary differential equation for a simple spring-mass system with several values of a
forcing function constant, .

se

1. Define the mass and spring constant, k.

2. Insert a solve block.


Select the Math tab.

al

In

te

rn

In the Regions group, click Solve Block


A blank solve block appears.

Fo

rP

TC

3. In the Constraints section of the solve block,


define the equation for a spring-mass system
without damping. Use the prime notation, where
y(t) represents the displacement of the spring
at time t.

4. Define the initial conditions, displacement, and


velocity for the system. Assume that initial
displacement and initial velocity are not placed
on the spring.

Module 17 | Page 2

2013 PTC

5. Close the solve block by assigning Y as a


function of the forcing constant, , to the function
odesolve. Solve the system for t over the range
0 to 60.

nl

Note that Y() is actually a function of t


for each value of the parameter .

Task 2:

se

1. Solve the system for =0.8 and =1 by


assigning the label Y1 to the function of t
denoted by Y(0.8), and similarly Y2 to Y(1) as
shown.

Solve the system for two values of the parameter and plot.

rn

al

2. Define a range t from 0 to 60 in increments of


0.1.

rP

TC

In

te

3. Plot the solutions using a 2-D x-y plot.

Fo

This completes the exercise.

2013 PTC

Module 17 | Page 3

y
nl
O
se
U
al
rn
te
In
TC
rP
Fo
Module 17 | Page 4

2013 PTC

y
nl
O
U

se

Programming

Fo

rP

TC

In

te

rn

al

Module 18

2013 PTC

Module 18 | Page 1

Exercise 1: Looping Constructs


Objectives
After successfully completing this exercise, you will be able to:
Create a program using for loops.

Scenario

1. Open a new worksheet and set the ORIGIN value to 1.


Select the Calculation tab.
In the Worksheet Settings group, click ORIGIN.
Select 1.

al

2. Define the program as a function, odds(M),


where M is the array to be passed to the
program.

Create the program using for loops.

se

Task 1:

nl

Create a Mathcad program using for loops that takes an arbitrary m-by-n array as an argument,
and then calculates the number of odd elements and their sum.

In

Programming

te

rn

3. Insert a program construct and define a counting


and summing variable within the program.
Select the Math tab.
In the Operators and Symbols group, click

TC

.
Select Program
Initialize c and s to 0 respectively, as the first
two lines of code, by selecting the Local
operator. To insert a new
Assignment
line, highlight the previous line and press
ENTER.

rP

You can insert programming operators


by selecting the Math tab, clicking
, and selecting the

Fo

Programming
desired operator.

4. To examine each element of the array, M, use


a nested for loop.
Insert a new line.
Insert a for loop operator.
Click in the indented placeholder and insert
another for loop operator.

Module 18 | Page 2

2013 PTC

5. Begin to define the indices of the loops, i


and j respectively, by typing them in the first
placeholder of each for loop as shown. The
outer index, i, iterates over the rows while the
inner index, j, iterates over the columns.

nl

6. Define the range for each loop using the range


variable operator. You can type the built-in
functions rows(M) and cols(M) in the worksheet.

In

te

rn

al

7. Click in the indented placeholder and add a line


by pressing ENTER.
On the first line, insert an if operator.
On the second line, insert an else operator.
Add a second line to the indented if construct.
The programming construct appears as shown.

se

, and

Math tab, clicking Operators


selecting Range

You can insert the range variable


operator by typing .., or by selecting the

TC

8. Determine if the element of M is odd, using


the built-in mod function. The mod function
divides its first argument by its second argument
and returns the remainder. To determine if
an element is odd, compare the element of M
with 2 to see if the remainder is 1. Type the
programming expressions shown.

Fo

rP

Note the following:


The subscripts used are Matrix Index

2013 PTC

subscripts.

A Boolean Equal To
used.

operator is

Module 18 | Page 3

9. If the element is odd, count it and sum it.


Type in the expressions shown to increment c
by 1 and add the element of M to s.
The subscripts used are Matrix Index

nl

subscripts.

10. If the element is not odd, proceed to the else


statement. The else statement should cause the
program to increment the inner loop, j. This is
accomplished using the continue operator.

se

Do not type the continue operator using


the keyboard. You must insert it using
the Programming operators.

In

te

rn

al

11. Return the count, c, and the sum, s, from the


program.
Press SPACEBAR until the entire outer for
loop highlights.
Press ENTER to add a new line.
Insert a 2x1 matrix in the placeholder.
Type s and type c in the two empty
placeholders that appear.
To insert the matrix, select the
Matrices/Tables tab, click Insert
, and select a 2x1 matrix.

TC

Matrix

Fo

rP

12. Test the program by defining the array, M, as


shown and passing it to the program.

This completes the exercise.

Module 18 | Page 4

2013 PTC

Exercise 2: Looping Constructs (CHALLENGE)


Objectives
After successfully completing this exercise, you will be able to:
Create a Mathcad program using looping constructs.

Scenario

Create a Mathcad program using looping constructs and use the program to create a customized
function that sorts and removes repeated values from a vector of data.

Task 1:

nl

This kind of function is useful with built-in interpolation functions like cspline, which require a vector
that is monotonically increasing.

1. Write a Mathcad program, cleanup(v), which:


Accepts a vector, v, as an argument.
Sorts the vector into increasing order.
Removes repeated values from the vector.
Returns the sorted, cleaned up vector.

se

Write a Mathcad program, cleanup(v).

al

The program works for any vector, regardless of length.

rP

TC

In

te

rn

2. Test the program using the following vector, v.

Fo

3. The program should return the output shown.

This completes the exercise.


2013 PTC

Module 18 | Page 5

y
nl
O
se
U
al
rn
te
In
TC
rP
Fo
Module 18 | Page 6

2013 PTC

y
nl
O
U

se

Data Analysis

Fo

rP

TC

In

te

rn

al

Module 20

2013 PTC

Module 20 | Page 1

Exercise 1: Interpolating Data (CHALLENGE)


Objectives
After successfully completing this exercise, you will be able to:
Interpolate a set of data using linear interpolation.

Scenario

Use the following set of data to create an ammonia enthalpy function using linear interpolation.

In

te

rn

al

se

nl

For a constant pressure of 10 psia, the enthalpy in BTU/lb of ammonia for temperature, T, in
degrees, F, is given:

Create an ammonia enthalpy function using the function linterp.

rP

Task 1:

TC

Temperature is listed in the first column, and enthalpy is listed in the second column.
Do not use units in this exercise.

Fo

1. Begin by typing the data into your worksheet in two separate vectors, T and H.
2. Define a function h(T), using linear interpolation, which represents the enthalpy of ammonia,
h, at temperature T.
3. Calculate the enthalpy at T = 38 F.
4. Create a 2-D plot showing the data and the function on the same set of axes. Use a range
variable T1 from 0 to 50 in increments of 0.1.
5. Plot the point calculated in the previous step at T = 38 F.

This completes the exercise.

Module 20 | Page 2

2013 PTC

Exercise 2: Regressing Data


Objectives
After successfully completing this exercise, you will be able to:
Regress a set of data using the polyfit function.

Scenario

nl

Regress a set of data using the polyfit function. Use a set of data in the Excel format,
datastep_07.xlsx, and fit several polynomials to the data. To begin, set the array origin equal to 1.
Task 1:

1. Assign a variable name to the data file name and path.

operator.

se

Type in the variable name Reg4 and insert a Definition


Select the Input/Output tab.

Import a set of data and create a range variable to use in the regression functions.

.
In the Data Import/Export group, click Data Filename
The Browser dialog box appears. Browse to the file datastep_07.xlsx. Click Open.

rn

al

Your file path is where you stored your file.

te

2. Assign the function READFILE to a variable name.


operator.

In

Type the variable name Data4 and insert a Definition


Select the Functions tab.

TC

.
In the Functions group, click File Access
Select the READFILE function.
Complete the first two placeholders as shown. Delete the remaining placeholders.

Fo

rP

The second argument is a string variable that may have one of the following values:
delimited, fixed, or Excel.

3. Using the Matrix Column


operator, extract
the first column of the data and assign it to the
variable X4. Extract the second column of the
data and assign it to the variable Y4.
4. Create a range variable, range4. Use the built-in functions min and max as shown.

2013 PTC

Module 20 | Page 3

Task 2:

Regress the original data using both a third and fourth order polynomial.

1. Assign the polyfit function to variables Fit3


and Fit4, representing third and fourth degree
polynomials as shown.

nl

2. To obtain the coefficients of the forth order


regressed polynomial, assign the polyfitc
function to a variable P.

se

3. Evaluate P to view the matrix containing the coefficients.

rn

al

4. Write the regressed function using the second column of the P matrix. The second column
contains the coefficients listed in increasing powers of xx, beginning with the coefficient of xx0.

Fo

rP

TC

In

te

5. Plot the three regressed functions and the original data.

This completes the exercise.

Module 20 | Page 4

2013 PTC

y
nl
O
U

se

Project Day 2

Fo

rP

TC

In

te

rn

al

Module 21

2013 PTC

Module 21 | Page 1

Exercise 1: Structural Engineering Project Day 2


(CHALLENGE)
Objectives
After successfully completing this exercise, you will be able to:
the Excel component.
the READEXCEL function.
matrices and matrix functions.
the programming functionality.

Use
Use
Use
Use

nl

Scenario

se

In this project, you import a table of beam sections for the beam used in the Structural Engineering
Day 1 project and select the sections that satisfies given design criteria.

Task 1:

In this exercise the origin is set to zero.

Define the design criteria and import a table of beam sections.

rn

al

1. Define the following design criteria:


Maximum allowable deflection: ymax = 4 mm
Maximum width of beam: bmax = 300 mm

In

te

2. Import the datafile StructuralProjectData.xlsx using an Excel component.


3. Output the following from the Excel component:
The beam section designation.
The depth of the section, h.
The width of the section, b.
The second moment of the area, Ix.
Select the sections that satisfy the design criteria and calculate the bending stress.

TC

Task 2:

1. Using the programming functionality, identify the sections that satisfy the design criteria.

Fo

rP

2. Calculate the bending stress for the sections that


satisfy the design criteria, using the equations
shown.

Task 3:

Verify your results.

1. Open the following file and verify your results:


Structural_Analysis_Prime2.mcdx
This completes the exercise.

Module 21 | Page 2

2013 PTC

Exercise 2: Mechanical Engineering Project Day 2


(CHALLENGE)
Objectives
After successfully completing this exercise, you will be able to:

nl

Create a spec table.


Create a program.
Create and use matrices and matrix functionality.

Scenario

Task 1:

Define the initial specifications and inputs.

Determine what combination of inner and outer diameter satisfies


the threshold limit specification.

rP

Task 2:

TC

In

te

rn

al

1. Define the threshold limit for the critical speed of


the shaft, Rlimit, to be equal to 1.946x104 rpm.
2. Define a spec table as shown.

se

In this project you set a threshold limit for the critical speed and vary the inner and outer diameter of
the shaft used in the Mechanical Engineering Day 1 project.

Fo

1. Create a program using for loops to determine what combination of inner and outer diameters
meets the threshold limit specifications.
2. Output the final results in rpm.
3. Create a frequency table/matrix, as shown.

2013 PTC

Module 21 | Page 3

Task 3:

Plot the shaft thickness versus critical speed for the thickness.

nl

4. Create a Pass Fail table/matrix, as shown.

Verify your results.

1. Open the following file and verify your results:


Mechanical_shaft_bearing_Prime2.mcdx

Fo

rP

TC

In

te

rn

al

This completes the exercise.

Task 4:

se

1. Using only the combinations of inner and outer diameter that satisfy the critical speed
threshold limit specification, plot the shaft thickness versus the critical speed for each
thickness of the shaft.

Module 21 | Page 4

2013 PTC

y
nl
O
se
U
al

Appendix A

Fo

rP

TC

In

te

rn

Challenge Exercise Solutions

2013 PTC

Appendix A | Page 1

Exercise 1: Typing Math: Solution (CHALLENGE)


Objectives
After successfully completing this exercise, you will be able to:
Type a mathematical expression in Mathcad.
Evaluate a mathematical expression in Mathcad.

Scenario
Insert the mathematical expression.

Task 1:

nl

Create and evaluate a double integral.

se

1. Create the shell of the expression by inserting


the double integral symbols.
Select the Math tab.
In the Operators and Symbols group, click

again to create the double

rn

Integral
integral.

al

Select Definite Integral


.
Place the cursor in the expression placeholder
of the integral operator and select Definite

Operators

te

2. Type the limits of the integral by clicking the


placeholders and typing the numerical values
for the limits.

In

To insert the constant , select the Math


tab. In the Operators and Symbols

Pi

, and select

TC

group, click Constants


.

rP

3. Type the expression in the appropriate placeholder and type and to complete the integral.
To insert the Greek letters, select the Math tab. In the Operators and Symbols
, and select the appropriate symbol.

Fo

group, click Symbols

Appendix A | Page 2

2013 PTC

4. When the entire expression has been inserted, click anywhere inside the region and evaluate
operator.

se

nl

it numerically by inserting the Evaluation

Fo

rP

TC

In

te

rn

al

This completes the exercise.

2013 PTC

Appendix A | Page 3

Exercise 2: Define and Evaluate a Function: Solution


(CHALLENGE)
Objectives
After successfully completing this exercise, you will be able to:

Scenario

se

Calculate the area of the following parallelogram using the values shown:

nl

Define a user-defined function.


Insert a built-in function.
Evaluate a function.

al

Calculate the area of the parallelogram shown using the values listed
above. Note the angle must be in radians.

rn

Task 1:

te

1. Create the function for area in terms of a, b, and


, as shown.

rP

TC

In

2. Assign the given initial values to each of the


variables as shown.

3. Evaluate the function.

Fo

4. Assign new values to each of the variables as


shown.

5. Evaluate the function using the new values.

This completes the exercise.


Appendix A | Page 4

2013 PTC

Exercise 3: Using a Range Variable: Solution


(CHALLENGE)
Objectives
After successfully completing this exercise, you will be able to:

nl

Define a range variable.


Evaluate a range variable.
Define and evaluate a function using a range variable.

Scenario

rn

al

se

Evaluate the centerline deflection of a shaft that is loaded with a concentrated load at the center.
The load varies from 1 lb to 5 lb in 0.2 lb increments.

Where:

TC

In

te

I = Moment of inertia (in4)


I = 10.5
L = Length of the shaft (in)
L = 16
E = Modulus of elasticity (psi)
E = 10 x 106
W = Load (lb)
W varies from 1 to 5 lb in 0.2 lb increments

rP

Do not use units in this exercise.

Evaluate the centerline deflection of the beam.

Fo

Task 1:

1. Define the beam constants.

2013 PTC

Appendix A | Page 5

se

nl

2. Define the load W as a range variable, and


evaluate to validate the values.

TC

In

te

rn

4. Evaluate the deflection at the center for all


values of W.

al

3. Type the deflection equation as a function of the


load W.

Fo

rP

This completes the exercise.

Appendix A | Page 6

2013 PTC

Exercise 4: Using Arrays: Solution (CHALLENGE)


Objectives
After successfully completing this exercise, you will be able to:

Define an array.
Evaluate a function using an array.
Create a new array containing the original array and the function results using the augment function.

nl

Scenario

When evaluating a function over a range, Mathcad creates two matrices. One contains the range
variable and one contains the function results. A single matrix containing both is a more desirable
output.

Task 1:

Create a single matrix containing t and the results of f(t).

se

Define a range variable, t, from 1 to 10 in increments of 0.5. Place the range variable, t, in a matrix
and use it in the following function:

al

Define the range variable, t.

rn

1. Globally assign the built-in variable ORIGIN


equal to 1.
2. Create a range variable, t, as shown.
Task 2:

te

Convert the range variable to a matrix, T.

In

1. Create the expression shown to convert the


range variable, t, to a matrix, T.

Task 3:

TC

The subscript used is the Matrix Index


subscript.
Define and evaluate the function.

Fo

rP

1. Define the function, f(t).

2013 PTC

Appendix A | Page 7

Task 4:

al

se

nl

2. Evaluate the function using the matrix, T. Type


f(T) and press =.

Create a single matrix containing the vector T and the results of the function f(T).

operator.

te

a Definition

rn

1. Type the name of the new array, New, and insert

In

2. Type the function augment in the placeholder


with the vectors T and f(T) as the arguments.

Fo

rP

TC

3. Type New and press = to evaluate.

This completes the exercise.


Appendix A | Page 8

2013 PTC

Exercise 5: Using Units: Solution (CHALLENGE)


Objectives
After successfully completing this exercise, you will be able to:
Define variables using units.
Evaluate a function using units.

Scenario

se

nl

Study the deflection of a beam with both ends simply supported with a concentrated intermediate
load, W, applied a distance, a, from the left end of the beam.

Task 1:

Define the beam properties and constants.

rP

TC

In

te

rn

al

1. Define the following beam properties and


constants:
Area moment of inertia, I.
Length of beam, L.
Distance from left edge of beam to load, a.
Modulus of elasticity, E.
Load, W.

Task 2:

Define the reaction forces, moments, slopes, and deflections at the left and
right ends of the beam, denoted by A and B respectively.

Fo

1. Define the following for the left (A) end of the


beam.
Reaction, RA.
Moment, MA.
Slope, A.
Deflection, yA.

2013 PTC

Appendix A | Page 9

Define a formula for the deflection of the beam and evaluate.

Task 3:

se

nl

2. Define the following for the right (B) end of the


beam.
Reaction, RB.
Moment, MB.
Slope, B.
Deflection, yB.

1. Define the following formula for the deflection of the beam at point x, where 0 < x < L.

te

rn

al

The final term in the definition of y(x) is included when the Boolean term, x > a, is
true (or equal to 1 internally). Think of this term as an on/off switch.

rP

TC

In

2. Calculate the deflection at x = L/2. Display the


result in inches and millimeters.

Fo

3. Calculate a table of deflections for points along


the beam, beginning at x = 0 ft and stopping at
x = L = 30 ft. Use a total of 51 points over the
range.
Define a range variable x in terms of L.

Appendix A | Page 10

2013 PTC

4. Evaluate the values of x in inches, Y(x) in inches, and Y(x) in millimeters.

nl

This example was adapted from the Mathcad electronic book Roark's Formulas
for Stress & Strain.

Fo

rP

TC

In

te

rn

al

se

This completes the exercise.

2013 PTC

Appendix A | Page 11

Exercise 6: Using Piecewise Continuous Functions:


Solution (CHALLENGE)
Objectives
After successfully completing this exercise, you will be able to:

nl

Use Boolean operators to create a Piecewise Continuous function.


Integrate the Piecewise Continuous function.
Plot the function and the integrated function.

Scenario

Task 1:

TC

In

te

rn

al

se

Use Boolean operators to create a Piecewise Continuous function of the velocity of a particle
traveling in the positive x direction at 10 m/sec. As shown in the graph, the particle begins
decelerating at a rate of 20 m/sec2. Then determine the equation for the displacement of the particle
by integrating the velocity equation, and plot both the velocity and displacement curves.

Create the equation for the velocity of the particle.

Fo

rP

1. Type the equation for the velocity of the particle as a function of time.

2. Define a range variable, t, for time, from 0.1 sec


to 5 sec, in increments of 0.1 sec.

Appendix A | Page 12

2013 PTC

Task 2:

se

1. Type the equation for the displacement of the


particle as a function of time using the integral of
the velocity equation created in Task 1.

Create an equation for the displacement of the particle.

nl

3. Create a x-y plot of the function, v(t).

al

2. Calculate the displacement of the particle at 5


sec.

rn

3. Plot the displacement of the particle on the same


graph created in the previous task.

TC

In

te

You can change the y-axis scale so you


can view the entire graph.

Fo

rP

This completes the exercise.

2013 PTC

Appendix A | Page 13

Exercise 7: Solving for Roots of Equations: Solution


(CHALLENGE)
Objectives
After successfully completing this exercise, you will be able to:

Solve for the roots of an equation using the built-in root function.

nl

Scenario

se

The following function, M(x), represents the moment equation for a concrete beam. The beam is
200 units long.

The roots of this function represent a change in sign for the internal moment in the beam. This is
important in the design of the beam because it identifies where the sections of the beam change
from tension to compression, or compression to tension.
Plot the moment function, and evaluate the roots using the built-in root function.
Plot the moment function and use it to estimate the roots of the equation.

rn

1. Define a range variable from 0 to 200, in


increments of 1.0.

al

Task 1:

In

te

2. Type the moment equation as a function of x.

Fo

rP

TC

3. Plot the moment function.

4. Define a guess value for the root of the function.


5. Use the root function to evaluate the root.

This completes the exercise.

Appendix A | Page 14

2013 PTC

Exercise 8: Numerically Solving Systems of Nonlinear


Equations: Solution (CHALLENGE)
Objectives
After successfully completing this exercise, you will be able to:

Numerically solve a system of nonlinear equations using a solve block.

nl

Scenario

se

It is known that friction factor, f, pipe roughness, , pipe diameter, D, and Reynolds number, Re,
are related by the following equation:

rn
te

Pipe diameter
D = 2.5 in
Pipe roughness
= 8.5 x 10-4 in
Reynolds number
Re = 104

al

Using a numeric solve block, calculate the friction factor assuming the following known quantities:

rP

TC

In

Create a plot of friction factor versus Reynolds numbers by calling the solve block iteratively using
the vector of Reynolds numbers provided in the expression shown.

Fo

Note that the call to Find must be set up as a function of the Reynolds number. For
example: MyFunc(Re) := find( f ).

Task 1:

Using a numeric solve block, calculate the friction factor.

1. Define the given variables:


Pipe diameter, D.
Pipe roughness, .
Reynolds number, Re.

2013 PTC

Appendix A | Page 15

nl

2. Create a solve block to solve for the friction


factor, f.

rn

1. Set ORIGIN equal to 1.0.


2. Define a range variable, i, from 1 to 20 in
increments of 1.0.

Create a plot of friction factor versus Reynolds numbers by calling the solve block
iteratively using the vector of Reynolds numbers provided below. Note that the call to
Find must be set up as a function of the Reynolds number; that is, MyFunc(Re) := find( f ).

al

Task 2:

se

3. Evaluate the friction factor, f.

3. Create a vector of Reynolds numbers using the


range variable, i.

te

All subscripts used are Matrix Index


subscripts.

Fo

rP

TC

In

4. Create a solve block to solve for the friction


factors, f.

5. Assign the results of the solve block to a vector, f.

Appendix A | Page 16

2013 PTC

nl

6. Plot the friction factor, f, verses the Reynolds


number, Re.

Fo

rP

TC

In

te

rn

al

se

This completes the exercise.

2013 PTC

Appendix A | Page 17

Exercise 9: Looping Constructs: Solution (CHALLENGE)


Objectives
After successfully completing this exercise, you will be able to:
Create a Mathcad program using looping constructs.

Scenario

nl

Create a Mathcad program using looping constructs and use the program to create a customized
function that sorts and removes repeated values from a vector of data.

1. Type the name of the program including the


argument v, cleanup(v).

operator.

rn

3. Insert a Program

operator.

al

2. Insert a Definition

se

Write a Mathcad program, cleanup(v), which accepts a vector, v, as an


argument, sorts the vector into increasing order, removes repeated values from
the vector, and returns the sorted, cleaned up vector.

Task 1:

This kind of function is useful with built-in interpolation functions like cspline, which require a vector
that is monotonically increasing.

4. Type the lines of programming code, adding lines as needed.

Fo

rP

TC

In

te

All subscripts used in the program are Matrix Index subscripts.

Appendix A | Page 18

2013 PTC

nl

5. Create the following vector, v.

Fo

rP

TC

In

te

This completes the exercise.

rn

al

se

6. Evaluate the program using the vector, v.

2013 PTC

Appendix A | Page 19

Exercise 10: Interpolating Data: Solution (CHALLENGE)


Objectives
After successfully completing this exercise, you will be able to:
Interpolate a set of data using linear interpolation.

Scenario

Use the following set of data to create an ammonia enthalpy function using linear interpolation.

In

te

rn

al

se

nl

For a constant pressure of 10 psia, the enthalpy in BTU/lb of ammonia for temperature, T, in
degrees, F, is given:

Fo

rP

TC

Temperature is listed in the first column, and enthalpy is listed in the second column.
Do not use units in this exercise.

Appendix A | Page 20

2013 PTC

Task 1:

Create an ammonia enthalpy function using the function linterp.

se

nl

1. Type the data into your worksheet in two separate vectors, T and H.

rn

al

2. Create the enthalpy function by typing the


function, as shown.

te

3. Calculate the enthalpy at T = 38 F.

Task 2:

In

Create a 2-D plot showing the data and the function on the same set of axes.
Use a range variable, T1, from 0 to 50 in increments of 0.1.

TC

1. Define a range variable, T1, from 0 to 50 in


increments of 0.1.

Fo

rP

2. Insert a graph region and plot data points T


verses H, and interpolated line T1 verses h(T1).

2013 PTC

Appendix A | Page 21

se

nl

3. Plot the enthalpy point calculated at T = 38 F.

Fo

rP

TC

In

te

rn

al

This completes the exercise.

Appendix A | Page 22

2013 PTC

Anda mungkin juga menyukai