Difference between revisions of "FUNCTION"

From iMath
Jump to: navigation, search
(Created page with "{{Keyword | <code>FUNCTION { hints, symbol, symbol|exlist }</code> | Declare a user-defined function. The second parameter is the name of the function. The th...")
 
Line 7: Line 7:
 
The way that iMath treats this function can be influenced by function hints:  
 
The way that iMath treats this function can be influenced by function hints:  
 
* none: No function hints. Must be used because iMath requires three arguments to the <code>FUNCTION</code> declaration.
 
* none: No function hints. Must be used because iMath requires three arguments to the <code>FUNCTION</code> declaration.
* lib: A library function. It will not be affected by <code>[[CLEAREQUATIONS]]</code>.
+
* lib: A [[library function]]. It will not be affected by <code>[[CLEAREQUATIONS]]</code>.
 
* trig: For trigonometric functions. Tells iMath that this function will get special treatment when printing (e.g. sin²''x'' instead of (sin''x'')²) .
 
* trig: For trigonometric functions. Tells iMath that this function will get special treatment when printing (e.g. sin²''x'' instead of (sin''x'')²) .
 
* expand: The function is to be expanded immediately. Useful for functions that are abbreviations, e.g. <code>square(x)</code> will be expanded to <code>x^2</code> whenever it is used.
 
* expand: The function is to be expanded immediately. Useful for functions that are abbreviations, e.g. <code>square(x)</code> will be expanded to <code>x^2</code> whenever it is used.

Revision as of 16:21, 26 March 2017

Syntax

FUNCTION { hints, symbol, symbol|exlist }


Implemented in iMath since version 2.2.0 or earlier.

Explanation

Declare a user-defined function. The second parameter is the name of the function. The the third parameter declares the arguments of the function and can be either a single symbol or a list of symbols.

The way that iMath treats this function can be influenced by function hints:

  • none: No function hints. Must be used because iMath requires three arguments to the FUNCTION declaration.
  • lib: A library function. It will not be affected by CLEAREQUATIONS.
  • trig: For trigonometric functions. Tells iMath that this function will get special treatment when printing (e.g. sin²x instead of (sinx)²) .
  • expand: The function is to be expanded immediately. Useful for functions that are abbreviations, e.g. square(x) will be expanded to x^2 whenever it is used.
  • nobracket: The function does not require brackets around the argument (e.g. sqrt(x) is printed as <math>root x</math>).
  • defdiff: Differentiate the definition of the function, not the function itself (e.g. sin(x) will be differentiated to cos(x) and not to (sin(x))'.


Example

FUNCTION {none, f, x} declares the function f with one argument.


See also

{{{4}}}