If you have a complex calculation that you reuse frequently,
you don't have to
repeatedly enter a long, complex formula.
Instead, you can create your own
function to perform the calculation.
User-defined functions can be called just
like built-in ones, but it is up to
you to define them. Next example shows how
to define
function that calculate the volume of the cone :
Volume of Cone = (1/3) × PI × r2 × h
This formula can be transformed in user defined function and
entered in
CalcSharp in following steps :
Step 1. Formula above can be written as a function with two parameters :
cone_volume( radius, height ) = 1/3 * PI * radius ** 2 * height
Step 2. In order to define this function in CalcSharp, it is necessery to
replace parameter names with ordinal positions prefixed with '@' sign :
cone_volume( @1, @2 ) = 1/3 * PI * @1 **2 * @2
Step 3. To add this function in CalcSharp, right-click any
function group in
expression builder and choose "Add function" from context menu. Fill
the form in following way :