math-suite/Source/Help/documentation/apps/graphing/language.htm

207 lines
7.8 KiB
HTML
Raw Normal View History

2018-02-05 23:24:46 +00:00
<!-- saved from url=(0014)about:internet -->
<html>
<meta http-equiv="X-UA-Compatible" content="IE=9" />
<head>
<title>Graphing Calculator: The expression language</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
h3 {
margin-top:18px;
margin-bottom: 5px;
}
th {
text-align: left;
font-size: 9pt;
}
th#main {
width: 100%;
padding-left: 10px;
}
td {
font-size: 10pt;
padding-left: 10px;
}
</style>
</head>
<body>
<h1>Graphing Calculator: The expression language</h1>
<div class="section">
<h2>Content</h2>
<ul>
<li><a href="#intro">Introduction</a></li>
<li><a href="#vars">Variables</a></li>
<li><a href="#pvars">Predefined variables</a></li>
<li><a href="#ops">Accepted operators</a></li>
<li><a href="#func">Functions</a></li>
<li><a href="#pfunc">Predefined functions</a></li>
<li><a href="#syntax">Syntax rules</a></li>
</ul>
</div>
<div class="section">
<a name="intro"></a>
<h2>Introduction</h2>
<p>The <strong>Graphing Calculator</strong> evaluates expressions based on a strict set of rules, which form a language. Since the mathematical language is way too complex, and is impossible to write in simple text, this application (and many others) uses a simplified language.</p>
<p>If you are familiar with programming in a C-like language (C, C++, C#, Java), the language used here is very similar to these programming languages.</p>
</div>
<div class="section">
<a name="vars"></a>
<h2>Variables</h2>
<p>A variable is a symbol which may assume any given value. In this application, this symbol is represented by a character string which follows the following rules:</p>
<ul>
<li>It always begins with a letter.</li>
<li>It can only contain letters and numbers, so it cannot contain spaces, underscores and other symbols.</li>
<li>Variables are case sensitive. This means that <span style="font-family:Consolas, mono;">alpha</span> is not the same thing as <span style="font-family:Consolas, mono;">Alpha</span>.
</ul>
<p>The advantages of using variables are that you can skip having to type an ugly expression multiple times, and you can reevaluate the expression with a different input easily.</p>
<p>Variables are supported in the <em>Graphing Calculator</em>, with the limitation that they can only be used in the expression evaluator. Using variables in the plotting of graphs, and integrator is not possible. By default, the only used variable is <em>x</em> when plotting and integrating expressions.</p>
</div>
<div class="section">
<a name="pvars"></a>
<h2>Predefined variables</h2>
<p>The evaluator has two predefined variables:</p>
<ul>
<li><strong>pi</strong> (&pi;)</li>
<li><strong>e</strong></li>
</ul>
</div>
<div class="section">
<a name="ops"></a>
<h2>Accepted operators</h2>
<p>The following operators are accepted:</p>
<ul>
<li><strong>+</strong> (addition)</li>
<li><strong>-</strong> (subtraction)</li>
<li><strong>*</strong> (multiplication)</li>
<li><strong>/</strong> (division)</li>
<li><strong>%</strong> (division remainder)</li>
<li><strong>^</strong> (power)</li>
</ul>
<p>The order of operations is also respected. A higher order means a higher priority. Operations with the same order are evaluated left to right, with the exception of the power operator.</p>
<ul>
<li><strong>Order 1:</strong> + -</li>
<li><strong>Order 2:</strong> * / %</li>
<li><strong>Order 3:</strong> ^</li>
</ul>
</div>
<div class="section">
<a name="func"></a>
<h2>Functions</h2>
<p>The <em>Graphing Calculator</em> supports only predefined functions at the moment.</p>
</div>
<div class="section">
<a name="pfunc"></a>
<h2>Predefined functions</h2>
<p>The following functions can be used:</p>
<h3>Roots</h3>
<table>
<tr><td><strong>sqrt(x)</strong></td><td>Square root</td>
<tr><td><strong>cbrt(x)</strong></td><td>Cube root</td>
<tr><td><strong>root(n, x)</strong></td><td>Nth root</td>
</table>
<h3>Logarithms</h3>
<table>
<tr><td><strong>lg(x)</strong></td><td>Decimal logarithm</td>
<tr><td><strong>ln(x)</strong></td><td>Natural logarithm</td>
<tr><td><strong>log(b, x)</strong></td><td>Logarithm of x with base b</td>
</table>
<h3>Trigonometric functions:</h3>
<table>
<tr><td><strong>sin(x)</strong></td><td>Sine</td>
<tr><td><strong>sinh(x)</strong></td><td>Hyperbolic sine</td>
<tr><td><strong>cos(x)</strong></td><td>Cosine</td>
<tr><td><strong>cosh(x)</strong></td><td>Hyperbolic cosine</td>
<tr><td><strong>tan(x)</strong></td><td>Tangent</td>
<tr><td><strong>tanh(x)</strong></td><td>Hyperbolic tangent</td>
<tr><td><strong>ctan(x)</strong></td><td>Cotangent</td>
</table>
<h3>Inverse trigonometric functions: </h3>
<table>
<tr><td><strong>arcsin(x)</strong> or <strong>asin(x)</strong></td><td>Inverse sine</td>
<tr><td><strong>arccos(x)</strong> or <strong>acos(x)</strong></td><td>Inverse cosine</td>
<tr><td><strong>arctan(x)</strong> or <strong>atan(x)</strong></td><td>Inverse tangent</td>
</table>
<h3>Other functions:</h3>
<table>
<tr><td><strong>ceil(x)</strong> or <strong>ceiling(x)</strong></td><td>Ceiling, or the smallest integer number, greater than x.</td>
<tr><td><strong>floor(x)</strong></td><td>Floor, or the greatest integer number, smaller than x.</td>
<tr><td><strong>int(x)</strong></td><td>Integer part of the number.</td>
<tr><td><strong>truncate(x)</strong></td><td>Truncates (removes) the fractional part from the number.</td>
<tr><td><strong>round(x, n)</strong></td><td>Rounds the number to n decimals.</td>
<tr><td>&nbsp;</td></tr>
<tr><td><strong>abs(x)</strong></td><td>Absolute</td>
<tr><td><strong>max(x, y)</strong></td><td>Maximum</td>
<tr><td><strong>min(x, y)</strong></td><td>Minimum</td>
</table>
</div>
<div class="section">
<a name="syntax"></a>
<h2>Syntax rules</h2>
<p>The syntax of this application is more strict than the mathematic language. These are some of the rules:</p>
<h3>Numbers: </h3>
<ul>
<li>Numbers in scientific format are not accepted.</li>
<li>Digit grouping is not accepted.</li>
<li>The integer and fractional parts of the number must be separated by full stop (.) and <strong>not</strong> comma.</li>
</ul>
<h3>Functions:</h3>
<ul>
<li>The parameter(s) of any functions <strong>must</strong> be enclosed in parentheses. Expressions like <span style="font-family:Consolas, mono;">sin x</span> will fail to evaluate.</li>
<li>For functions with multiple parameters, the parameters are separated by comma.</li>
<li>The names of functions and variables are case sensitive.</li>
</ul>
<h3>Operators: </h3>
<ul>
<li>Operators of same precedence (order) are evaluated from left to right, with the exception of the power (^) operator which is evaluated from right to left. Otherwise, precedence rules (order of operations) is respected.</li>
<li>Expressions like <span style="font-family:Consolas, mono;">3x</span> are not accepted, you must specify the multiplication operator: <span style="font-family:Consolas, mono;">3*x</span></li>
</ul>
<h3>Others: </h3>
<ul>
<li>Writing expressions as functions is currently not supported, so the expression <span style="font-family:Consolas, mono;">f(x)=2*x</span> will fail to evaluate. Writing it as <span style="font-family:Consolas, mono;">y=2*x</span> will not work either.</li>
</ul>
</div>
<div class="footer">
Software created by Chibici Tiberiu.
Contact: <a href="mailto:chibicitiberiu@gmail.com">chibicitiberiu@gmail.com</a>
</div>
</body>
</html>