0% found this document useful (0 votes)
234 views

Programming With Mathcad Prime 8

The document demonstrates how to model the mathematical concept of an average using iteration in Mathcad. It introduces a function called Averaginator that takes in a list of numbers and returns their average. The function adds up all the numbers in the list using a for loop controlled by a local count variable, and divides the total by the number of terms to calculate the average, mimicking the step-by-step process of the definition. The tutorial proceeds to outline the steps to define the program name and parameters, insert a for loop structure, and initialize the count variable to 0.

Uploaded by

Jay Cee
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
234 views

Programming With Mathcad Prime 8

The document demonstrates how to model the mathematical concept of an average using iteration in Mathcad. It introduces a function called Averaginator that takes in a list of numbers and returns their average. The function adds up all the numbers in the list using a for loop controlled by a local count variable, and divides the total by the number of terms to calculate the average, mimicking the step-by-step process of the definition. The tutorial proceeds to outline the steps to define the program name and parameters, insert a for loop structure, and initialize the count variable to 0.

Uploaded by

Jay Cee
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Modeling a Mathematical Process

Many mathematical concepts can be modeled in multiple ways, one of which is through iteration
(repeating the same step over and over). For instance, the concept of the mathematical mean (a.k.a.
average) of a set of numbers is often informally defined as “add up all the numbers in a list and then
divide by the number of terms in the list.” Such a definition can be programmed quite literally using
Mathcad’s Programming capabilities. I will use this example to demonstrate how to create a looping
structure in a Mathcad function.

In this part of the tutorial I will introduce the steps necessary to create the following function:

List will be a matrix


containing 1 or
more numbers

Averaginator is a function that follows the informal definition of a mathematical average in the above
paragraph. One goal of this part of this tutorial is to show how a program can be used to mimic a process
in a step-by-step manner.

Step 1: Define the Program Name and Parameters List

Type Averaginator(Terms,List: to create the left side of the assignment statement for the program

Left-Click on the Math ribbon and then Left-Click on the Programming icon

Left-Click on | to insert a new Program Structure in the function definition

Step 2: Define a local variable count to control the execution of the loop

Type count in the placeholder on the first line of the program

Left-click on the Programming menu and then left-click on  to insert a Local Assignment symbol

Type 0 and hit Enter to add a new line to the function definition

In this example we will count from 0 because


count will be used to control the execution of the
loop and as a matrix subscript to access the
terms in the list of values to be averaged.

Programming with Mathcad Prime | pg. 6

You might also like