Documenting Mathcad Components
mathcad 14 tutorials cheap mathcad 14
souce
http://www.oldforce.info/index.php?option=com_content&view=article&id=87:documenting-mathcad-components-&catid=34:tutorials
Objective
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. |
Components |
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. |
|
|
Contextual Menu |
Setting up Control Properties |
Example |
For example, this component |
|
does this computation: |
|
|
|
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: |
Documented Component |
Application Example |
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. |
Parameters |
ODE, y' = d(x,y) |
script notation |
|
Mathcad notation |
|
Initial Conditions |
|
|
Endpoint and Intervals |
|
|
Solutions |
Odesolve solution |
|
|
|
|
Script solution |
|
Comparison of results |
Plots |
|
Note |
Inside the Text Box Copy and Paste are called with [Ctrl] [Shift] C and [Ctrl] [Shift] V respectively.