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

Programming With Mathcad Prime 6

The document discusses a Mathcad program called A that calculates the area of a circle. The program defines radius as a local variable using the local assignment operator. It then calculates area using the formula π*radius^2. The program can be evaluated on the worksheet by calling A and passing in a value for the radius. Any variables defined within the program are local and will result in errors if used outside the program. The document notes that while programs can be written as single lines, Mathcad's programming tools allow for clear multi-line definitions using structures like programs.

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)
104 views

Programming With Mathcad Prime 6

The document discusses a Mathcad program called A that calculates the area of a circle. The program defines radius as a local variable using the local assignment operator. It then calculates area using the formula π*radius^2. The program can be evaluated on the worksheet by calling A and passing in a value for the radius. Any variables defined within the program are local and will result in errors if used outside the program. The document notes that while programs can be written as single lines, Mathcad's programming tools allow for clear multi-line definitions using structures like programs.

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

Step 3: Follow these instructions to add the second line of the program:

Type Area in the placeholder

Left-Click on the Local Assignment operator icon on the Programming toolbar

Left-Click on the Constants icon on Mathcad’s Math ribbon

Left-Click on the symbol for π to insert the value for this constant

Type *radius^2 to finish the definition of the formula for Area and then hit the ENTER key

Left-Click outside of the Math region to complete the definition of the program

Using a Mathcad Program


Once defined, a Mathcad program can be called
anywhere below the program definition in the worksheet
using an evaluation statement. A is a program to find the
area of a circle. The program has two steps: (1) calculate
the radius of the circle and (2) calculate the area using
the formula π*radius2.

We can call (or evaluate the) the program on the


worksheet by typing:

A(2m=

Or This result will initially


appear in meters.
Change m to ft and the
A(0.375ft= result converts
automatically.
If we attempt to evaluate radius outside of the function,
we receive an error message since it is a locally defined
variable.

Notes about Program A (Area of a Circle)


A is a simple Mathcad program that can also be written as a single line statement, rather than a multiline
program. We have used this example to introduce two important Mathcad Programming tools: new
Program structure ( | ) and Local Assignment (  ). The new Program structure icon allows for multi-line
function definitions. The Local Assignment operator enables variable names to be created and used within
a Mathcad function. These local variables do not exist outside of the program definition on the worksheet.

The presentation of A in this tutorial highlights the ways that Mathcad’s programming capabilities allow
for both clear communication and efficient notation. In this program the use of local variables for radius

Programming with Mathcad Prime | pg. 4

You might also like