CFTool allows you to define your own custom fitting functions using standard mathematical operators and function names.
Custom functions are entered as plain text expressions and can include any number of fitting coefficients.
Basic syntax rules
-
Always include explicit arithmetic operators — write
a*x, notax. -
Functions must use parentheses, for example:
exp(), sin(), arcsin(), sinh(), arcsinh(), log(), ln(), sinc(), abs() -
As of CFTool Version 7:
-
log10()→ logarithm base 10 -
log()orln()→ natural logarithm (base e)
-
Note: In earlier versions,
log()was base 10 andln()the natural logarithm.
This change ensures consistency with the new spreadsheet functions introduced in Version 7.
Powers and roots
Use the caret symbol (^) for powers:
Square roots can be written as sqrt(x), but other roots should use fractional powers — for example:
Negative signs and constants
Negatives can be written in the usual form:
The constant π is recognised automatically and can be entered as:
which CFTool interprets as 3.14159 …
Coefficients and variables
-
Any standalone letter or group of letters/numbers such as
a,b,c2,k1etc. is treated as a fitting coefficient. -
The letter x is reserved as the independent variable and should not be used as a coefficient name.
-
Coefficients may appear more than once in the same expression — CFTool will recognise and link them automatically.
Example
Expression:
Detected coefficients: a, b, c, d, e
When you apply this function, CFTool automatically lists these coefficients in the Fitting Coefficients window, ready for initial value entry or constraint setup.
Checking your function
After entering a custom function and clicking Apply, the Fit Options window will appear.
Check that all the coefficients you expected are listed.
-
If any are missing, there is likely to be a syntax issue or an unrecognised function in your expression.
-
Review your function carefully for missing operators, parentheses, or typing errors.
Tips for writing reliable functions
Good practice
Always include parentheses to make operator precedence clear.
Keep the expression compact but readable — avoid excessive nesting.
Start with a simple form and test before adding extra terms.
If CFTool reports an unrecognised symbol, check spelling and ensure every coefficient is separated by an operator.
Remember that trigonometric and exponential functions expect radians and natural exponentials (base e).
Built-in function reference
| Category | Functions | Notes |
|---|---|---|
| Arithmetic / algebraic | abs(x), sqrt(x), pow(x,y) |
Basic numeric operations |
| Exponential / logarithmic | exp(x), log(x), ln(x), log10(x) |
log and ln are natural logs; log10 is base 10 |
| Trigonometric | sin(x), cos(x), tan(x) |
Input in radians |
| Inverse trigonometric | arcsin(x), arccos(x), arctan(x) |
Range –π/2 to π/2 for arctan |
| Hyperbolic | sinh(x), cosh(x), tanh(x) |
Standard definitions |
| Inverse hyperbolic | arcsinh(x), arccosh(x), arctanh(x) |
Real domain limits apply |
| Special | sinc(x) |
Normalised sinc = sin(πx)/(πx) |
| Constants | pi, |
π = 3.14159… |
Tip: If a function is not recognised, CFTool will warn you when you click Apply Custom Function — check for spelling or missing parentheses.