After many years of writing programs with FORTRAN, I started using Mathcad for my general purpose modeling needs. I started slowly, using it to perform rather simple calculations. I especially liked the unit conversion features.
Gradually, I learned more powerful features, such as symbolic solutions, solve blocks for simultaneous nonlinear equations (both numerical and symbolic), ODE and PDE solvers, data regression, curve fitting, and "design of experiments" functions.
One feature that I was not impressed with at first was the linear nature of the calculations on the "whiteboard". The whiteboard is the basic calculation format in Mathcad. The whiteboard has no looping capability. Each line is calculated in sequence, top to bottom. A line can be repeated according to a range variable (an index) before moving to the next line, but a traditional "DO LOOP" involving multiple lines as in FORTRAN does not exist for the whiteboard. Another format in Mathcad is the "programming" format. The programming format is used to build programs or subroutines that include "FOR" or "WHILE" loops, so Mathcad can be used for nearly all programming needs.
I finally figured out that functions could be created so that they could be used repeatedly without the need to loop back to the computation defined by the function.
The concept of functions is made even more powerful by the ability of Mathcad to solve systems of equations in parametric form. This includes ODE systems. Thus, the solution variables in these equation systems can be defined as functions of the parameters used in those equations.
When I was using FORTRAN, I used subroutines but rarely used functions. Because of my experience with Mathcad, I would certainly program in FORTRAN differently were I to ever need it (not likely).
The linear nature of Mathcad actually taught me a better way to program. I still would like to have a loop capability on the whiteboard, but it is not a high priority. I guess I've just given an argument why the loop capability should not be added.
In my next blog I will show how the solution to a cocurrent heat exchanger was turned into a function for use in the integration of the calorimetric kinetic model.