Defining Functions Locally in Programs
|
Functions can be defined using the local definition operator. |
|
Local functions are defined within a program and are only recognized inside of the program. |
|
To set up a local function, define your function followed by the variable |
|
Then add the local assignment operator, keystroke, { ,and the definition: |
|
Use the Add Line operator, keystroke, ], to insert a second placeholder for an additional programming operator statement. |
|
The last placeholder contains the value returned by the program. |
|
This construct allows you to dynamically modify functions passed as arguments to other functions. The rkfixed function is one such example. By allowing local function definitions, you can modify parameters to the derivative vector that is passed into rkfixed. |
|
The derivative vector Der corresponds to the following differential equation. |
|
Call the Z function for different values of m and k. |
Right-click, choose Save Target As, and change the extension to XMCD and File Type to All to download Mathcad file. (Mathcad 13)
Was this article helpful? Let us know.
|
[PRINTER FRIENDLY VERSION]
|