150 likes | 978 Views
Mathcad Function & Program Examples. Ch E 111 David A. Rockstraw, Ph.D., P.E. New Mexico State University Chemical Engineering Department.
E N D
MathcadFunction & Program Examples Ch E 111 David A. Rockstraw, Ph.D., P.E. New Mexico State UniversityChemical Engineering Department
Define a Mathcad function CylinderArea(D,L) that requires the diameter (D) and length (L) of a cylinder as arguments, then calculates the surface area of a cylinder, and returns a vector that contains the area of the ends, the area of the lateral side, and the total surface area. Function: CylinderArea(D,L)
Write a function in Mathcad that is called using the statement Pythagorean(a,b), where a and b represent the legs of a right triangle. The function should return a three-element vector, where the first vector is the length of the hypotenuse, and the next two elements are the acute angles of the triangle in units of degrees. Function: Pythagorean(a,b)
In you deposit P dollars at an annual interest rate of i compounded monthly, each month interest in the amount P (i/12) is deposited into your account, providing a new principle of P + P (i/12). Write a program that takes as inputs the principle (P), the annual interest rate (i), the number of compounding periods per year (f), and the number of years over which the principle is kept in the bank (n), and returns the total amount of money in the account at the end of that period. Program balance(P,n,f,i)