Documenting Mathcad Components
by Alvaro Diaz
|
Sometimes some calculations are implemented as basic code. Mathcad is a useful tool to translate and analyze the behavior of these calculations. The objective of this worksheet is to show how to implement a simple but traceable component for using basic language inside Mathcad. |
|
The component (or control) of interest, is the Text Box component. You can find the help about controls under QuickSheets > Programming. |
|
The Controls can be found under the Insert menu as shown. |
|
Use the contextual menu, to access the Component Properties and the script code. |
|
Setting up Control Properties |
|
For example, this component |
|
The Component Internal Code |
|
This schema is useful for developing purposes, but the final work looks undocumented. To show what code is executed, insert a Text Box named Editor with this internal code | 
|
With the ExecuteGlobal statement you can use the control text as the program. Here is the result: |
|
A VBScript Runge-Kutta Solver |
|
This example is Runge-Kutta solver writing in VBScript. Notice that the code inside the Class declaration generates an error in the Sub EditorEvent_Start, because the class name can't be repeated. Then, if you modify this part of the code, you also need to 'modify' the internal script (selecting Edit Script from contextual menu, and exiting) to tell Mathcad that something has happened. |
|
Inside the Text Box Copy and Paste are called with [Ctrl] [Shift] C and [Ctrl] [Shift] V respectively. |
- Elementary Differential Equations and Boundary Value Problems, Boyce, DiPrima. Wiley, ISBN: 978-0-471-43338-5
- Microsoft Corporation (1997) Visual Basic 5, Component Tools Guide
- Mathcad Documentation
|
[PRINTER FRIENDLY VERSION]
|