# Programming with PTC Mathcad Prime

Written By: Cosmin Negru
• Math Software
• 11/29/2017

We all understand how critical calculations and testing are to engineering projects. Sometimes it takes numerous iterations to get the right results. Doing those tests manually involves heaps of trial and error, though. When you use paper or more elementary math software, you can’t program your calculations to do non-linear instructions or log errors for you.

You can do all that and more in PTC Mathcad. And you don’t need to know
Java or Python or any other common programming language. In fact, you don’t need code writing experience at all. Your math and engineering knowledge is more than enough.

Any engineer with PTC Mathcad can incorporate programming logic and:

• Conditionally evaluate decision branches
• Add looping constructs to engineering analysis
• Add breakpoints, or trap errors to help troubleshooting
• Save hours of trial and error compared to traditional methods

PTC Mathcad leads you through the entire process of creating programs. So long as you know the basic logic for the problem you want to solve, you just choose the programming constructs from a menu and fill in the blank placeholders.

The best part? Even the programming language in PTC Mathcad uses natural math notation. Here’s a basic example.

Use those operators to build a bubble plot function. When you use programming in PTC Mathcad, you can skip the matrix and 18 plot commands. Simply set up the entire sequence in a few lines of code. The example below establishes the matrix, then methodically plots each number before looping back to grab and plot the next number. After the last number in the matrix is plotted, the program self-terminates.

Enter some example data:

Create what’s needed for the plot:

Then use the first column as x values and second column as y values in XP Plots:

The programming in PTC Mathcad is made for engineers. It includes natural math notation, and the code fits neatly beside all your other equations, tables, text, and graphs. You can download the 30-day trial today and get started. No books, classes, or previous experience necessary.

Protip: Programming also puts more of your calculations and test code into fewer areas, so you can more
easily hide and protect your intellectual property.

Tags:
• Math Software