November 2007
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]
HOME

Machining Woes? Leave it to the Pros
PTC Updates
Tips of the Month
Knowledge Base Exclusive
Mathcad Methods
Webcasts & Events
Farewell to Prototypes – Flow Simulation Made Easy

Contact PTC | Privacy Policy | PTC Express Archive | Subscribe | Unsubscribe | Change Preferences | Edit Profile

This e-mail was sent to: h-aaldering@jazo.nl   PTC, 140 Kendrick Street, Needham, MA 02494 USA
If you are unable to read this page correctly, please click here