Graphmatica allows you to define your own custom functions and named constants, which you can then reference in any equation. You may want to do so to add functions derived from those built-in to the program to its library, or to make entering equations with several instances of a common subexpression faster and more accurate.

Use the Functions item in the Tools menu to bring up the Functions dialog box, which lists all of the custom functions you have defined and allows you to define or delete functions.

Entering Functions or Constants

Enter your custom function or constant in one of the following formats:

function variable=expression

The function or constant name may be f, g, a single Greek letter (except lowercase π or θ or uppercase Σ or Γ), or a multi-letter word up to 20 characters. Valid function names start with a letter (Latin or Greek) and are followed by letters, numbers, subscripts, or underscore ("_"). You may not use a name which is already assigned to a built-in function or variable. (See the Operator Table for a complete list of these.) Use the Special Characters tool window (select Special Characters in the Edit menupress the αβγ… button) to help you enter characters that don't appear on your keyboard.

Note that Latin letters used in function and constant names are not case sensitive--upper and lowercase letters may be used interchangeably in the function name when it is defined and when you reference it in your equations. However, Greek letters are case sensitive, to accommodate the customary practice of assigning unrelated meanings to upper- and lowercase Greek letters in different contexts.

The variable name in your function definition must be either x or t. Regardless of which variable you pick, you may use the function in any equation; the value you pass to the function when you use it does not need to use the same variable.

Your function definition may be any expression that uses only the variable you specify and any constants or free variables (a, b, c, j, k) you need. You may also use any built-in function, or a custom function or constant you have previously defined in your graph document or function library.

For example, some useful functions and constants you could define include:

Logarithm base 2log₂(t)=log(t)/log(2)
Hyperbolic secantsech(x)=1/cosh(x)
Speed of light in a vacuumc₀=299792458
Conversion from miles to kilometerskm_per_mi=1.60934

Removing Functions

To remove a function that is no longer needed, select a function in the top listbox and use the Delete button. Note that when a function is referenced by other functions, you must delete each of those (or modify them to no longer reference the function you are trying to delete) first. If the function is still referenced by one or more equations, the program will offer to delete the equations as well or allow you to cancel the operation.

Redefining Functions

If you want to replace the definition of a function, simply type in the new definition and press Define as usual. The program will ask you for confirmation if you attempt to redefine a function that already exists. Any graphs that depend on the redefined function will be redrawn once you close the dialog box.

Function Library

Graphmatica supports two levels of custom functions: those defined in the current graph document only, and the Function Library, which is available to any graph document created on your machine.

To move functions from your current graph document into the Function Library, select a function in the top listbox and use the Add button. Note that you cannot add a function that depends on other functions defined at the document level to the Function Library; you must move those functions into the Function Library first. Also, you will be prompted for confirmation if a function of the same name already exists in the library. (This can happen when you open a graph document which redefines one of the functions in the library.)

To remove a function from the library (it will remain defined in the current document), select a function in the bottom listbox and use the Remove button. Note that when other functions in the Function Library depend on a function, you may not move it out of the Function Library until they have been removed as well.

When you save settings (either by the Save Setup Info command or exiting the program), the contents of the Function Library are saved in your graphmat.ini file, where they are available to any new graph documents you create.

Sharing Functions

When you save a graph document, all of the functions and constants defined in that document, as well as any functions in the Function Library that are referenced by the current document's functions or equations, are saved along with the document. This means that you can freely share graph documents that reference functions in your personal library without worrying about whether the recipient of the .gr file also has the same definition for that function.

If you want to share your complete Function Library with another machine, you can either cut and past the [functions] section of your graphmat.ini file, or create a graph document that uses each of the functions in an equation, open that file on the other machine, and move each of the functions into the Function Library there using the Add button in the Functions dialog box.

Help contents

Back to kSoft homepage...

kSoft, Inc. Last updated: Sun 11 Jun 2017