• 9/27/2016

Programming Your Math Software Is Easy in Mathcad Prime

$name

Programming is a word that scares many people. Previously, when I thought of programming my math software, I thought of complex, sensitive syntax that is not intuitive and difficult to decipher for everyone except an expert. That was until, I tried Mathcad’s programming.

Getting Started Programming Math Software

Mathcad only requires you to understand the fundamental concepts of a looping or conditional statement. Let’s review those:

For (loop) – a control flow statement for specifying iteration, which allows code to be executed repeatedly. Do _____ for _____ number of times.

While (loop) – a control flow statement that allows code to be executed repeatedly based on a given Boolean condition. Repeat _____ until _____ becomes false.

If-else-else if (conditional) – features of a program, which perform different actions depending on the whether the Boolean condition proves true or false. If _____ is true do _____ else do _____. When you have multiple levels or Boolean conditions, you can introduce an else if statement. If _____ is true do _____ else if _____ is true do _____ else do _____.

The concepts themselves are rather simple. You are telling the algorithm to run a calculation a certain number of times or until a certain condition is met (loop), and/or you are dictating which action to take (conditional).

How to Program Mathcad Software

Suppose you stopped and asked for directions. The lady or gentleman may tell you “Just keep driving down this road until you get to Hudson Ave. and take a right.” That’s a while loop. This person is telling you to do something, keep driving down this road, until a condition is met, until you get to Hudson Ave, and then at that point take an action, take a right.

When you are starting a program, just think logically through how you need to explain to the computer how to proceed through all scenarios it may encounter. Maybe you need to iterate through two independent variables and checking each combination of the two against an if-else if-else statement.

With Mathcad you just need to insert these structures from the programming dropdown menu on the Math tab

Mathcad programming commands

Mathcad programming commands

And Mathcad will build out the framework for you to then enter your boolean conditions.

programming framework

A programming framework

In the placeholders you can use variables and functions you’ve previously defined in your worksheet and introduce local variables to a program such as a counter. Best of all, you can do it all with Mathcad’s signature natural math notation.

For a detailed step-by-step guidel, try this programming tutorial.

Programming framework with graph

Programming framework with resulting graph in Mathcad

Get Started with Mathcad

PTC Mathcad is engineering math software that helps you perform (and even program), analyze, and share all your most vital calculations. Engineers at ground-breaking companies use it, and now you can try it yourself, and see what this powerful math software can do for you.

 

Try Mathcad Today

Perform, analyze, document, and share your calculations starting now!

Tags: