Essential
PTC® Mathcad
Prime® 3.0A Guide for New and
Current Users
Brent Maxfield, P.E.
AMSTERDAM • BOSTON • HEIDELBERG • LONDON
NEW YORK • OXFORD • PARIS • SAN DIEGO
SAN FRANCISCO • SINGAPORE • SYDNEY • TOKYO
Academic Press is an imprint of Elsevier
@
Contents
Preface xvii
Acknowledgements xix
PART I BUILDING YOUR PTC MATHCAD TOOLBOX
CHAPTER 1 An Introduction to PTC® Mathcad Prime® 3.0 3
Before You Begin 3
PTC Mathcad Basics 4
Creating Simple Math Expressions 5
Grouping 6
Editing Expressions 9
Selecting Characters 9
Deleting Characters 9
Deleting and Replacing Operators 9
Modifying Expressions 10
PTC Mathcad Workspace 11
PTC Mathcad Button 12
Quick Access Toolbar 12
Open Worksheets Bar 12
Status Bar 12
Ribbon Bar 12
Math Tab 12
Operators 12
Symbols 13
Constants 14
Summary of Equal Signs 14
Regions 14
Math Regions 15
Text Regions 15
Plot Regions 15
Functions 16
Built-in Functions 16
User-defined Functions 17
Units 17
Assigning Units to Numbers 17
Evaluating and Displaying Units 19
Arrays and Subscripts 20
Creating Arrays 20
ORIGIN 21
vi Contents
Subscripts 22
Range Variables 26
Plotting - X-Y Plots 26
Plots Tab 26
Setting Plotting Ranges 28
Programming, Symbolic Calculations, Solving and Calculus 29
Getting Started Tab 32
Summary 32
Practice 33
CHAPTER 2 PTC® Mathcad Prime® 3.0 for Current
Mathcad 15 Users 35
Differences to Become Accustomed to 35
Tab Key 35
Extra Spacebar 36
Editing Expressions 36
Creating Text Boxes 36
Literal Subscripts 36
Page Breaks 37
Regions to the Right of the Right Margin Do Not Print 37
Units 37
Creating a Range Variable 38
Single Quote Does Not Add Parentheses 38
Highlighting Regions 38
Exciting New Features in PTC Mathcad Prime 39
Labels 39
Ribbon Bar 39
Open Worksheets Bar 39
Status Bar 40
Ability to "pin" a Worksheet on the RecentlyUsed Worksheets List 40
Remove Empty Space 40
Mixed Units in Arrays 40
Operators 40
Features from Mathcad 15 that Are Not in Mathcad
Prime 3.0 40
Summary 41
CHAPTER 3 Variables and Regions 43
Variables 43
Types of Variables 43
Rules for Naming Variables 43
Case and Font 43
Characters That Can Be Used in Variable Names 45
Contents
Literal Subscripts 45
Special Text Mode 46
String Variables 47
Why Use Variables 48
Regions 50
Understanding the Difference Between "activate" and
"select" 50
Selecting and Moving Regions 51
Separating Regions 51
Text Regions 51
Changing Font Characteristics 52
Controlling the Width of a Text Box 53
Paragraph Properties 53
Areas 53
Additional Information About Math Regions 54
Math Regions in Text Regions 54
Math Regions That Do Not Calculate 54
Find and Replace 55
Find 55
Replace 56
Inserting and Deleting Lines ..58
Page View and Page Breaks 58
View 59
Gridlines 60
Page Breaks 60
Summary 61
Practice 61
CHAPTER 4 Simple Functions 63
Built-in Functions 63
Labels 67
User-defined Functions 68
Assigning the "Function" Label to User-defined
Functions 68
Why Use User-defined Functions? 70
Using Multiple Arguments 71
Variables in User-defined Functions 71
Examples of User-defined Functions 75
Passing a Function to a Function 76
Warnings 77
Engineering Examples 81
Engineering Example 4.1: Column Buckling 81
Engineering Example 4.2: Torsional Shear Stress 82
Summary 83
Practice 83
viii Contents
CHAPTER 5 Units! 85
Introduction 86
Definitions 86
Changing the Default Unit System 87
Using and Displaying Units 87
Derived Units 90
Custom Default Unit System 91
Units of Force and Units of Mass 92
Creating Custom Units 93
Units in Equations 95
Using Labels to Distinguish Between Variables
and Units 97
Units in User-defined Functions 99
Units in Empirical Formulas 100
SIUnitsOf(x) 101
Unit Scaling Functions 105
Fahrenheit and Celsius 105
Change in Temperature 106
Degrees Minutes Seconds (DMS) 109
Hours Minutes Seconds {hhmmss) 110
Feet Inch Fraction (FIF) 113
Money 114
Dimensionless Units 114
Using the Unit Placeholder for Scaling 117
Summary 118
Practice 118
PART II HAND TOOLS FOR YOUR PTC MATHCAD TOOLBOX
CHAPTER 6 Arrays, Vectors, and Matrices 123Review of Chapter 1 123
Tables 124
Range Variables 127
Range Variables vs. Vectors 127
Converting a Range Variable to a Vector 128
Using Range Variables to Create Arrays 128
Using Units in Range Variables 132
Calculating Increments from the Beginning and EndingValues 134
Displaying Arrays 134
Displaying and Resizing a Large Matrix 137
Show/Hide Indices 139
Using Units with Arrays 141
Contents ix
Calculating with Arrays 144
Addition and Subtraction 144
Multiplication 144
Division 148
Array Functions 149
Creating Array Functions 149
Size Functions 151
Lookup Functions 151
Extracting Functions and Operators 154
Sorting Functions 156
PTC Mathcad Calculation Summary 156
Engineering Examples 156
Engineering Example 6.1: Using Vectors
in a User-defined Function 157
Engineering Example 6.2: Using Vectors in Expressions... 158
Engineering Example 6.3: Using Matrices in Functions
and Expressions 159
Engineering Example 6.4: Comparison of Using RangeVariables and Vectors 160
Summary 161
Practice 161
CHAPTER 7 Selected PTC Mathcad Functions 163
Review of Built-in Functions 164
Selected Functions 164
max and min Functions 164
mean and median Functions 166
Truncation and Rounding Functions 168
Summation Operator 178
(/"Function 185
linterp Function 186
Miscellaneous Categories of Functions 190
Curve Fitting, Regression, and Data Analysis 190
Error Function 190
String Functions 191
Picture Functions and Image Processing 191
Complex Numbers, Polar Coordinates, and MappingFunctions 191
Mapping Functions 192
Polar Notation 192
Angle Functions 192
Reading from and Writing to Files 192
Summary 195
Practice 196
X Contents
CHAPTER 8 Plotting 199
Plots Tab 199
Creating a Simple XY Plot 200
Creating a Simple Polar Plot 201
XY Plot Range and Tick Marks 204
Number of Points Plotted 207
Showing Only Points 207
Using Range Variables to Set Plot Domain 209
Polar Plot Range and Tick Marks 212
Graphing with Units 213
Formatting Plots 216
Axis Location 216
Location of Axis Placeholders 216
Markers 217
Formatting Plot Values 217
Logarithmic Scaling 218
Trace Styles 218
Labels 221
Graphing Multiple Functions 221
Scale Factors 224
Plotting Data Points 224
Range Variables 224
Data Vectors 230
Error Plots 233
Parametric Plotting 234
Trace and Zoom 235
Plotting over a Log Scale 236
Plotting a Family of Curves 238
3D Plots and Contour Plots 240
3D Plots 240
Contour Plots 250
Engineering Examples 253
Engineering Example 8.1 253
Engineering Example 8.2 254
Summary 259
Practice 259
CHAPTER 9 Simple Logic Programming 263
Introduction to the Programming Toolbar 263
Creating a Simple Program 264
Use of else j/and also if Operators 268
Local Assignment 276
Return Operator 277
Boolean Operators 279
Contents xi
Adding Lines to a Program 284
Using Conditional Programs to Make and DisplayConclusions 287
Engineering Examples 289
Engineering Example 9.1 289
Engineering Example 9.2 292
Summary 294
Practice 294
PART III POWER TOOLS FOR YOUR PTC MATHCAD
TOOLBOX
CHAPTER 10 Introduction to Symbolic Calculations 297
Getting Started with Symbolic Calculations 297
Keywords and Modifiers 298
Float 303
Solve 305
Explicit 309
Assume 311
Fully 311
Using 315
Solving a System of Equations 316
Expand, Simplify, and Factor 318
Coeffsand Collect 320
Substitute 322
Combine and Rewrite 322
Series 326
Explicit 327
Using More than One Keyword 330
Units with Symbolic Calculations 332
Additional Topics to Study 336
Summary 336
Practice 336
CHAPTER 11 Solving Engineering Equations 339
Root Function 340
Polyroots Function 343
Solve Blocks 345
Isolve Function 349
Solve Blocks using Maximize and Minimize 351
TOL, CTOL, and Minerr 351
Using Units 353
xii Contents
Engineering Examples 353
Engineering Example 11.1: Object in Motion 354
Engineering Example 11.2: Electrical Network 357
Engineering Example 11.3: Pipe Network 358
Engineering Example 11.4: Chemistry 361
Engineering Example 11.5: Determining the Flow
Properties of a Circular Pipe Flowing Partially Full 364
Engineering Example 11.6: Box Volume 365
Engineering Example 11.7: Maximize Profit 366
Summary 368
Practice 368
CHAPTER 12 Advanced Programming 369
Local Definition 369
Looping 371
For Loops 371
While Loops 375
Break and Continue Operators 379
Return Operator 380
Try-On Error Operator 381
Engineering Example 12.1 383
Summary 397
Practice 397
CHAPTER 13 Calculus and Differential Equations 399
Differentiation 399
Integration 407
Differential Equations 411
Ordinary Differential Equations (ODEs) 411
Partial Differential Equations (PDEs) 417
Engineering Examples 417
Engineering Example 13.1 417
Engineering Example 13.2 423
Practice 433
PART IV CREATING AND ORGANIZING YOUR ENGINEERINGCALCULATIONS WITH PTC MATHCAD
CHAPTER 14 Putting It All Together 437Introduction 437
Guidelines for Naming Variables 437
Naming Guideline 1 438
Naming Guideline 2 438
Naming Guideline 3 439
Contents xiii
Naming Guideline 4 439
Naming Guideline 5 440
PTC Mathcad Toolbox 440
Variables 440
Editing 440
User-defined Functions 441
Units! 441
PTC Mathcad Settings 441
Customizing PTC Mathcad with Templates 441
Hand Tools 441
Power Tools 442
Let's Start Building 442
What is Ahead 442
Summary 443
Practice 443
CHAPTER 15 PTC Mathcad Settings 445
PTC Mathcad Options 445
Enable Getting Started Tab 445
Enable PTC Places 447
Set the Path for Accessing Help at an Alternate
Location 447
Disable Quality Agent Reporting 447
Show PTC Mathcad News and Information 447
Specify an Alternate Folder for My Templates 447
Specify an Alternate Folder for Shared Templates 447
Use an Alternate Template When CreatingNew Worksheets 447
Ribbon Bar Settings 448
Math Tab 448
Matrices/Tables Tab 449
Plots Tab 450
Math Formatting Tab 450
Results Format 451
Show Trailing Zeros 452
Display Precision 453
Complex Values 455
Calculation Tab 455
Controls 456
Worksheet Settings 456
Document Tab 459
Page 459
View 460
Summary 461
Practice 461
xiv Contents
CHAPTER 16 Customizing PTC Mathcad 463
Styles 463
Math Formatting and Label Styles 464
Differentiating Between Variables with the Same Name....466
Applying Labels to User-defined Functions 468
Changing Label Styles 468
Math Font Changes: Region Specific Verses Global
Changes 470
Text Formatting 472
Headers and Footers 472
Creating Headers and Footers 473
Information to Include in Headers and Footers 474
Examples 475
Margins 476
Quick Access Toolbar Customization 476
Summary 477
Practice 477
CHAPTER 17 Templates 479
Information Saved in a Template 479
PTC Mathcad Templates 480
Review of Chapters 5, 15, and 16 481
Creating Templates 481
Where Are Templates Stored? 482
Creating Your Customized Template 483
EM Metric 483
Document Tab 483
Math Tab 485
Math Formatting Tab '. 485
Text Formatting Tab 486
Calculation Tab 487
EM US 489
Alternate Default Template 489
Summary 490
Practice 490
CHAPTER 18 Assembling Calculations from Standard
Calculation Worksheets 491
Copying Regions from Other PTC Mathcad Worksheets 492
Creating Standard Calculation Worksheets 492
Protecting Information 493
Potential Problems with Inserting Standard Calculation
Worksheets and Recommended Solutions 493
Guidelines 494
How to Use Redefined Variables in Project Calculations 495
Contents
Resetting Variables 499
Using User-defined Functions in Standard Calculation
Worksheets 502
Using the Include Feature 504
When to Separate Project Calculation Files 505
Summary 505
Practice 506
CHAPTER 19 Microsoft® Excel Component 507Introduction 507
Excel Component Block 508
Input Context 509
Excel Component Table 509
Output Context 509
Simple Example 510
Inputs and Outputs 511
Inputs 511
Outputs 511
Hiding Inputs and Outputs 516
Important Concepts 517
Opening, Closing, and Saving Excel 517
Input Values Have Precedence 517
What Displays in the Component Table 517
Dealing with Empty Cells 519
Inputs and Outputs Do Not Track Excel Changes 519
Existing Spreadsheets 523
Using Units with Excel 523
Input 523
Printing the Excel Component 526
Summary 527
Practice 527
CHAPTER 20 Conclusion 529
Advantages of PTC Mathcad 529
Creating Project Calculations 529
Additional Resources 530
Conclusion 530
Appendix 1: PTC® Mathcad Prime® 3.0 Keyboard Shortcuts 533
Appendix 2: Keyboard Shortcuts for Editing and Worksheet Management 541
Appendix 3: Greek Letters 543
Appendix 4: Built-in Constants and Variables 545
Appendix 5: Reference Tables 549
Index .' 553