User-Defined Functions and Constants

User-Defined Functions and Constants
UltimaCalc You can define as many variables, constants, and functions as you like. UltimaCalc saves these to a plain text file that you specify.
Get Defining

Defining a variable is as simple as typing its name followed by an equals sign and an expression. When this form is scanned, the expression is evaluated to produce a value, the variable is created, if necessary, and the value assigned is to it. Constants are created from variables. The window for managing variables, constants, and functions is shown below. The image shows a menu that has popped up in response to a right click on the line that is shown underlined.

View variables, constants and user functions

The contents of this menu are the actions that are appropriate to the item clicked on Clicking on a variable allows you to change it to a constant, and clicking on a constant allows you to change it back to a variable. You can therefore change the values of constants, should you need to do so.

The image shows a function named delta which returns the value 1 if its two arguments i and j are equal, and zero otherwise. This is the Kronecker delta function. Another function of interest is:

sn(x) = if(x == 0, 1, sin(x) / x)

The value of the expression sin(x)/x approaches 1 as x approaches 0, but division by zero is not allowed. Therefore, the function checks for this case and immediately returns 1 if x is zero. Otherwise, it calculates sin(x)/x. (The double equals sign is a test for equality.)

Notice the two items pi and last. The value of the constant pi can not be changed. The value of last is the value of the last expression evaluated. These two values are not saved to the file of variables, constants and functions. If you wish, you can edit this file with Notepad, or even delete it entirely.

Our Software Stores

IconicoAccurate Design and Development Software

BitsDuJourDiscount Deal Coupons for Windows and Mac Software Apps

Our Software Services

SoftwareMarketingResourceYou Wrote the Code, Now How do you Sell it?

IcoBlogOur Official Blog

© copyright 2004-2017 Iconico, Inc. Code & Design. All Rights Reserved. Terms & Conditions Privacy Policy Terms of Use