Difference between revisions of "Math/functions"

From Wiki
Jump to navigation Jump to search
(explanation of math functions)
 
m (Switched to command template)
 
Line 5: Line 5:
 
{|
 
{|
 
|-
 
|-
|<cmd>arccos</cmd>
+
|{{cmd|arccos}}
|<cmd>arcsin</cmd>
+
|{{cmd|arcsin}}
|<cmd>arctan</cmd>
+
|{{cmd|arctan}}
|<cmd>arg  </cmd>
+
|{{cmd|arg  }}
|<cmd>cosh  </cmd>
+
|{{cmd|cosh  }}
|<cmd>cos  </cmd>
+
|{{cmd|cos  }}
|<cmd>coth  </cmd>
+
|{{cmd|coth  }}
|<cmd>cot  </cmd>
+
|{{cmd|cot  }}
|<cmd>csc  </cmd>
+
|{{cmd|csc  }}
|<cmd>deg  </cmd>
+
|{{cmd|deg  }}
 
|-
 
|-
|<cmd>det  </cmd>
+
|{{cmd|det  }}
|<cmd>dim  </cmd>
+
|{{cmd|dim  }}
|<cmd>exp  </cmd>
+
|{{cmd|exp  }}
|<cmd>gcd  </cmd>
+
|{{cmd|gcd  }}
|<cmd>hom  </cmd>
+
|{{cmd|hom  }}
|<cmd>inf  </cmd>
+
|{{cmd|inf  }}
|<cmd>injlim</cmd>
+
|{{cmd|injlim}}
|<cmd>ker  </cmd>
+
|{{cmd|ker  }}
|<cmd>lg    </cmd>
+
|{{cmd|lg    }}
|<cmd>liminf</cmd>
+
|{{cmd|liminf}}
 
|-
 
|-
|<cmd>limsup</cmd>
+
|{{cmd|limsup}}
|<cmd>lim  </cmd>
+
|{{cmd|lim  }}
|<cmd>ln    </cmd>
+
|{{cmd|ln    }}
|<cmd>log  </cmd>
+
|{{cmd|log  }}
|<cmd>median</cmd>
+
|{{cmd|median}}
|<cmd>max  </cmd>
+
|{{cmd|max  }}
|<cmd>min  </cmd>
+
|{{cmd|min  }}
|<cmd>mod  </cmd>
+
|{{cmd|mod  }}
|<cmd>div  </cmd>
+
|{{cmd|div  }}
|<cmd>projlim</cmd>
+
|{{cmd|projlim}}
 
|-
 
|-
|<cmd>Pr    </cmd>
+
|{{cmd|Pr    }}
|<cmd>sec  </cmd>
+
|{{cmd|sec  }}
|<cmd>sinh  </cmd>
+
|{{cmd|sinh  }}
|<cmd>sin  </cmd>
+
|{{cmd|sin  }}
|<cmd>sup  </cmd>
+
|{{cmd|sup  }}
|<cmd>tanh  </cmd>
+
|{{cmd|tanh  }}
|<cmd>tan  </cmd>
+
|{{cmd|tan  }}
 
|}
 
|}
  
Line 50: Line 50:
 
== Defining new functions ==
 
== Defining new functions ==
  
ConTeXt provides the command <cmd>definemathcommand</cmd> to define new ''log like'' functions. For example, if you want to define a '''lcd''' function, you can do
+
ConTeXt provides the command {{cmd|definemathcommand}} to define new ''log like'' functions. For example, if you want to define a '''lcd''' function, you can do
  
 
<texcode>
 
<texcode>
Line 56: Line 56:
 
</texcode>
 
</texcode>
  
The <code>nolop</code> option tells ConTeXt that subscripts should be placed on the side of the command (as in trignometric functions) rather than underneath the command (as in min, max, and limits). If you want to place the subscript underneath the command, you can use <code>limop</code> instead. The <cmd>mfunction</cmd> command sets its argument in the current math roman font. So,
+
The <code>nolop</code> option tells ConTeXt that subscripts should be placed on the side of the command (as in trignometric functions) rather than underneath the command (as in min, max, and limits). If you want to place the subscript underneath the command, you can use <code>limop</code> instead. The {{cmd|mfunction}} command sets its argument in the current math roman font. So,
  
 
<texcode>
 
<texcode>

Latest revision as of 16:05, 13 February 2020

<Math |

In writing mathematics, the names of variables are in italics, but some common functions like trignomeric functions, min, max, log, etc. are always written in upright roman font. The following log like functions are defined in ConTeXt.

\arccos \arcsin \arctan \arg \cosh \cos \coth \cot \csc \deg
\det \dim \exp \gcd \hom \inf \injlim \ker \lg \liminf
\limsup \lim \ln \log \median \max \min \mod \div \projlim
\Pr \sec \sinh \sin \sup \tanh \tan


Defining new functions

ConTeXt provides the command \definemathcommand to define new log like functions. For example, if you want to define a lcd function, you can do

\definemathcommand [lcd] [nolop] {\mfunction{lcd}}

The nolop option tells ConTeXt that subscripts should be placed on the side of the command (as in trignometric functions) rather than underneath the command (as in min, max, and limits). If you want to place the subscript underneath the command, you can use limop instead. The \mfunction command sets its argument in the current math roman font. So,

\definemathcommand [lcd] [nolop] {\mfunction{lcd}}

expands to

\def\lcd{\mathop{\mfunction{lcd}\nolimits}}}

while

\definemathcommand [argmin] [limop] {\mfunction{arg\,min}}

expands to

\def\argmin{\mathop{\mfunction{arg\,min}}} %Notice no \limits or \nolimits