| 1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 5 |
|
| 6 |
<title>Mathomatic Command Reference</title> |
| 7 |
|
| 8 |
<meta name="description" content="The Command Reference Manual for the Mathomatic computer algebra system."> |
| 9 |
<meta name="author" content="George Gesslein II"> |
| 10 |
<meta name="distribution" content="global"> |
| 11 |
<meta name="rating" content="general"> |
| 12 |
<meta name="copyright" content="© 1987-2012 George Gesslein II"> |
| 13 |
|
| 14 |
<link rel="author" href="http://www.google.com/profiles/georgegesslein"> |
| 15 |
<link rel="license" href="http://www.gnu.org/licenses/fdl-1.3.html"> |
| 16 |
<link rel="home" href="http://www.mathomatic.org"> |
| 17 |
<link rel="contents" href="index.html"> |
| 18 |
<link rel="index" href="index.html"> |
| 19 |
<link rel="previous" href="manual.html"> |
| 20 |
<link rel="next" href="mathomatic.1.html"> |
| 21 |
<link rel="start" title="The first page of the Mathomatic User Guide" type="text/html" href="index.html"> |
| 22 |
|
| 23 |
<link rel="shortcut icon" href="/favicon.ico"> |
| 24 |
|
| 25 |
<link rel="stylesheet" type="text/css" href="doc.css"> |
| 26 |
</head> |
| 27 |
|
| 28 |
<body> |
| 29 |
<center> |
| 30 |
<h1>Mathomatic Command Reference</h1> |
| 31 |
<img src="greenfade.png" alt="decoration line"> |
| 32 |
</center> |
| 33 |
|
| 34 |
<h3>Topics</h3> |
| 35 |
|
| 36 |
<ol> |
| 37 |
<li> |
| 38 |
<a href="#introduction">Introduction</a> |
| 39 |
<li> |
| 40 |
<a href="#entering">Entering Commands</a> |
| 41 |
<li> |
| 42 |
<a href="#selecting">Selecting Expressions</a> |
| 43 |
<li> |
| 44 |
<a href="#solving">Solving Equations</a> |
| 45 |
<li> |
| 46 |
<a href="#license">Documentation License</a> |
| 47 |
</ol> |
| 48 |
|
| 49 |
<h3>Commands</h3> |
| 50 |
|
| 51 |
<blockquote> |
| 52 |
<table summary="list of all commands" cellpadding=10> |
| 53 |
<tr valign="top"> |
| 54 |
<td> |
| 55 |
<a href="#approximate">Approximate</a> |
| 56 |
<br> |
| 57 |
<a href="#calculate">Calculate</a> |
| 58 |
<br> |
| 59 |
<a href="#clear">Clear</a> |
| 60 |
<br> |
| 61 |
<a href="#code">Code</a> |
| 62 |
<br> |
| 63 |
<a href="#compare">Compare</a> |
| 64 |
<br> |
| 65 |
<a href="#copy">Copy</a> |
| 66 |
<br> |
| 67 |
<a href="#derivative">Derivative</a> |
| 68 |
<br> |
| 69 |
<a href="#display">Display</a> |
| 70 |
</td> |
| 71 |
<td> |
| 72 |
<a href="#divide">Divide</a> |
| 73 |
<br> |
| 74 |
<a href="#echo">Echo</a> |
| 75 |
<br> |
| 76 |
<a href="#edit">Edit</a> |
| 77 |
<br> |
| 78 |
<a href="#eliminate">Eliminate</a> |
| 79 |
<br> |
| 80 |
<a href="#extrema">Extrema</a> |
| 81 |
<br> |
| 82 |
<a href="#factor">Factor</a> |
| 83 |
<br> |
| 84 |
<a href="#for">For</a> |
| 85 |
<br> |
| 86 |
<a href="#fraction">Fraction</a> |
| 87 |
</td> |
| 88 |
<td> |
| 89 |
<a href="#help">Help</a> |
| 90 |
<br> |
| 91 |
<a href="#imaginary">Imaginary</a> |
| 92 |
<br> |
| 93 |
<a href="#integrate">Integrate</a> |
| 94 |
<br> |
| 95 |
<a href="#laplace">Laplace</a> |
| 96 |
<br> |
| 97 |
<a href="#limit">Limit</a> |
| 98 |
<br> |
| 99 |
<a href="#list">List</a> |
| 100 |
<br> |
| 101 |
<a href="#nintegrate">NIntegrate</a> |
| 102 |
<br> |
| 103 |
<a href="#optimize">Optimize</a> |
| 104 |
</td> |
| 105 |
<td> |
| 106 |
<a href="#pause">Pause</a> |
| 107 |
<br> |
| 108 |
<a href="#plot">Plot</a> |
| 109 |
<br> |
| 110 |
<a href="#product">Product</a> |
| 111 |
<br> |
| 112 |
<a href="#push">Push</a> |
| 113 |
<br> |
| 114 |
<a href="#quit">Quit</a> |
| 115 |
<br> |
| 116 |
<a href="#read">Read</a> |
| 117 |
<br> |
| 118 |
<a href="#real">Real</a> |
| 119 |
<br> |
| 120 |
<a href="#repeat">Repeat</a> |
| 121 |
</td> |
| 122 |
<td> |
| 123 |
<a href="#replace">Replace</a> |
| 124 |
<br> |
| 125 |
<a href="#roots">Roots</a> |
| 126 |
<br> |
| 127 |
<a href="#save">Save</a> |
| 128 |
<br> |
| 129 |
<a href="#set">Set</a> |
| 130 |
<br> |
| 131 |
<a href="#simplify">Simplify</a> |
| 132 |
<br> |
| 133 |
<a href="#solve">Solve</a> |
| 134 |
<br> |
| 135 |
<a href="#sum">Sum</a> |
| 136 |
<br> |
| 137 |
<a href="#tally">Tally</a> |
| 138 |
</td> |
| 139 |
<td> |
| 140 |
<a href="#taylor">Taylor</a> |
| 141 |
<br> |
| 142 |
<a href="#unfactor">Unfactor</a> |
| 143 |
<br> |
| 144 |
<a href="#variables">Variables</a> |
| 145 |
<br> |
| 146 |
<a href="#version">Version</a> |
| 147 |
</td> |
| 148 |
</tr> |
| 149 |
</table> |
| 150 |
</blockquote> |
| 151 |
|
| 152 |
<p> |
| 153 |
<a href="manual.html">Mathomatic User Guide</a> |
| 154 |
|
| 155 |
<br> |
| 156 |
<br> |
| 157 |
<hr> |
| 158 |
<a name="introduction"></a> |
| 159 |
<h2>Introduction</h2> |
| 160 |
<p> |
| 161 |
<b>LHS</b> is shorthand for the Left-Hand Side of an equation. |
| 162 |
Similarly, <b>RHS</b> used here always means the Right-Hand Side. |
| 163 |
<p> |
| 164 |
In this document, text enclosed by straight brackets <b>[like this]</b> means |
| 165 |
it is optional and may be omitted. |
| 166 |
The word "expression" (without double quotes) |
| 167 |
always means a mathematical expression or formula. |
| 168 |
<p> |
| 169 |
At the Mathomatic main prompt, you may enter: |
| 170 |
|
| 171 |
<ul> |
| 172 |
<li> |
| 173 |
A numerical expression, which is stored, then instantly approximated, evaluated, and displayed with the |
| 174 |
<a href="#calculate">calculate command</a>; this is the <a href="#set">autocalc</a> option. |
| 175 |
To skip running the calculate command on the numerical input, just set it equal to any normal variable. |
| 176 |
<li> |
| 177 |
A new <a href="manual.html#equations">algebraic expression or equation</a>, |
| 178 |
which is stored and made the current equation. |
| 179 |
<li> |
| 180 |
A new expression followed by an equals sign, to set the current non-equation equal to, |
| 181 |
making it an equation, |
| 182 |
or to store the new expression as an equation set equal to zero. |
| 183 |
<li> |
| 184 |
A variable to automatically <a href="#solving">solve</a> the current equation for (<a href="#set">autosolve</a>). |
| 185 |
<li> |
| 186 |
An operator (not factorial) followed by an equals sign (<b>=</b>) and an expression, |
| 187 |
which is applied to both sides of the current equation or to the current non-equation. |
| 188 |
<li> |
| 189 |
An equation number to <a href="#selecting">select</a> as the current equation (<a href="#set">autoselect</a>). |
| 190 |
<li> |
| 191 |
A slash (<b>/</b>) or pound sign (<b>#</b>) followed by a variable name |
| 192 |
to search all equations spaces forward or backward for, respectively. |
| 193 |
<li> |
| 194 |
A Mathomatic command (listed in this document). |
| 195 |
<li> |
| 196 |
A question mark (<b>?</b>) followed by a topic, for quick, short help (same as the <a href="#help">help command</a>). |
| 197 |
<li> |
| 198 |
A semicolon (<b>;</b>) followed by a line comment; |
| 199 |
everything on a line after a semicolon is ignored. |
| 200 |
A semicolon that does not start a line comment |
| 201 |
may be entered by preceding it with a backslash (<b>\</b>). |
| 202 |
<li> |
| 203 |
An exclamation point (<b>!</b>) followed by a shell or system command. |
| 204 |
"<b>!</b>" by itself invokes the default shell. |
| 205 |
"<b>!</b>" is also the factorial operator. |
| 206 |
</ul> |
| 207 |
|
| 208 |
<p> |
| 209 |
If a colon (<b>:</b>) starts the line, preceding any of the above input to the main prompt, |
| 210 |
it will always return with successful status, |
| 211 |
preventing any current <a href="#read">read command</a> operations from aborting. |
| 212 |
|
| 213 |
<br> |
| 214 |
<br> |
| 215 |
<hr> |
| 216 |
<a name="entering"></a> |
| 217 |
<h2>Entering Commands</h2> |
| 218 |
<p> |
| 219 |
Mathomatic has about <a href="quickrefcard.html">43 commands</a> that may be typed at the main prompt. |
| 220 |
Most commands operate on the current expression or equation by default. |
| 221 |
Commands are simple English words and are described below, in alphabetical order. |
| 222 |
If the command name is longer than 4 letters, you only need |
| 223 |
to type in the first 4 letters for Mathomatic to recognize the command. |
| 224 |
Option words and arguments for commands follow the command name and are separated by spaces. |
| 225 |
Commands are not executed until you press the Enter key, |
| 226 |
and any missing command-line arguments that don't have a default are prompted for. |
| 227 |
For example, the Mathomatic command |
| 228 |
|
| 229 |
<pre class="indent"> |
| 230 |
help calculate |
| 231 |
</pre> |
| 232 |
|
| 233 |
<p> |
| 234 |
gives short help and usage information for the calculate command. |
| 235 |
"help" is the command, "calculate" is the argument |
| 236 |
(which is also a command, in this case). |
| 237 |
<p> |
| 238 |
Many commands have an optional <b>equation number range</b> argument, |
| 239 |
which specifies the equation spaces that the command is to operate on. |
| 240 |
An <b>equation number range</b> may be a single equation number, |
| 241 |
or a range of equation numbers separated by a dash (like "2-7", |
| 242 |
which means every equation space between and including equations 2 and 7), |
| 243 |
or the word "all", which specifies all equation spaces. |
| 244 |
If omitted, or a dash ("-") by itself is entered, the current expression or equation is assumed. |
| 245 |
If pluralized as "<b>equation-number-ranges</b>" in the command syntax, that means |
| 246 |
multiple equation numbers and ranges may be specified for that command, |
| 247 |
separated by spaces. |
| 248 |
<p> |
| 249 |
A greater-than character (<b>></b>) may be appended to the end of any command-line, |
| 250 |
followed by a file name. This will redirect the output of the command to that file. |
| 251 |
If the file already exists, it will be overwritten without asking. |
| 252 |
Note that any debugging output will be redirected, too. |
| 253 |
Two greater-than characters (<b>>></b>) next to each other |
| 254 |
will <strong>append</strong> command output to a file, like the Unix shell does. |
| 255 |
For example, the Mathomatic command |
| 256 |
|
| 257 |
<pre class="indent"> |
| 258 |
list export all >filename |
| 259 |
</pre> |
| 260 |
|
| 261 |
<p> |
| 262 |
will output all stored expressions and equations to a file in exportable, |
| 263 |
single-line per equation format, |
| 264 |
so they can be read in by a different math program. |
| 265 |
"list" is the command, |
| 266 |
"export" is the option word, and "all" is the <b>equation number range</b>. |
| 267 |
<p> |
| 268 |
Command option words, such as "export" in the above list command-line, |
| 269 |
always come immediately after the command name and before anything else on the command-line. |
| 270 |
These words direct the command to do a different, but related, task. |
| 271 |
<p> |
| 272 |
If Mathomatic becomes unresponsive (a rare occurrence), |
| 273 |
pressing Control-C once will usually safely abort the current operation |
| 274 |
and return you to the main prompt. |
| 275 |
If not, pressing Control-C three times in a row will exit Mathomatic, |
| 276 |
with a warning displayed the second time. |
| 277 |
|
| 278 |
<br> |
| 279 |
<br> |
| 280 |
<hr> |
| 281 |
<a name="selecting"></a> |
| 282 |
<h2>Selecting Expressions</h2> |
| 283 |
<p> |
| 284 |
Syntax: <b>#["+" or "−"]equation-number [new-expression]</b> |
| 285 |
<p> |
| 286 |
To change the current equation at the main prompt and display it or replace it, |
| 287 |
type a pound sign (<b>#</b>) followed by the equation space number |
| 288 |
you wish to select, possibly followed by a new expression to replace it with. |
| 289 |
The <b>equation number</b> may be preceded by plus (<b>+</b>) or minus (<b>−</b>), |
| 290 |
to select an equation relative to the current equation, |
| 291 |
instead of an absolute equation number. |
| 292 |
This syntax also works when prompted for an expression, |
| 293 |
the RHS or the expression at that equation number is substituted |
| 294 |
every place <b>#equation-number</b> is entered. |
| 295 |
<p> |
| 296 |
Autoselect feature: Selecting an equation space to make it the |
| 297 |
current equation is now conveniently done by typing only |
| 298 |
the <b>equation number</b> at the main prompt. |
| 299 |
This is called the "<a href="#set">set</a> autoselect" option. |
| 300 |
|
| 301 |
<br> |
| 302 |
<br> |
| 303 |
<hr> |
| 304 |
<a name="solving"></a> |
| 305 |
<h2>Solving Equations</h2> |
| 306 |
<p> |
| 307 |
Syntax: <b>variable or "0"</b> |
| 308 |
<p> |
| 309 |
Mathomatic can solve symbolic equations for any <b>variable</b> or for <b>zero</b>. |
| 310 |
Solving is accomplished internally by applying identical |
| 311 |
mathematical operations to both sides of the equation and simplifying, |
| 312 |
or by plugging the general coefficients of the solve variable into the quadratic formula. |
| 313 |
The Mathomatic solve algorithm is the best possible for general algebra, |
| 314 |
however the result is not checked by plugging the solutions into the original equation |
| 315 |
unless the "<a href="#solve">solve</a> verify" command is used for solving. |
| 316 |
To require confirmed correctness of the solutions in this way, use the "solve verifiable" |
| 317 |
command. |
| 318 |
<p> |
| 319 |
To automatically solve the current equation for a variable, |
| 320 |
type the <b>variable</b> name at the main prompt. |
| 321 |
Mathomatic will proceed to manipulate the current equation |
| 322 |
until all of the solutions for the specified <b>variable</b> are determined. |
| 323 |
If successful, the current equation is replaced with the solutions and then displayed. |
| 324 |
<p> |
| 325 |
Automatic cubic (third degree), |
| 326 |
quintic (fifth degree), and higher degree polynomial equation solving is not supported. |
| 327 |
Some cubic and quartic polynomial equations can be manually solved with the general equations in files |
| 328 |
"<i>tests/cubic.in</i>" and "<i>tests/quartic.in</i>". |
| 329 |
Quartic (fourth degree) polynomial equations |
| 330 |
can be automatically solved if they are biquadratic; that is, |
| 331 |
containing only degree four, degree two, and degree zero terms of the solve variable. |
| 332 |
Biquadratic polynomial equations of any degree can be generally solved by Mathomatic |
| 333 |
because they can be plugged into the quadratic formula. |
| 334 |
<p> |
| 335 |
Note that running the <a href="#simplify">simplify command</a> is a good idea after solving. |
| 336 |
The solve routine only <a href="#unfactor">unfactors</a> the equation as needed to solve it |
| 337 |
and the result is not completely simplified. |
| 338 |
<p> |
| 339 |
To solve for zero, type in "0" at the main prompt. |
| 340 |
Zero solving is a special solve that will always be successful |
| 341 |
and will transform most divide operators into |
| 342 |
mathematically equivalent multiplications and subtractions, |
| 343 |
so that the result will more likely be a valid polynomial equation: |
| 344 |
|
| 345 |
<pre class="sample"> |
| 346 |
1—> a=b+1/b ; This is actually a quadratic equation. |
| 347 |
|
| 348 |
1 |
| 349 |
#1: a = b + - |
| 350 |
b |
| 351 |
|
| 352 |
1—> 0 ; Solve for the constant zero. |
| 353 |
|
| 354 |
#1: 0 = (b*(b - a)) + 1 |
| 355 |
|
| 356 |
1—> unfactor ; Expand, showing this is a quadratic polynomial equation in "b". |
| 357 |
|
| 358 |
#1: 0 = (b^2) - (b*a) + 1 |
| 359 |
|
| 360 |
1—> b ; Solve for variable "b". |
| 361 |
Equation was quadratic. |
| 362 |
|
| 363 |
1 |
| 364 |
(((((a^2) - 4)^-)*sign1) + a) |
| 365 |
2 |
| 366 |
#1: b = ----------------------------- |
| 367 |
2 |
| 368 |
|
| 369 |
1—> a ; Solve back for variable "a", to check the answer. |
| 370 |
Raising both sides to the power of 2 and unfactoring... |
| 371 |
|
| 372 |
((b^2) + 1) |
| 373 |
#1: a = ----------- |
| 374 |
b |
| 375 |
|
| 376 |
1—> simplify |
| 377 |
|
| 378 |
1 |
| 379 |
#1: a = b + - |
| 380 |
b |
| 381 |
|
| 382 |
1—> |
| 383 |
</pre> |
| 384 |
|
| 385 |
<p> |
| 386 |
You can prefix the solve <b>variable</b> name with "=" to solve and swap equation sides, |
| 387 |
putting the solve variable on the Right-Hand Side. |
| 388 |
Typing "=" by itself will only swap sides of the current equation and display. |
| 389 |
<p> |
| 390 |
If the current expression is a non-equation, then prefixing or suffixing an expression with "=" |
| 391 |
will add that expression as the other equation side, conveniently making it an equation you can solve: |
| 392 |
|
| 393 |
<pre class="sample"> |
| 394 |
1−> x^2+x ; Entering a simple quadratic polynomial non-equation. |
| 395 |
|
| 396 |
#1: x^2 + x |
| 397 |
|
| 398 |
1−> 0= ; Setting it equal to zero as an afterthought. |
| 399 |
Combining to make an equation out of the current non-equation. |
| 400 |
|
| 401 |
#1: 0 = x^2 + x |
| 402 |
|
| 403 |
1−> =0 ; Current equation is an equation now, so zero solve, flipping sides. |
| 404 |
Solve successful: |
| 405 |
|
| 406 |
#1: x·(x + 1) = 0 |
| 407 |
|
| 408 |
1−> 0= ; Solve for 0 again, flipping equation sides. Don't need "=" with autosolve. |
| 409 |
Solve successful: |
| 410 |
|
| 411 |
#1: 0 = x·(x + 1) |
| 412 |
|
| 413 |
1−> unfactor ; Expand to show nothing has changed. |
| 414 |
|
| 415 |
#1: 0 = x^2 + x |
| 416 |
|
| 417 |
1−> = ; Demonstrating "=" by itself. |
| 418 |
Swapping both sides of the current equation... |
| 419 |
|
| 420 |
#1: x^2 + x = 0 |
| 421 |
|
| 422 |
1−> x ; Solve for variable x. |
| 423 |
Equation is a degree 2 polynomial equation in x. |
| 424 |
Equation was solved with the quadratic formula. |
| 425 |
Solve successful: |
| 426 |
|
| 427 |
(sign − 1) |
| 428 |
#1: x = –––––––––– |
| 429 |
2 |
| 430 |
|
| 431 |
1−> calculate |
| 432 |
There are 2 solutions. |
| 433 |
|
| 434 |
Solution number 1 with sign = 1: |
| 435 |
x = 0 |
| 436 |
|
| 437 |
Solution number 2 with sign = -1: |
| 438 |
x = -1 |
| 439 |
1−> |
| 440 |
</pre> |
| 441 |
|
| 442 |
<p> |
| 443 |
A manual solve operation can be done too, for educational purposes. |
| 444 |
To apply an expression to both sides of an equation, just type the operator, |
| 445 |
followed by "=", then the expression to apply. For example: |
| 446 |
|
| 447 |
<pre class="sample"> |
| 448 |
1−> a=b/c ; We want to solve this simple equation manually for "c": |
| 449 |
|
| 450 |
b |
| 451 |
#1: a = – |
| 452 |
c |
| 453 |
|
| 454 |
1−> *=c ; Multiply both equation sides by "c". |
| 455 |
|
| 456 |
#1: a·c = b |
| 457 |
|
| 458 |
1−> /=a ; Divide both sides by "a", now manually solved for "c": |
| 459 |
|
| 460 |
b |
| 461 |
#1: c = – |
| 462 |
a |
| 463 |
|
| 464 |
1−> |
| 465 |
</pre> |
| 466 |
|
| 467 |
<p> |
| 468 |
The above syntax works for non-equations, too. |
| 469 |
|
| 470 |
<p> |
| 471 |
To see all of the steps performed during an automated solve operation, |
| 472 |
type "<a href="#set">set</a> debug 1" |
| 473 |
(or "set debug 2" for more details) before solving: |
| 474 |
|
| 475 |
<pre class="sample"> |
| 476 |
1−> x=(a+1)*(b+2) |
| 477 |
|
| 478 |
#1: x = (a + 1)·(b + 2) |
| 479 |
|
| 480 |
1−> set debug 1 |
| 481 |
Success. |
| 482 |
1−> b ; Solve for variable "b". |
| 483 |
level 1: x = (a + 1)*(b + 2) |
| 484 |
Subtracting "(a + 1)*(b + 2)" from both sides of the equation: |
| 485 |
level 1: x - ((a + 1)*(b + 2)) = 0 |
| 486 |
Subtracting "x" from both sides of the equation: |
| 487 |
level 1: -1*(a + 1)*(b + 2) = -1*x |
| 488 |
Dividing both sides of the equation by "-1": |
| 489 |
level 1: (a + 1)*(b + 2) = x |
| 490 |
Dividing both sides of the equation by "a + 1": |
| 491 |
level 1: b + 2 = x/(a + 1) |
| 492 |
Subtracting "2" from both sides of the equation: |
| 493 |
level 1: b = (x/(a + 1)) - 2 |
| 494 |
Solve completed: |
| 495 |
level 1: b = (x/(a + 1)) - 2 |
| 496 |
Solve successful: |
| 497 |
|
| 498 |
x |
| 499 |
#1: b = ––––––– − 2 |
| 500 |
(a + 1) |
| 501 |
|
| 502 |
1−> |
| 503 |
</pre> |
| 504 |
|
| 505 |
<br> |
| 506 |
<br> |
| 507 |
<hr> |
| 508 |
<a name="approximate"></a> |
| 509 |
<h2>Approximate command</h2> |
| 510 |
<p> |
| 511 |
Syntax: <b>approximate [equation-number-ranges]</b> |
| 512 |
<p> |
| 513 |
This command approximates all real and complex number constants in the current or specified equation spaces. |
| 514 |
It substitutes the special universal constants <b>pi</b> and <b>e</b> |
| 515 |
with their respective double precision floating point values, |
| 516 |
and approximates all real and imaginary constants, roots, and surds |
| 517 |
to be of double precision size. |
| 518 |
This allows them to combine with other double precision floating point constants |
| 519 |
through standard or complex number arithmetic |
| 520 |
and may help with simplification and comparisons. |
| 521 |
<p> |
| 522 |
The result may contain fractions, |
| 523 |
unless "<a href="#set">set</a> no fractions" was entered previously. |
| 524 |
<p> |
| 525 |
"repeat approximate" approximates and simplifies even more, as much as the calculate command does. |
| 526 |
|
| 527 |
<br> |
| 528 |
<br> |
| 529 |
<hr> |
| 530 |
<a name="calculate"></a> |
| 531 |
<h2>Calculate command</h2> |
| 532 |
<p> |
| 533 |
Syntax: <b>calculate ["factor"] [equation-number-range] [feedback-variable number-of-iterations]</b> |
| 534 |
<p> |
| 535 |
This is the formula calculator command that |
| 536 |
prompts for the value of each normal variable in the |
| 537 |
RHS of the current or specified equations or in the current or specified expressions, |
| 538 |
temporarily substituting any entered values, |
| 539 |
when not in test or demo mode. |
| 540 |
Test and demo modes allow for no user intervention. |
| 541 |
This calculate command approximates, simplifies, and substitutes all "sign" variables |
| 542 |
with all possible combinations of values (+1 and -1), |
| 543 |
approximating/simplifying again and displaying each solution as it does so. |
| 544 |
If all variables are supplied with constant values, then each solution will be a constant, |
| 545 |
otherwise the result will contain the variables you didn't enter values for. |
| 546 |
Nothing is modified by this command. |
| 547 |
<p> |
| 548 |
This command is used to temporarily plug in values |
| 549 |
and approximate/simplify expressions and expand "sign" variables. |
| 550 |
When an expression with only numbers is entered at the main prompt, |
| 551 |
this calculate command is automatically invoked on it (autocalc), |
| 552 |
displaying the calculated result. |
| 553 |
This occurs only when "<a href="#set">set</a> autocalc" is on, |
| 554 |
which it is by default. |
| 555 |
<p> |
| 556 |
If there are any simple numerical fractions in the result, |
| 557 |
those are displayed alongside any short result. |
| 558 |
<p> |
| 559 |
To only simplify and expand "sign" variables in stored expressions without approximating, |
| 560 |
use the "<a href="#simplify">simplify</a> sign" command instead. |
| 561 |
<p> |
| 562 |
If a <b>feedback variable</b> and <b>number of iterations</b> are specified on the |
| 563 |
calculate command-line, |
| 564 |
you will be prompted for the initial value of the feedback variable, |
| 565 |
and the calculation will be iterated, with the simplified result |
| 566 |
repeatedly plugged back into the feedback variable. |
| 567 |
This will be done until convergence (the output equals the input) |
| 568 |
or when the specified number of iterations have been performed (if non-zero), |
| 569 |
whichever comes first. |
| 570 |
To see all of the intermediate values, |
| 571 |
type "<a href="#set">set</a> debug 1" before this. |
| 572 |
<p> |
| 573 |
"calculate <b>factor</b>" factorizes all integers and variables before display. |
| 574 |
<p> |
| 575 |
Examples of using the calculate command: |
| 576 |
|
| 577 |
<pre class="sample"> |
| 578 |
1—> y=x^2+x |
| 579 |
|
| 580 |
#1: y = (x^2) + x |
| 581 |
|
| 582 |
1—> x ; solve for x |
| 583 |
Equation is a degree 2 polynomial in x. |
| 584 |
Equation was quadratic. |
| 585 |
|
| 586 |
1 |
| 587 |
-1·(1 + (((1 + (4·y))^—)·sign)) |
| 588 |
2 |
| 589 |
#1: x = ——————————————————————————————— |
| 590 |
2 |
| 591 |
|
| 592 |
1—> calculate |
| 593 |
Enter y: 0 |
| 594 |
There are 2 solutions. |
| 595 |
|
| 596 |
Solution number 1 with sign = 1: |
| 597 |
x = -1 |
| 598 |
|
| 599 |
Solution number 2 with sign = -1: |
| 600 |
x = 0 |
| 601 |
|
| 602 |
1—> |
| 603 |
</pre> |
| 604 |
|
| 605 |
<p> |
| 606 |
An example of iteration: |
| 607 |
|
| 608 |
<pre class="sample"> |
| 609 |
1—> x_new=(x_old+(y/x_old))/2 ; iterative formula for calculating the square root of y |
| 610 |
|
| 611 |
y |
| 612 |
(x_old + -----) |
| 613 |
x_old |
| 614 |
#2: x_new = --------------- |
| 615 |
2 |
| 616 |
|
| 617 |
2—> calculate x_old 1000 ; iterate up to 1000 times to calculate the square root of 100 |
| 618 |
Enter y: 100 |
| 619 |
Enter initial x_old: 1 |
| 620 |
Convergence reached after 9 iterations. |
| 621 |
|
| 622 |
x_new = 10 |
| 623 |
|
| 624 |
2—> |
| 625 |
</pre> |
| 626 |
|
| 627 |
<p> |
| 628 |
Note that the Mathomatic Symbolic Math Library does not support use of the calculate command at this time. |
| 629 |
|
| 630 |
<br> |
| 631 |
<br> |
| 632 |
<hr> |
| 633 |
<a name="clear"></a> |
| 634 |
<h2>Clear command</h2> |
| 635 |
<p> |
| 636 |
Syntax: <b>clear [equation-number-ranges]</b> |
| 637 |
<p> |
| 638 |
This command clears the specified equation spaces |
| 639 |
so that they are empty and can be reused. |
| 640 |
They are deleted from RAM only. |
| 641 |
<p> |
| 642 |
"clear all" quickly clears all equation spaces and restarts Mathomatic, |
| 643 |
resetting internal memory and deleting all expressions stored in RAM, |
| 644 |
without losing your settings. |
| 645 |
|
| 646 |
<br> |
| 647 |
<br> |
| 648 |
<hr> |
| 649 |
<a name="code"></a> |
| 650 |
<h2>Code command</h2> |
| 651 |
<p> |
| 652 |
Syntax: <b>code ["c" or "java" or "python" or "integer"] [equation-number-ranges]</b> |
| 653 |
<p> |
| 654 |
This command outputs the current or specified equations as floating point or integer |
| 655 |
assignment statements in C, Java, or Python programming language code. |
| 656 |
The default is C double precision floating point code. |
| 657 |
The output from this command should compile correctly |
| 658 |
and emulate the equation from Mathomatic, if no warnings are given. |
| 659 |
<p> |
| 660 |
With "code integer", integer arithmetic is assumed, |
| 661 |
otherwise double precision floating point arithmetic is assumed. |
| 662 |
"code integer" is more generic and should work with any language. |
| 663 |
<p> |
| 664 |
To represent factorials, the user supplied function <code>factorial()</code> is called, |
| 665 |
since there is no equivalent function or operator in these languages. |
| 666 |
<code>factorial()</code> functions for several languages are supplied in the |
| 667 |
directory <i>examples</i> in the Mathomatic source distribution. |
| 668 |
<p> |
| 669 |
For the most efficient code, use the <a href="#simplify">simplify</a> |
| 670 |
and <a href="#optimize">optimize</a> commands on your equations |
| 671 |
before running this code command. |
| 672 |
<p> |
| 673 |
The C and Java languages require that all variables be defined before use. |
| 674 |
The <a href="#variables">variables command</a> is provided for this. |
| 675 |
The output of the variables command should be put before the output of |
| 676 |
the code command when compiling. |
| 677 |
|
| 678 |
<br> |
| 679 |
<br> |
| 680 |
<hr> |
| 681 |
<a name="compare"></a> |
| 682 |
<h2>Compare command</h2> |
| 683 |
<p> |
| 684 |
Syntax: <b>compare ["symbolic"] ["approximate"] equation-number ["with" equation-number]</b> |
| 685 |
<p> |
| 686 |
This command compares two equation spaces to see if they are mathematically the same (equal). |
| 687 |
If only one <b>equation number</b> is supplied, the comparison is between |
| 688 |
the current equation and the specified equation. |
| 689 |
The comparison will be faster and more accurate if |
| 690 |
both equations are previously solved for the same variable. |
| 691 |
<p> |
| 692 |
The <a href="#simplify">simplify command</a> is automatically used on both expressions if needed. |
| 693 |
If this compare command says the equations or expressions are identical, |
| 694 |
then they are definitely identical. |
| 695 |
If this command says the equations or expressions differ, |
| 696 |
then they might be identical if |
| 697 |
they are too hard for Mathomatic to simplify completely. |
| 698 |
<p> |
| 699 |
The "symbolic" option uses the "<a href="#simplify">simplify</a> symbolic" option when simplifying. |
| 700 |
This option sometimes simplifies more, but is not 100% mathematically correct. |
| 701 |
<p> |
| 702 |
The "approximate" option runs the approximate command on both expressions or equations. |
| 703 |
This makes the compare command more likely to succeed. |
| 704 |
<p> |
| 705 |
"repeat compare" simplifies fully instead of just once, |
| 706 |
making the compare more likely to succeed too. |
| 707 |
<p> |
| 708 |
Another way of |
| 709 |
comparing expressions by simply setting them equal is a convenient way of checking validity too, with Mathomatic. |
| 710 |
Just solve for any variable to see if it is an identity, |
| 711 |
or typing "<a href="#solve">solve</a> verify 0" works too. |
| 712 |
If it is an identity, it will say so, |
| 713 |
meaning both equations sides are mathematically equivalent and identical. |
| 714 |
|
| 715 |
<br> |
| 716 |
<br> |
| 717 |
<hr> |
| 718 |
<a name="copy"></a> |
| 719 |
<h2>Copy command</h2> |
| 720 |
<p> |
| 721 |
Syntax: <b>copy ["select"] [equation-number-ranges]</b> |
| 722 |
<p> |
| 723 |
This command simply duplicates the current or specified equation spaces. |
| 724 |
The new, duplicated expressions are stored in the next available equation spaces |
| 725 |
and displayed, along with their new equation numbers. |
| 726 |
<p> |
| 727 |
If the "select" option is given, |
| 728 |
make the current equation the first expression created by this copy command, |
| 729 |
otherwise the current equation remains unchanged after this copy command. |
| 730 |
|
| 731 |
<br> |
| 732 |
<br> |
| 733 |
<hr> |
| 734 |
<a name="derivative"></a> |
| 735 |
<h2>Derivative command</h2> |
| 736 |
<p> |
| 737 |
Syntax: <b>derivative ["nosimplify"] variable or "all" [order]</b> |
| 738 |
<br> |
| 739 |
Alternate command name: <b>differentiate</b> |
| 740 |
<p> |
| 741 |
This command computes the exact symbolic derivative of a function |
| 742 |
with respect to the specified <b>variable</b>, |
| 743 |
using the current expression or RHS of the current equation as the function. |
| 744 |
It does this by recursively applying the proper rule of differentiation for each operator encountered. |
| 745 |
The result is "quick" simplified with the "<a href="#simplify">simplify</a> quick" command, |
| 746 |
unless the "nosimplify" option is specified. |
| 747 |
If successful, the derivative is placed in the next available equation space, displayed, |
| 748 |
and becomes the current equation. |
| 749 |
The original equation is not modified. |
| 750 |
<p> |
| 751 |
Specifying "all" computes the derivative of the current expression with respect to all normal |
| 752 |
variables. It is equivalent to adding together the derivatives with |
| 753 |
respect to each normal variable. |
| 754 |
<p> |
| 755 |
Specifying the <b>order</b> allows you to repeatedly differentiate and simplify. |
| 756 |
The default is to differentiate once (<b>order</b>=1). |
| 757 |
<p> |
| 758 |
If differentiation fails, it is probably because symbolic logarithms are required. |
| 759 |
Symbolic logarithms are not implemented in Mathomatic, yet. |
| 760 |
Also, the factorial, modulus, and integral divide operators |
| 761 |
cannot be differentiated if they contain the specified <b>variable</b>. |
| 762 |
Because this command handles almost everything, |
| 763 |
a numerical differentiation command is not needed. |
| 764 |
<p> |
| 765 |
Some examples: |
| 766 |
|
| 767 |
<pre class="sample"> |
| 768 |
1—> x^3+x^2+x+1 |
| 769 |
|
| 770 |
#1: (x^3) + (x^2) + x + 1 |
| 771 |
|
| 772 |
1—> derivative ; no need to specify the variable if there is only one |
| 773 |
Differentiating with respect to (x) and simplifying... |
| 774 |
|
| 775 |
#2: (3*(x^2)) + (2*x) + 1 |
| 776 |
|
| 777 |
2—> a*x^n |
| 778 |
|
| 779 |
#3: a*(x^n) ; show a general rule of differentiation |
| 780 |
|
| 781 |
3—> derivative x |
| 782 |
Differentiating with respect to (x) and simplifying... |
| 783 |
|
| 784 |
#4: a*n*(x^(n - 1)) |
| 785 |
|
| 786 |
4—> integrate x ; undo the differentiation |
| 787 |
|
| 788 |
#5: a*(x^n) |
| 789 |
|
| 790 |
5—> |
| 791 |
</pre> |
| 792 |
|
| 793 |
<br> |
| 794 |
<br> |
| 795 |
<hr> |
| 796 |
<a name="display"></a> |
| 797 |
<h2>Display command</h2> |
| 798 |
<p> |
| 799 |
Syntax: <b>display ["factor"] ["simple" or "mixed"] [equation-number-ranges]</b> |
| 800 |
<p> |
| 801 |
This command displays stored expressions in nice looking |
| 802 |
multi-line 2D (two-dimensional) fraction format, |
| 803 |
where division is displayed as a numerator over a fractional line |
| 804 |
(made up of dashes) over a denominator. |
| 805 |
If the width (number of columns) required for this 2D display exceeds the screen width, |
| 806 |
the expression is displayed instead in single-line (one-dimensional) format |
| 807 |
by the <a href="#list">list command</a>. |
| 808 |
The screen width is set automatically on startup, |
| 809 |
or by the "<a href="#set">set</a> columns" option. |
| 810 |
<p> |
| 811 |
Non-integer constants are converted to reduced fractions, |
| 812 |
if they are exactly equal to a simple fraction and it would improve readability. |
| 813 |
<p> |
| 814 |
The "factor" option causes all integers, less than or equal to 15 decimal digits long, |
| 815 |
to be factorized into their prime factors before display, |
| 816 |
including the numerator and denominator of fractions. |
| 817 |
To always factorize integers like this before display, |
| 818 |
use the "<a href="#set">set</a> factor_integers" option. |
| 819 |
<p> |
| 820 |
The "mixed" option displays |
| 821 |
<a target="_blank" rel="nofollow" href="http://en.wikipedia.org/wiki/Mixed_fraction">mixed fractions</a> when possible. |
| 822 |
A mixed fraction is an expression like <b>(2+(1/4))</b>, rather than the simple fraction <b>9/4</b>. |
| 823 |
To always display mixed fractions, |
| 824 |
use the "<a href="#set">set</a> fractions mixed" option. |
| 825 |
Displaying "simple" fractions when not the default is possible now, too. |
| 826 |
|
| 827 |
<br> |
| 828 |
<br> |
| 829 |
<hr> |
| 830 |
<a name="divide"></a> |
| 831 |
<h2>Divide command</h2> |
| 832 |
<p> |
| 833 |
Syntax: <b>divide [base-variable] [dividend divisor]</b> |
| 834 |
<p> |
| 835 |
This command is for conveniently doing and experimenting with polynomial |
| 836 |
and numerical division and Greatest Common Divisors (GCDs). |
| 837 |
It simply prompts for two expressions: the <b>dividend</b> and the <b>divisor</b> |
| 838 |
(if not specified on the command-line), |
| 839 |
and divides them, displaying the result and the GCD. |
| 840 |
If the <b>base variable</b> name and/or two expressions are specified on the command-line, |
| 841 |
they must be separated by space or comma characters. |
| 842 |
<p> |
| 843 |
Mathomatic has a powerful, general, multivariate polynomial division routine, |
| 844 |
and univariate polynomial GCD routines, |
| 845 |
used by the <a href="#simplify">simplify command</a>, |
| 846 |
which this divide command calls without any other processing if two polynomials are entered. |
| 847 |
<p> |
| 848 |
This command prompts for |
| 849 |
the <b>dividend</b> (the main polynomial) and then the <b>divisor</b> (what you want to |
| 850 |
divide the main polynomial by). |
| 851 |
The polynomial quotient, remainder, and GCD are displayed. |
| 852 |
The power of the highest power term in the dividend must be greater than or equal to |
| 853 |
the power of the highest power term in the divisor, otherwise the polynomial division will fail |
| 854 |
(as it should). |
| 855 |
In other words, the degree of the divisor polynomial |
| 856 |
must be less than or equal to the degree of the dividend polynomial. |
| 857 |
<p> |
| 858 |
A <b>base variable</b> name may be specified first on the command-line as the base variable of the two polynomials, |
| 859 |
but is usually not necessary because a good base variable is automatically selected that works for the division. |
| 860 |
<p> |
| 861 |
If two numbers are entered instead of polynomials, |
| 862 |
the result of the numerical division, the GCD, |
| 863 |
and the Least Common Multiple (LCM) are displayed. |
| 864 |
The LCM of two numbers is the smallest positive number that can be evenly divided by both numbers |
| 865 |
separately, without remainder. |
| 866 |
The LCM is the same as the Lowest Common Denominator (LCD) of two fractions and |
| 867 |
is the two numbers multiplied together, divided by the GCD. |
| 868 |
<p> |
| 869 |
The Greatest Common Divisor of <b>a</b> and <b>b</b> is defined as the greatest |
| 870 |
positive number or polynomial that evenly divides both <b>a</b> and <b>b</b> without remainder. |
| 871 |
In Mathomatic, the GCD is not necessarily integer, unless both <b>a</b> and <b>b</b> are integers. |
| 872 |
The Euclidean GCD algorithm is used by Mathomatic to compute the GCD for numbers and polynomials. |
| 873 |
<p> |
| 874 |
The GCD is the best way to reduce any fraction to its simplest form. |
| 875 |
Just divide the numerator and denominator by their GCD, |
| 876 |
and replace each of them with their quotients (there will be no remainder); |
| 877 |
the result is a completely reduced, |
| 878 |
<a target="_blank" rel="nofollow" href="http://en.wikipedia.org/wiki/Equivalent_fraction">equivalent fraction</a>. |
| 879 |
The polynomial GCD is used when reducing algebraic fractions, factoring polynomials, and for simplifying. |
| 880 |
<p> |
| 881 |
The Euclidean GCD algorithm of successive divides is the best way to compute the |
| 882 |
GCD for numbers and polynomials. |
| 883 |
Multivariate polynomial GCD computation usually |
| 884 |
requires recursion of the GCD algorithm or other methods. |
| 885 |
Currently the polynomial GCD routine in Mathomatic |
| 886 |
is not recursive, making it univariate and simpler. |
| 887 |
Because it is univariate, Mathomatic might be unable |
| 888 |
to find the GCD of polynomials with many variables. |
| 889 |
Finding the GCD of large polynomials will probably |
| 890 |
not succeed anyways with floating point arithmetic, |
| 891 |
because of accumulated round-off error. |
| 892 |
<p> |
| 893 |
The polynomial division algorithm in Mathomatic |
| 894 |
is generalized and able to handle any number of variables (multivariate), |
| 895 |
and division is always done with one selected base variable to be proper polynomial division. |
| 896 |
Being generalized, the coefficients of the polynomials |
| 897 |
may be any mathematical expression not containing the base variable. |
| 898 |
<p> |
| 899 |
An example of polynomial division: |
| 900 |
|
| 901 |
<pre class="sample"> |
| 902 |
1—> divide |
| 903 |
Enter dividend: (x^4) - (7*(x^3)) + (18*(x^2)) - (22*x) + 12 |
| 904 |
Enter divisor: (x^2) - (2*x) + 2 |
| 905 |
|
| 906 |
Polynomial division successful using variable (x). |
| 907 |
The quotient is: |
| 908 |
6 + (x^2) - (5*x) |
| 909 |
|
| 910 |
The remainder is: |
| 911 |
0 |
| 912 |
|
| 913 |
Polynomial Greatest Common Divisor (iterations = 1): |
| 914 |
(x^2) - (2*x) + 2 |
| 915 |
1—> |
| 916 |
</pre> |
| 917 |
|
| 918 |
<p> |
| 919 |
The number of iterations displayed is the number of polynomial divides |
| 920 |
done to compute the GCD with the Euclidean algorithm. |
| 921 |
<p> |
| 922 |
"repeat divide" repeatedly prompts for all input, performing its function again and again, |
| 923 |
until empty lines are given. |
| 924 |
|
| 925 |
<br> |
| 926 |
<br> |
| 927 |
<hr> |
| 928 |
<a name="echo"></a> |
| 929 |
<h2>Echo command</h2> |
| 930 |
<p> |
| 931 |
Syntax: <b>echo [text]</b> |
| 932 |
<p> |
| 933 |
By default, this command outputs a line of <b>text</b>, followed by a newline. |
| 934 |
|
| 935 |
<pre class="indent"> |
| 936 |
repeat echo - |
| 937 |
</pre> |
| 938 |
|
| 939 |
<p> |
| 940 |
outputs a line of dashes. |
| 941 |
|
| 942 |
<pre class="indent"> |
| 943 |
repeat echo |
| 944 |
</pre> |
| 945 |
|
| 946 |
<p> |
| 947 |
clears the screen. |
| 948 |
|
| 949 |
<br> |
| 950 |
<br> |
| 951 |
<hr> |
| 952 |
<a name="edit"></a> |
| 953 |
<h2>Edit command</h2> |
| 954 |
<p> |
| 955 |
Syntax: <b>edit [file-name]</b> |
| 956 |
<p> |
| 957 |
This command invokes the ASCII text editor specified by the EDITOR environment variable. |
| 958 |
By default, all equation spaces are edited. |
| 959 |
Access to shell (<i>/bin/sh</i>) is required for this command to work. |
| 960 |
<p> |
| 961 |
Type "edit" at the Mathomatic prompt to edit all expressions and equations |
| 962 |
you have entered for the current session. |
| 963 |
When you are done editing Mathomatic expressions and commands, |
| 964 |
save and exit the editor to have them automatically read in by Mathomatic. |
| 965 |
If Mathomatic gets an error reading in its new input, |
| 966 |
observe where the error is and continue, to |
| 967 |
automatically re-enter the editor. |
| 968 |
<p> |
| 969 |
To edit an existing file and have it read in, specify the <b>file name</b> |
| 970 |
on the edit command-line. |
| 971 |
|
| 972 |
<br> |
| 973 |
<br> |
| 974 |
<hr> |
| 975 |
<a name="eliminate"></a> |
| 976 |
<h2>Eliminate command</h2> |
| 977 |
<p> |
| 978 |
Syntax: <b>eliminate variables or "all" ["using" equation-number]</b> |
| 979 |
<p> |
| 980 |
This command is used to combine simultaneous equations, |
| 981 |
by automatically substituting variables in the current equation. |
| 982 |
It will scan the command-line from left to right, |
| 983 |
replacing all occurrences of the specified <b>variables</b> |
| 984 |
in the current equation with the RHS of solved equations. |
| 985 |
The equation to solve can be specified with the "using" argument. |
| 986 |
If "using" is not specified, Mathomatic will search backwards, |
| 987 |
starting at the current equation minus one, |
| 988 |
for the first equation that contains the specified variable. |
| 989 |
The equation to solve is solved for the specified variable, |
| 990 |
then the RHS is inserted at every occurrence of the |
| 991 |
specified variable in the current equation. |
| 992 |
That effectively eliminates the specified variable |
| 993 |
from the current equation, resulting in one less unknown. |
| 994 |
<p> |
| 995 |
There is an advantage to eliminating multiple variables in |
| 996 |
one command: each equation will be used only once. |
| 997 |
If the same equation is solved and substituted into the current |
| 998 |
equation more than once, it will cancel out. |
| 999 |
<p> |
| 1000 |
"eliminate all" is shorthand for specifying all normal variables on the command-line. |
| 1001 |
"repeat eliminate all" will eliminate all variables repeatedly until nothing more can be substituted, |
| 1002 |
using each equation only once. |
| 1003 |
<p> |
| 1004 |
Here is a simple example of combining two equations: |
| 1005 |
|
| 1006 |
<pre class="sample"> |
| 1007 |
1—> ; This arrives at the distance between two points in 3D space from the |
| 1008 |
1—> ; Pythagorean theorem (distance between two points on a 2D plane). |
| 1009 |
1—> ; The coordinate of point 1, 2D: (x1, y1), 3D: (x1, y1, z1). |
| 1010 |
1—> ; The coordinate of point 2, 2D: (x2, y2), 3D: (x2, y2, z2). |
| 1011 |
1—> |
| 1012 |
1—> L^2=(x1-x2)^2+(y1-y2)^2 ; Distance formula for a 2D Cartesian plane. |
| 1013 |
|
| 1014 |
#1: L^2 = ((x1 − x2)^2) + ((y1 − y2)^2) |
| 1015 |
|
| 1016 |
1—> distance^2=L^2+(z1-z2)^2 ; Add another leg. |
| 1017 |
|
| 1018 |
#2: distance^2 = (L^2) + ((z1 − z2)^2) |
| 1019 |
|
| 1020 |
2—> eliminate L ; Combine the two equations. |
| 1021 |
Solving equation #1 for (L) and substituting into the current equation... |
| 1022 |
|
| 1023 |
#2: distance^2 = ((x1 − x2)^2) + ((y1 − y2)^2) + ((z1 − z2)^2) |
| 1024 |
|
| 1025 |
2—> distance ; Solve to get the distance formula for 3D space. |
| 1026 |
|
| 1027 |
1 |
| 1028 |
#2: distance = ((((x1 − x2)^2) + ((y1 − y2)^2) + ((z1 − z2)^2))^—)·sign2 |
| 1029 |
2 |
| 1030 |
|
| 1031 |
Finished reading file "pyth3d.in". |
| 1032 |
2—> |
| 1033 |
</pre> |
| 1034 |
|
| 1035 |
<br> |
| 1036 |
<br> |
| 1037 |
<hr> |
| 1038 |
<a name="extrema"></a> |
| 1039 |
<h2>Extrema command</h2> |
| 1040 |
<p> |
| 1041 |
Syntax: <b>extrema [variable] [order]</b> |
| 1042 |
<p> |
| 1043 |
This command computes possible extrema (the minimums and maximums) |
| 1044 |
of the current expression by default, |
| 1045 |
or possible inflection points when <b>order</b> is 2. |
| 1046 |
The result is placed in the next available equation space, displayed, |
| 1047 |
and becomes the current equation. |
| 1048 |
The original expression is not modified. |
| 1049 |
<p> |
| 1050 |
By default (<b>order</b>=1) this command computes stationary points. |
| 1051 |
The stationary points of function <b>f(x)</b> are the values of <b>x</b> |
| 1052 |
when the slope (<a href="#derivative">derivative</a>) equals zero. |
| 1053 |
Stationary points are likely the local minimums and maximums of the function, |
| 1054 |
unless the point is determined to be an inflection point. |
| 1055 |
<p> |
| 1056 |
For <b>y=f(x)</b>, where <b>f(x)</b> is the RHS and <b>x</b> is the specified <b>variable</b>, |
| 1057 |
this command gives the values of <b>x</b> that make the minimums and maximums of <b>y</b>. |
| 1058 |
This is computed by taking the derivative of <b>f(x)</b>, setting it equal to zero, |
| 1059 |
and then solving for <b>x</b>. |
| 1060 |
<p> |
| 1061 |
The number of derivatives to take before solving |
| 1062 |
can be specified by the <b>order</b> argument (default is 1). |
| 1063 |
When <b>order</b> is 2, possible points of inflection are determined. |
| 1064 |
A point of inflection is a point on a curve at which the second derivative changes sign |
| 1065 |
from positive to negative or negative to positive. |
| 1066 |
|
| 1067 |
<pre class="sample"> |
| 1068 |
1—> y=x^2 |
| 1069 |
|
| 1070 |
#1: y = x^2 |
| 1071 |
|
| 1072 |
1—> extrema x |
| 1073 |
|
| 1074 |
#2: x = 0 |
| 1075 |
|
| 1076 |
2—> |
| 1077 |
</pre> |
| 1078 |
|
| 1079 |
<p> |
| 1080 |
This function is a parabola, with the minimum at <b>x=0</b>. |
| 1081 |
|
| 1082 |
<br> |
| 1083 |
<br> |
| 1084 |
<hr> |
| 1085 |
<a name="factor"></a> |
| 1086 |
<h2>Factor command</h2> |
| 1087 |
<p> |
| 1088 |
Syntax: <b>factor ["number" [integers]] or ["power"] [equation-number-range] [variables]</b> |
| 1089 |
<br> |
| 1090 |
Alternate command name: <b>collect</b> |
| 1091 |
<p> |
| 1092 |
This command will factorize manually entered <b>integers</b>, |
| 1093 |
displaying all prime factors, |
| 1094 |
when "<b>numbers</b>" is specified on the factor command-line. |
| 1095 |
Otherwise this command will factor <b>variables</b> |
| 1096 |
in expressions in the specified equation spaces, |
| 1097 |
and factor out the GCD of rational constant coefficients, |
| 1098 |
resulting in smaller integer coefficients. |
| 1099 |
This is a very handy command for your algebraic manipulation toolbox. |
| 1100 |
<p> |
| 1101 |
This command does not factor polynomials. |
| 1102 |
To factor polynomials with repeated or symbolic factors, |
| 1103 |
use the <a href="#simplify">simplify</a> |
| 1104 |
or <a href="#fraction">fraction</a> commands. |
| 1105 |
To factorize integers in equation spaces and display, |
| 1106 |
use the "<a href="#display">display</a> factor" command |
| 1107 |
or "<a href="#set">set</a> factor_integers" command |
| 1108 |
to always do this. |
| 1109 |
<p> |
| 1110 |
"factor <b>number</b>" will prompt for integers to factorize, |
| 1111 |
which may be up to 15 decimal digits. |
| 1112 |
Preceding this command with "repeat" or using |
| 1113 |
the plural "factor <b>numbers</b>" will repeatedly prompt for <b>integers</b> to factorize, |
| 1114 |
until an empty line is given. |
| 1115 |
Multiple <b>integers</b>, integer ranges (two integers separated with a dash "-"), |
| 1116 |
or multiple expressions that evaluate to integers, |
| 1117 |
can be specified on the same line |
| 1118 |
and should be separated with spaces or commas. |
| 1119 |
<p> |
| 1120 |
Without the "number" option, this command will factor out |
| 1121 |
repeated sub-expressions and repeated integer factors (the GCDs) in equation spaces. |
| 1122 |
When factoring expressions, this command does some basic simplification and |
| 1123 |
factors out any common (mathematically equal) sub-expressions it can, |
| 1124 |
unless <b>variables</b> are specified on the command-line, |
| 1125 |
in which case only common sub-expressions |
| 1126 |
containing those variables are factored out. |
| 1127 |
This collects together terms involving those variables. |
| 1128 |
<p> |
| 1129 |
For example, with the following expression: |
| 1130 |
|
| 1131 |
<pre class="indent"> |
| 1132 |
(b*c) + (b*d) |
| 1133 |
</pre> |
| 1134 |
|
| 1135 |
<p> |
| 1136 |
variable <b>b</b> factors out and the result of this command is: |
| 1137 |
|
| 1138 |
<pre class="indent"> |
| 1139 |
b*(c + d) |
| 1140 |
</pre> |
| 1141 |
|
| 1142 |
<p> |
| 1143 |
If no variables are specified on the command-line, |
| 1144 |
this command factors even more: |
| 1145 |
the bases of common (mathematically equal) bases raised to any power are factored out. |
| 1146 |
This is called Horner factoring or Horner's rule. |
| 1147 |
<p> |
| 1148 |
For example: |
| 1149 |
|
| 1150 |
<pre class="sample"> |
| 1151 |
1—> (2+3x)^2*(x+y) |
| 1152 |
|
| 1153 |
#1: ((2 + (3·x))^2)·(x + y) |
| 1154 |
|
| 1155 |
1—> unfactor ; expand |
| 1156 |
|
| 1157 |
#1: (4·x) + (12·(x^2)) + (9·(x^3)) + (4·y) + (12·x·y) + (9·(x^2)·y) |
| 1158 |
|
| 1159 |
1—> factor x ; collect terms containing x |
| 1160 |
|
| 1161 |
#1: (x·(4 + (12·y))) + ((x^2)·(12 + (9·y))) + (9·(x^3)) + (4·y) |
| 1162 |
|
| 1163 |
1—> x^3+2x^2+3x+4 ; enter another expression |
| 1164 |
|
| 1165 |
#2: (x^3) + (2·(x^2)) + (3·x) + 4 |
| 1166 |
|
| 1167 |
2—> factor ; Horner factoring |
| 1168 |
|
| 1169 |
#2: (x·((x·(x + 2)) + 3)) + 4 |
| 1170 |
|
| 1171 |
2—> |
| 1172 |
</pre> |
| 1173 |
|
| 1174 |
<p> |
| 1175 |
"factor <b>power</b>" does only power operator collecting; |
| 1176 |
that is, <b>(a^n)*(a^m)*(b^n)*(b^m)</b> |
| 1177 |
is transformed to <b>(a*b)^(n+m)</b>. |
| 1178 |
With this option, <b>variables</b> cannot be specified. |
| 1179 |
<p> |
| 1180 |
To undo any kind of factoring in selected equation spaces, |
| 1181 |
use the <a href="#unfactor">unfactor command</a>. |
| 1182 |
|
| 1183 |
<br> |
| 1184 |
<br> |
| 1185 |
<hr> |
| 1186 |
<a name="for"></a> |
| 1187 |
<h2>For command</h2> |
| 1188 |
<p> |
| 1189 |
Syntax: <b>for variable start end [step-size]</b> |
| 1190 |
<br> |
| 1191 |
Alternate syntax: <b>for variable "=" start "to" end ["step" step-size]</b> |
| 1192 |
<p> |
| 1193 |
This command is good for testing an expression with many sequential input values. |
| 1194 |
It quickly evaluates (approximates/simplifies) and displays the current expression for each value of |
| 1195 |
the index <b>variable</b> |
| 1196 |
as the index <b>variable</b> goes from <b>start</b> to <b>end</b> |
| 1197 |
in steps of <b>step-size</b> (default 1). |
| 1198 |
Nothing is modified. |
| 1199 |
<p> |
| 1200 |
The syntax of this command is the same as the <a href="#sum">sum</a> |
| 1201 |
and <a href="#product">product</a> commands. |
| 1202 |
This command is not a programming construct, and only allows automatically plugging in |
| 1203 |
sequential values of a <b>variable</b> into the current expression, |
| 1204 |
approximating and simplifying, then displaying the results in single-line format. |
| 1205 |
|
| 1206 |
<br> |
| 1207 |
<br> |
| 1208 |
<hr> |
| 1209 |
<a name="fraction"></a> |
| 1210 |
<h2>Fraction command</h2> |
| 1211 |
<p> |
| 1212 |
Syntax: <b>fraction ["numerator"] ["denominator"] [equation-number-range]</b> |
| 1213 |
<p> |
| 1214 |
This command reduces and converts expressions with any algebraic fractions in them |
| 1215 |
into a single simple algebraic fraction (usually the ratio of two polynomials), |
| 1216 |
similar to what <a target="_blank" rel="nofollow" href="http://maxima.sourceforge.net">Maxima's</a> |
| 1217 |
<code>rat()</code> and <code>ratsimp()</code> functions do. |
| 1218 |
It does this by combining all terms |
| 1219 |
added together with like and unlike denominators |
| 1220 |
to a single simple fraction with a like denominator. |
| 1221 |
Unlike denominators are combined by converting |
| 1222 |
the terms to what they would be over like (common) denominators. |
| 1223 |
Fractions are reduced by |
| 1224 |
cancelling out the Greatest Common Divisor (GCD) of the numerator and denominator. |
| 1225 |
<p> |
| 1226 |
The result of this command is mathematically equivalent to the original expression, |
| 1227 |
unless the "numerator" or "denominator" option is specified, |
| 1228 |
in which case the result is the numerator or denominator of the original expression. |
| 1229 |
If both the "numerator" and "denominator" options are specified at once, |
| 1230 |
this command will return with failure if the result is not a fraction, |
| 1231 |
otherwise the entire fraction is returned. |
| 1232 |
<p> |
| 1233 |
Note that algebraic fractions added together with like denominators are |
| 1234 |
automatically combined by almost any Mathomatic command. |
| 1235 |
Polynomial factoring is only done by the <a href="#simplify">simplify command</a> |
| 1236 |
and this fraction command, to improve simplification. |
| 1237 |
<p> |
| 1238 |
Example: |
| 1239 |
|
| 1240 |
<pre class="sample"> |
| 1241 |
1—> 1/x+1/y+1/z |
| 1242 |
|
| 1243 |
1 1 1 |
| 1244 |
#1: — + — + — |
| 1245 |
x y z |
| 1246 |
|
| 1247 |
1—> fraction |
| 1248 |
|
| 1249 |
(((y + x)·z) + (x·y)) |
| 1250 |
#1: ————————————————————— |
| 1251 |
(x·y·z) |
| 1252 |
|
| 1253 |
1—> unfactor |
| 1254 |
|
| 1255 |
((y·z) + (x·z) + (x·y)) |
| 1256 |
#1: ——————————————————————— |
| 1257 |
(x·y·z) |
| 1258 |
|
| 1259 |
1—> unfactor fraction |
| 1260 |
|
| 1261 |
1 1 1 |
| 1262 |
#1: — + — + — |
| 1263 |
x y z |
| 1264 |
|
| 1265 |
1—> |
| 1266 |
</pre> |
| 1267 |
|
| 1268 |
<p> |
| 1269 |
"repeat fraction" repeatedly runs the fraction command until the result stabilizes |
| 1270 |
to the smallest size simple algebraic fraction. |
| 1271 |
<p> |
| 1272 |
If more simplification is needed, try the "<a href="#simplify">simplify</a> fraction" command instead, |
| 1273 |
though the result is not always a single simple fraction with the simplify command. |
| 1274 |
|
| 1275 |
<br> |
| 1276 |
<br> |
| 1277 |
<hr> |
| 1278 |
<a name="help"></a> |
| 1279 |
<h2>Help command</h2> |
| 1280 |
<p> |
| 1281 |
Syntax: <b>help [topics or command-names]</b> |
| 1282 |
<br> |
| 1283 |
Alternate command name: <b>?</b> |
| 1284 |
<p> |
| 1285 |
This command is provided as a quick reference while running Mathomatic. |
| 1286 |
If the argument is a command name, |
| 1287 |
a one line description and one line syntax (usage info) of that command are displayed, |
| 1288 |
possibly followed by one more line of additional information about that command. |
| 1289 |
Command names and topics may be abbreviated, for example "help r" will display all commands |
| 1290 |
that start with the letter "r". |
| 1291 |
<p> |
| 1292 |
Entering this command by itself will display a list of available topics and commands. |
| 1293 |
"help license" will display the copyright and license notice |
| 1294 |
for the currently running version of Mathomatic. |
| 1295 |
<p> |
| 1296 |
To create a quick reference text file of all Mathomatic commands, type: |
| 1297 |
|
| 1298 |
<pre class="indent"> |
| 1299 |
help all >quickref.txt |
| 1300 |
</pre> |
| 1301 |
|
| 1302 |
<br> |
| 1303 |
<br> |
| 1304 |
<hr> |
| 1305 |
<a name="imaginary"></a> |
| 1306 |
<h2>Imaginary command</h2> |
| 1307 |
<p> |
| 1308 |
Syntax: <b>imaginary [variable]</b> |
| 1309 |
<p> |
| 1310 |
This command copies the imaginary part of a <a href="manual.html#complex">complex number expression</a> to the |
| 1311 |
next available equation space. |
| 1312 |
First it fully expands the current equation space with imaginary number simplification. |
| 1313 |
Then if the current expression or RHS of the current equation is not complex, |
| 1314 |
the warning message "Expression is not a mix" will be displayed. |
| 1315 |
A complex number expression contains both imaginary and real number parts. |
| 1316 |
To copy only the real number part, see the <a href="#real">real command</a>. |
| 1317 |
<p> |
| 1318 |
The separation <b>variable</b> may be specified on the command-line, |
| 1319 |
the default is the imaginary unit <b>i</b>. |
| 1320 |
<b>i</b> is really a mathematical constant equal to the square root of -1, |
| 1321 |
but it can often be specified where variables are required in Mathomatic. |
| 1322 |
<p> |
| 1323 |
If successful, the result may contain the imaginary unit <b>i</b> |
| 1324 |
or the specified separation <b>variable</b>. |
| 1325 |
|
| 1326 |
<pre class="sample"> |
| 1327 |
1—> (a+b*i)/(c+d*i) |
| 1328 |
|
| 1329 |
(a + (b·i)) |
| 1330 |
#1: ––––––––––– |
| 1331 |
(c + (d·i)) |
| 1332 |
|
| 1333 |
1—> imaginary |
| 1334 |
|
| 1335 |
i·((b·c) − (a·d)) |
| 1336 |
#2: ––––––––––––––––– |
| 1337 |
(c^2 + d^2) |
| 1338 |
|
| 1339 |
2—> |
| 1340 |
</pre> |
| 1341 |
|
| 1342 |
<p> |
| 1343 |
To remove <b>i</b> from the result, type: |
| 1344 |
<pre class="indent"> |
| 1345 |
replace i with 1 |
| 1346 |
</pre> |
| 1347 |
|
| 1348 |
<br> |
| 1349 |
<br> |
| 1350 |
<hr> |
| 1351 |
<a name="integrate"></a> |
| 1352 |
<h2>Integrate command</h2> |
| 1353 |
<p> |
| 1354 |
Syntax: <b>integrate ["constant" or "definite"] variable [order [lower and upper-bounds]]</b> |
| 1355 |
<br> |
| 1356 |
Alternate command name: <b>integral</b> |
| 1357 |
<p> |
| 1358 |
This command computes the exact symbolic integral of a polynomial function |
| 1359 |
with respect to the specified <b>variable</b>, |
| 1360 |
using the current expression or RHS of the current equation as the function. |
| 1361 |
If successful, the simplified integral is placed in the next available equation space, |
| 1362 |
displayed, and becomes the current equation. |
| 1363 |
<p> |
| 1364 |
The default is to compute and display the <b>indefinite integral</b>, |
| 1365 |
also known as the <b>antiderivative</b> or <b>primitive</b>. |
| 1366 |
The antiderivative is the inverse transformation of the |
| 1367 |
<a href="#derivative">derivative</a>. |
| 1368 |
<p> |
| 1369 |
"integrate constant" simply adds a sequentially named <b>constant of integration</b> |
| 1370 |
("C_1", "C_2", etc.) to each integration result. |
| 1371 |
The constants of integration here are actually variables that may be set to any constant. |
| 1372 |
<p> |
| 1373 |
"integrate definite" also integrates, but prompts you for the lower and upper |
| 1374 |
bounds for <b>definite integration</b>. |
| 1375 |
The bounds may also be specified on the end of the command-line. |
| 1376 |
If <b>g(x)</b> is the indefinite integral (antiderivative) of <b>f(x)</b>, |
| 1377 |
the definite integral is: |
| 1378 |
|
| 1379 |
<pre class="indent"> |
| 1380 |
g(upper_bound) − g(lower_bound) |
| 1381 |
</pre> |
| 1382 |
|
| 1383 |
<p> |
| 1384 |
Specifying the <b>order</b> allows you to repeatedly integrate. |
| 1385 |
The default is to integrate once (<b>order</b>=1). |
| 1386 |
<p> |
| 1387 |
This command is only capable of integrating polynomials. |
| 1388 |
|
| 1389 |
<pre class="sample"> |
| 1390 |
1—> x^3+x^2+x+1 |
| 1391 |
|
| 1392 |
#1: (x^3) + (x^2) + x + 1 |
| 1393 |
|
| 1394 |
1—> integrate x |
| 1395 |
|
| 1396 |
(x^4) (x^3) (x^2) |
| 1397 |
#2: ----- + ----- + ----- + x |
| 1398 |
4 3 2 |
| 1399 |
|
| 1400 |
2—> derivative x ; check the result |
| 1401 |
Differentiating with respect to (x) and simplifying... |
| 1402 |
|
| 1403 |
#3: (x^3) + (x^2) + x + 1 |
| 1404 |
|
| 1405 |
3—> compare 1 |
| 1406 |
Comparing #1 with #3... |
| 1407 |
Expressions are identical. |
| 1408 |
3—> |
| 1409 |
</pre> |
| 1410 |
|
| 1411 |
<br> |
| 1412 |
<br> |
| 1413 |
<hr> |
| 1414 |
<a name="laplace"></a> |
| 1415 |
<h2>Laplace command</h2> |
| 1416 |
<p> |
| 1417 |
Syntax: <b>laplace ["inverse"] variable</b> |
| 1418 |
<p> |
| 1419 |
This command computes the Laplace transform of a polynomial function of the specified <b>variable</b>, |
| 1420 |
using the current expression or RHS of the current equation as the function. |
| 1421 |
If successful, the transformed function is placed in the next available equation space, |
| 1422 |
displayed, and becomes the current equation. |
| 1423 |
<p> |
| 1424 |
This command only works with polynomials. |
| 1425 |
<p> |
| 1426 |
A Laplace transform can be undone by applying the <b>inverse</b> Laplace transform. |
| 1427 |
That is accomplished by specifying the "inverse" option to this command. |
| 1428 |
|
| 1429 |
<pre class="sample"> |
| 1430 |
1—> y=1 |
| 1431 |
|
| 1432 |
#1: y = 1 |
| 1433 |
|
| 1434 |
1—> laplace x ; compute the Laplace transform of 1 |
| 1435 |
|
| 1436 |
1 |
| 1437 |
#2: y = - |
| 1438 |
x |
| 1439 |
|
| 1440 |
2—> a*x^n ; a general polynomial term |
| 1441 |
|
| 1442 |
#3: a*(x^n) |
| 1443 |
|
| 1444 |
3—> laplace x |
| 1445 |
|
| 1446 |
a*(n!) |
| 1447 |
#4: ----------- |
| 1448 |
(x^(n + 1)) |
| 1449 |
|
| 1450 |
4—> laplace inverse x |
| 1451 |
|
| 1452 |
#5: a*(x^n) |
| 1453 |
|
| 1454 |
5—> |
| 1455 |
</pre> |
| 1456 |
|
| 1457 |
<br> |
| 1458 |
<br> |
| 1459 |
<hr> |
| 1460 |
<a name="limit"></a> |
| 1461 |
<h2>Limit command</h2> |
| 1462 |
<p> |
| 1463 |
Syntax: <b>limit variable expression</b> |
| 1464 |
<p> |
| 1465 |
This command takes the limit of the current expression as <b>variable</b> |
| 1466 |
goes to the specified <b>expression</b>. |
| 1467 |
The result is always an equation and |
| 1468 |
placed in the next available equation space and displayed. |
| 1469 |
<p> |
| 1470 |
L'Hopital's rule for taking limits is not used by this command. |
| 1471 |
Instead the limit is taken by simplifying, solving, and substituting. |
| 1472 |
This command is experimental and does not know about negative infinity |
| 1473 |
and occasionally gives a wrong answer when dealing with infinities. |
| 1474 |
|
| 1475 |
<pre class="sample"> |
| 1476 |
1—> 2x/(x+1) |
| 1477 |
|
| 1478 |
2·x |
| 1479 |
#1: ——————— |
| 1480 |
(x + 1) |
| 1481 |
|
| 1482 |
1—> limit x inf ; take the limit as x goes to infinity |
| 1483 |
Solving... |
| 1484 |
|
| 1485 |
#2: limit = 2 |
| 1486 |
|
| 1487 |
1—> |
| 1488 |
</pre> |
| 1489 |
|
| 1490 |
<p> |
| 1491 |
This command is experimental in that it tests the effectiveness |
| 1492 |
of solving the equation for the limit <b>variable</b> and simplifying, |
| 1493 |
replacing the limit variable with the "goes to" value or <b>expression</b>, |
| 1494 |
then solving back for the original solve variable and simplifying. |
| 1495 |
|
| 1496 |
<br> |
| 1497 |
<br> |
| 1498 |
<hr> |
| 1499 |
<a name="list"></a> |
| 1500 |
<h2>List command</h2> |
| 1501 |
<p> |
| 1502 |
Syntax: <b>list ["export" or "maxima" or "gnuplot" or "hex" or "primes"] [equation-number-ranges]</b> |
| 1503 |
<p> |
| 1504 |
This command displays stored expressions in single-line (one-dimensional) format. |
| 1505 |
A single formatting option may be specified. |
| 1506 |
With no option specified, expressions are displayed in decimal, Mathomatic format; |
| 1507 |
The text result can then be entered or read back into Mathomatic. |
| 1508 |
|
| 1509 |
<h3>Formatting options:</h3> |
| 1510 |
<blockquote> |
| 1511 |
<p> |
| 1512 |
"list <b>export</b>" outputs expressions in a generally exportable, single-line text format. |
| 1513 |
You can cut-and-paste the expressions or redirect them to a file, |
| 1514 |
so they can be read in with a different math program. |
| 1515 |
<p> |
| 1516 |
"list <b>maxima</b>" is for making expression output compatible |
| 1517 |
with the free computer algebra system <a target="_blank" rel="nofollow" href="http://maxima.sourceforge.net">Maxima</a>. |
| 1518 |
<p> |
| 1519 |
"list <b>gnuplot</b>" is for making expression output that is compatible |
| 1520 |
with the free graphing utility <a target="_blank" rel="nofollow" href="http://gnuplot.sourceforge.net">gnuplot</a>. |
| 1521 |
<p> |
| 1522 |
"list <b>hex</b>" displays as normal (without these options), except constants are displayed as |
| 1523 |
hexadecimal values in binary exponential notation, where no precision is lost by display rounding. |
| 1524 |
Display rounding of constants happens only to the displayed value (not the stored value) |
| 1525 |
and only if a floating point value is converted to decimal for display, |
| 1526 |
so just displaying decimal constants does not ever change their value internally, |
| 1527 |
unless they are read back in. |
| 1528 |
Expressions that are displayed by this hex option have done no display rounding, and |
| 1529 |
can be read back into Mathomatic exactly as they were. |
| 1530 |
But the hex format used here is very ugly and not the hexadecimal you would expect, due to the binary exponent. |
| 1531 |
The standard C math libraries provide no better hexadecimal or other base output. |
| 1532 |
They were meant for decimal display only. |
| 1533 |
<p> |
| 1534 |
"list <b>primes</b>" runs the "matho-primes" utility, if available and security is off. |
| 1535 |
The matho-primes command-line is specified, |
| 1536 |
instead of equation-number-ranges. |
| 1537 |
"list primes all" will continually output consecutive primes. |
| 1538 |
The matho-primes output can be redirected. |
| 1539 |
</blockquote> |
| 1540 |
|
| 1541 |
<p> |
| 1542 |
This list command simply outputs expressions and equations as stored internally by Mathomatic, |
| 1543 |
translating them to the requested output format. |
| 1544 |
There is no simplification and nothing more is done. |
| 1545 |
"list primes" performs a different function and is just short-hand for typing "matho-primes" |
| 1546 |
at the shell prompt. |
| 1547 |
<p> |
| 1548 |
To pretty-print and display equation spaces in better looking multi-line fraction format, |
| 1549 |
use the <a href="#display">display command</a>. |
| 1550 |
|
| 1551 |
<br> |
| 1552 |
<br> |
| 1553 |
<hr> |
| 1554 |
<a name="nintegrate"></a> |
| 1555 |
<h2>NIntegrate command</h2> |
| 1556 |
<p> |
| 1557 |
Syntax: <b>nintegrate ["trapezoid"] variable [partitions [lower and upper-bounds]]</b> |
| 1558 |
<p> |
| 1559 |
This is a numerical integrate command that will work with almost any expression and will |
| 1560 |
not generally compute the exact symbolic integral except for the simplest of expressions. |
| 1561 |
This command will prompt you for the <b>lower |
| 1562 |
and upper bounds</b> to perform numerical definite integration |
| 1563 |
on the current expression or the RHS of the current equation, |
| 1564 |
with respect to the specified <b>variable</b>. |
| 1565 |
These bounds may be any expression not containing infinity, and may |
| 1566 |
be entered at the end of the command-line following <b>partitions</b>, |
| 1567 |
separated by spaces or commas. |
| 1568 |
<p> |
| 1569 |
This command uses Simpson's rule to do the approximation. |
| 1570 |
Accuracy varies widely, depending on the expression integrated, |
| 1571 |
the interval between the <b>lower and upper bounds</b>, |
| 1572 |
and the number of <b>partitions</b>. |
| 1573 |
The default is to split the interval into <b>1000 partitions</b>. |
| 1574 |
Setting the number of partitions greater than 10000 seldom is helpful, |
| 1575 |
because of accumulated floating point round-off error. |
| 1576 |
<p> |
| 1577 |
If "trapezoid" is specified on the command-line, |
| 1578 |
the trapezoid method is used instead, which is usually less |
| 1579 |
accurate than Simpson's rule. |
| 1580 |
The way the trapezoid method works is: the interval from the lower bound to the |
| 1581 |
upper bound is divided into 1000 <b>partitions</b> to produce 1000 trapezoids, |
| 1582 |
then the area of each trapezoid is added together to produce the result. |
| 1583 |
This means that the accuracy usually decreases as the interval increases. |
| 1584 |
Simpson's rule uses the same method, |
| 1585 |
with quadratic curves bounding the top of each trapezoid, |
| 1586 |
instead of straight lines, so that curves are approximated better. |
| 1587 |
<p> |
| 1588 |
If the integration fails, chances of success are greater if |
| 1589 |
you reduce the number of variables involved in the integration. |
| 1590 |
<p> |
| 1591 |
If there are any singularities, such as division by zero, between the bounds of integration, |
| 1592 |
the computed result will be wrong. |
| 1593 |
<p> |
| 1594 |
Here is an example of successful numerical integration: |
| 1595 |
|
| 1596 |
<pre class="sample"> |
| 1597 |
1—> y=x^0.5/(1-x^3) |
| 1598 |
|
| 1599 |
1 |
| 1600 |
(x^–) |
| 1601 |
2 |
| 1602 |
#1: y = ––––––––– |
| 1603 |
(1 − x^3) |
| 1604 |
|
| 1605 |
1—> nintegrate x |
| 1606 |
Warning: Singularity detected, result of numerical integration might be wrong. |
| 1607 |
Enter lower bound: 2 |
| 1608 |
Enter upper bound: 4 |
| 1609 |
Approximating the definite integral of the RHS |
| 1610 |
using Simpson's rule (1000 partitions)... |
| 1611 |
Numerical integration successful: |
| 1612 |
|
| 1613 |
#2: y = -0.16256117185712 |
| 1614 |
|
| 1615 |
1—> |
| 1616 |
</pre> |
| 1617 |
|
| 1618 |
<p> |
| 1619 |
This example avoids the singularity at <b>x=1</b> and is accurate to 12 digits. |
| 1620 |
|
| 1621 |
<br> |
| 1622 |
<br> |
| 1623 |
<hr> |
| 1624 |
<a name="optimize"></a> |
| 1625 |
<h2>Optimize command</h2> |
| 1626 |
<p> |
| 1627 |
Syntax: <b>optimize [equation-number-range]</b> |
| 1628 |
<p> |
| 1629 |
This command splits the specified equations into smaller, more efficient equations |
| 1630 |
with no repeated expressions. |
| 1631 |
Each repeated sub-expression becomes |
| 1632 |
a new equation solved for a temporary variable (named "temp"). |
| 1633 |
<p> |
| 1634 |
Note that the resulting assignment statements may be in the wrong order for inclusion in |
| 1635 |
a computer program with the <a href="#code">code command</a>; |
| 1636 |
the order and generated code should be visually checked before using. |
| 1637 |
The source code statements may need to be manually put in the right order to work properly. |
| 1638 |
|
| 1639 |
<pre class="sample"> |
| 1640 |
1—> y = (a+b+c+d)^(a+b+c+d) |
| 1641 |
|
| 1642 |
#1: y = (a + b + c + d)^(a + b + c + d) |
| 1643 |
|
| 1644 |
1—> optimize |
| 1645 |
|
| 1646 |
#2: temp = a + b + c + d |
| 1647 |
|
| 1648 |
|
| 1649 |
#1: y = temp^temp |
| 1650 |
|
| 1651 |
1—> eliminate temp ; undo the optimization |
| 1652 |
Solving equation #2 for (temp)... |
| 1653 |
|
| 1654 |
#1: y = (a + b + c + d)^(a + b + c + d) |
| 1655 |
|
| 1656 |
1—> |
| 1657 |
</pre> |
| 1658 |
|
| 1659 |
<br> |
| 1660 |
<br> |
| 1661 |
<hr> |
| 1662 |
<a name="pause"></a> |
| 1663 |
<h2>Pause command</h2> |
| 1664 |
<p> |
| 1665 |
Syntax: <b>pause [text]</b> |
| 1666 |
<p> |
| 1667 |
This command waits for the user to press the Enter key. |
| 1668 |
It is useful in text files (scripts) that are read in to Mathomatic. |
| 1669 |
Optionally, a one line text message may be displayed. |
| 1670 |
<p> |
| 1671 |
Typing "quit" or "exit" before pressing the Enter key will fail this command |
| 1672 |
and abort the current script. |
| 1673 |
<p> |
| 1674 |
This command is ignored during test and demo modes. |
| 1675 |
|
| 1676 |
<br> |
| 1677 |
<br> |
| 1678 |
<hr> |
| 1679 |
<a name="plot"></a> |
| 1680 |
<h2>Plot command</h2> |
| 1681 |
<p> |
| 1682 |
Syntax: <b>plot [equation-number-ranges] [xyz-ranges] [gnuplot-expressions,]</b> |
| 1683 |
<p> |
| 1684 |
This command automatically plots multiple solved mathematical equations or expressions in 2D or 3D with |
| 1685 |
the free graphing utility <a target="_blank" rel="nofollow" href="http://gnuplot.sourceforge.net">gnuplot</a>. |
| 1686 |
The specified equation spaces are plotted at once, |
| 1687 |
along with any comma separated <b>gnuplot expressions</b> on the command-line. |
| 1688 |
Each expression should contain the variable <b>x</b> to be successfully plotted. |
| 1689 |
If it also contains the variable <b>y</b>, a 3D surface plot is performed |
| 1690 |
in Cartesian space, with the <b>x</b>, <b>y</b>, and <b>z</b> axes projected |
| 1691 |
on your 2D display. <b>z</b> (in a 3D plot) or <b>y</b> (in a 2D plot) are |
| 1692 |
the variables the plot expressions are supposedly solved for, though they need not be included. |
| 1693 |
<p> |
| 1694 |
A gnuplot <b>X range</b>, <b>Y range</b>, and even a <b>Z range</b> may be specified on the plot command-line. |
| 1695 |
For example, "plot [-128:128]" will make the <b>X</b> axis go from -128 to 128, |
| 1696 |
and "plot [-128:128] [-1:1]" will also make the <b>Y</b> axis go from -1 to 1. |
| 1697 |
A pair of straight brackets <b>[]</b> must surround each range. |
| 1698 |
<p> |
| 1699 |
Plotting of an equation space with the imaginary number <b>i</b> in it is allowed, |
| 1700 |
however plots are always plotted on real Cartesian space, showing only real number points. |
| 1701 |
If there are no real number points, the plot will fail. |
| 1702 |
The imaginary unit, <b>i</b>, is not understood by gnuplot. |
| 1703 |
<p> |
| 1704 |
Gnuplot must be installed and accessible from shell by typing "gnuplot" |
| 1705 |
for this command to work. |
| 1706 |
All functions and operators of gnuplot can be used in the <b>gnuplot expressions</b>. |
| 1707 |
If gnuplot fails, the gnuplot command-line is displayed to show what failed. |
| 1708 |
To always show the gnuplot command-line, enter "<a href="#set">set</a> debug 1" beforehand, |
| 1709 |
to set debug level 1 for the current session. |
| 1710 |
<p> |
| 1711 |
Plots may be customized. |
| 1712 |
Typing "<a href="#set">set</a> <b>plot_prefix</b>" at the Mathomatic main prompt, |
| 1713 |
followed by a string of 8-bit characters, will |
| 1714 |
prepend the string to the gnuplot plot string, when using the Mathomatic |
| 1715 |
plot command. For example, if you type "set plot set polar\;" |
| 1716 |
at the Mathomatic main prompt, 2D polar plots will be performed instead, |
| 1717 |
with subsequent plot commands using variable "t" instead of "x". |
| 1718 |
|
| 1719 |
<br> |
| 1720 |
<br> |
| 1721 |
<hr> |
| 1722 |
<a name="product"></a> |
| 1723 |
<h2>Product command</h2> |
| 1724 |
<p> |
| 1725 |
Syntax: <b>product variable start end [step-size]</b> |
| 1726 |
<br> |
| 1727 |
Alternate syntax: <b>product variable "=" start "to" end ["step" step-size]</b> |
| 1728 |
<p> |
| 1729 |
This command performs a mathematical product |
| 1730 |
(<abbr title="Math using this Greek symbol can be calculated using this product command.">∏</abbr>) |
| 1731 |
of the current expression |
| 1732 |
or the RHS of the current equation |
| 1733 |
as the index <b>variable</b> goes from <b>start</b> to <b>end</b> |
| 1734 |
in steps of <b>step-size</b> (default 1). |
| 1735 |
The result is approximated/simplified, stored, and displayed. |
| 1736 |
The current equation is not changed. |
| 1737 |
|
| 1738 |
<pre class="sample"> |
| 1739 |
1—> y=a*x |
| 1740 |
|
| 1741 |
#1: y = a*x |
| 1742 |
|
| 1743 |
1—> product |
| 1744 |
Enter variable: x |
| 1745 |
x = 1 |
| 1746 |
To: 10 |
| 1747 |
|
| 1748 |
#2: y = 3628800*(a^10) |
| 1749 |
|
| 1750 |
1—> 10! |
| 1751 |
Answer = 3628800 |
| 1752 |
1—> |
| 1753 |
</pre> |
| 1754 |
|
| 1755 |
<p> |
| 1756 |
To see all of the intermediate results, |
| 1757 |
type "<a href="#set">set</a> debug 1" before this. |
| 1758 |
|
| 1759 |
<br> |
| 1760 |
<br> |
| 1761 |
<hr> |
| 1762 |
<a name="push"></a> |
| 1763 |
<h2>Push command</h2> |
| 1764 |
<p> |
| 1765 |
Syntax: <b>push [equation-number-ranges or text-to-push]</b> |
| 1766 |
<p> |
| 1767 |
This command pushes the current or specified equation spaces into the readline |
| 1768 |
history, for easy editing and re-entry by using the cursor keys. |
| 1769 |
The equation spaces are not modified. |
| 1770 |
After this command, the pushed expressions are |
| 1771 |
accessed by pressing the cursor UP (up arrow) key. |
| 1772 |
<p> |
| 1773 |
If any one of the arguments is not a valid equation number range, |
| 1774 |
the text string containing all arguments is pushed into the readline history. |
| 1775 |
<p> |
| 1776 |
This command only exists if Mathomatic was compiled with readline support. |
| 1777 |
|
| 1778 |
<br> |
| 1779 |
<br> |
| 1780 |
<hr> |
| 1781 |
<a name="quit"></a> |
| 1782 |
<h2>Quit command</h2> |
| 1783 |
<p> |
| 1784 |
Syntax: <b>quit [exit-value]</b> |
| 1785 |
<br> |
| 1786 |
Alternate command name: <b>exit</b> |
| 1787 |
<p> |
| 1788 |
Type in this command to exit Mathomatic. |
| 1789 |
All expressions in memory are discarded. |
| 1790 |
To save all your expressions stored in equation spaces, |
| 1791 |
use the <a href="#save">save command</a> before quitting. |
| 1792 |
<p> |
| 1793 |
The optional decimal <b>exit value</b> argument is the exit status returned to the operating system. |
| 1794 |
The default is 0, meaning OK. |
| 1795 |
<p> |
| 1796 |
Another way to quickly exit Mathomatic is to enter your operating system's End-Of-File (EOF) character |
| 1797 |
at the beginning of an input line. |
| 1798 |
The EOF character for Unix-like operating systems is Control-D. |
| 1799 |
|
| 1800 |
<br> |
| 1801 |
<br> |
| 1802 |
<hr> |
| 1803 |
<a name="read"></a> |
| 1804 |
<h2>Read command</h2> |
| 1805 |
<p> |
| 1806 |
Syntax: <b>read [file-name or directory]</b> |
| 1807 |
<p> |
| 1808 |
This command reads in a text file as if you |
| 1809 |
typed the text of the file in at the main prompt. |
| 1810 |
The text file (also known as a script) |
| 1811 |
should contain Mathomatic expressions and commands. |
| 1812 |
Read commands may be nested; that is, the file read in |
| 1813 |
may contain further read commands. |
| 1814 |
If any command or operation returns with an error, |
| 1815 |
all current read operations are aborted; |
| 1816 |
this can be prevented by starting the line that returns with error |
| 1817 |
with a colon (<b>:</b>) character. |
| 1818 |
<p> |
| 1819 |
If any command in the text file prompts for input, |
| 1820 |
it will not read the input from the text file, |
| 1821 |
instead it will prompt the user for the input. |
| 1822 |
<p> |
| 1823 |
Expressions saved with the <a href="#save">save command</a> |
| 1824 |
are restored using this read command. |
| 1825 |
<p> |
| 1826 |
This command is automatically executed when you start up Mathomatic with |
| 1827 |
file names on the shell command-line. The file name may be a directory name, in which case, |
| 1828 |
the current directory is changed to that directory. |
| 1829 |
<p> |
| 1830 |
The default file name extension (suffix) for Mathomatic input files is ".in". |
| 1831 |
A file name extension is not required. |
| 1832 |
<p> |
| 1833 |
This command may be preceded with "repeat", |
| 1834 |
which repeatedly reads a script until it fails or is aborted. |
| 1835 |
<p> |
| 1836 |
Without any arguments, this command does an "ls -C" command in Unix/Linux, or "dir /W/P" under MS-Windows, |
| 1837 |
listing the current directory contents. |
| 1838 |
|
| 1839 |
<br> |
| 1840 |
<br> |
| 1841 |
<hr> |
| 1842 |
<a name="real"></a> |
| 1843 |
<h2>Real command</h2> |
| 1844 |
<p> |
| 1845 |
Syntax: <b>real [variable]</b> |
| 1846 |
<p> |
| 1847 |
This command copies the real part of a <a href="manual.html#complex">complex number expression</a> to the |
| 1848 |
next available equation space. |
| 1849 |
First it fully expands the current equation space with imaginary number simplification. |
| 1850 |
Then if the current expression or RHS of the current equation is not complex, |
| 1851 |
the warning message "Expression is not a mix" will be displayed. |
| 1852 |
A complex number expression contains both imaginary and real number parts. |
| 1853 |
To copy only the imaginary number part, see the |
| 1854 |
<a href="#imaginary">imaginary command</a>. |
| 1855 |
<p> |
| 1856 |
The separation <b>variable</b> may be specified on the command-line, |
| 1857 |
the default is the imaginary unit <b>i</b>. |
| 1858 |
<p> |
| 1859 |
There will be no imaginary numbers in the result. |
| 1860 |
|
| 1861 |
<pre class="sample"> |
| 1862 |
1—> (a+b*i)/(c+d*i) |
| 1863 |
|
| 1864 |
(a + (b·i)) |
| 1865 |
#1: ––––––––––– |
| 1866 |
(c + (d·i)) |
| 1867 |
|
| 1868 |
1—> real |
| 1869 |
|
| 1870 |
((a·c) + (b·d)) |
| 1871 |
#2: ––––––––––––––– |
| 1872 |
(c^2 + d^2) |
| 1873 |
|
| 1874 |
2—> |
| 1875 |
</pre> |
| 1876 |
|
| 1877 |
<br> |
| 1878 |
<br> |
| 1879 |
<hr> |
| 1880 |
<a name="repeat"></a> |
| 1881 |
<h2>Repeat command</h2> |
| 1882 |
<p> |
| 1883 |
Syntax: <b>repeat command arguments</b> |
| 1884 |
<p> |
| 1885 |
Any command may be preceded by "repeat", which sets the repeat flag for that command. |
| 1886 |
Many commands ignore the repeat flag, if repeating them doesn't make sense. |
| 1887 |
Sometimes repeating means do a full simplify when simplifying, |
| 1888 |
for example in the simplify, compare, derivative, extrema, and taylor commands, etc. |
| 1889 |
<p> |
| 1890 |
Currently the approximate, calculate, compare, derivative, divide, echo, eliminate, extrema, fraction, read, replace, roots, simplify, and taylor commands |
| 1891 |
all use the repeat flag. |
| 1892 |
|
| 1893 |
<br> |
| 1894 |
<br> |
| 1895 |
<hr> |
| 1896 |
<a name="replace"></a> |
| 1897 |
<h2>Replace command</h2> |
| 1898 |
<p> |
| 1899 |
Syntax: <b>replace [variables ["with" expression]]</b> |
| 1900 |
<p> |
| 1901 |
By default, this command prompts you for a replacement expression |
| 1902 |
for each variable in the current expression or equation. |
| 1903 |
If an empty line is entered for a variable, that variable remains unchanged. |
| 1904 |
The result is placed in the current expression or equation and displayed. |
| 1905 |
<p> |
| 1906 |
This command is very useful for renaming or substituting variables. |
| 1907 |
It is smart enough to do variable interchange. |
| 1908 |
With the handy <a href="#repeat">"repeat"</a> option, |
| 1909 |
you are repeatedly prompted for values of the variables, |
| 1910 |
the result is simplified, checked for being an identity, and displayed. |
| 1911 |
Nothing is changed with the repeat option. |
| 1912 |
<p> |
| 1913 |
If <b>variables</b> are specified on the command-line, |
| 1914 |
you will be prompted for those variables only and |
| 1915 |
all other variables will be left unchanged. |
| 1916 |
<p> |
| 1917 |
If "with" is specified, the repeat option is ignored, |
| 1918 |
you won't be prompted, and all <b>variables</b> specified will be |
| 1919 |
replaced with the <b>expression</b> that follows. |
| 1920 |
|
| 1921 |
<br> |
| 1922 |
<br> |
| 1923 |
<hr> |
| 1924 |
<a name="roots"></a> |
| 1925 |
<h2>Roots command</h2> |
| 1926 |
<p> |
| 1927 |
Syntax: <b>roots root real-part imaginary-part</b> |
| 1928 |
<p> |
| 1929 |
This command displays all complex number roots |
| 1930 |
of a given positive integer <b>root</b> of a complex number. |
| 1931 |
The number of the <b>root</b> equals the number of correct solutions. |
| 1932 |
For example, "3" would give the 3 roots of the cube root. |
| 1933 |
This command will also convert rectangular coordinates to polar coordinates. |
| 1934 |
<p> |
| 1935 |
The floating point <b>real part</b> (X coordinate) |
| 1936 |
and <b>imaginary part</b> (Y coordinate) |
| 1937 |
of the complex number are prompted for. |
| 1938 |
Just enter an empty line if the value is zero. |
| 1939 |
The polar coordinates of the given complex number are displayed first, |
| 1940 |
which consist of an amplitude (distance from the origin) |
| 1941 |
and an angle (direction). |
| 1942 |
Then each root is calculated and displayed, along with an "Inverse check" value if debugging is enabled, |
| 1943 |
which should equal the original complex number. |
| 1944 |
The "Inverse check" is calculated by repeated complex number multiplication of the root times itself. |
| 1945 |
<p> |
| 1946 |
Since double precision floating point is used, the results are only accurate from 10 to 12 decimal digits. |
| 1947 |
|
| 1948 |
<pre class="sample"> |
| 1949 |
1—> roots |
| 1950 |
Enter root (positive integer): 3 |
| 1951 |
Enter real part (X): 8 |
| 1952 |
Enter imaginary part (Y): |
| 1953 |
|
| 1954 |
The polar coordinates before root taking are: |
| 1955 |
8 amplitude and 0 radians (0 degrees). |
| 1956 |
|
| 1957 |
The 3 roots of (8)^(1/3) are: |
| 1958 |
|
| 1959 |
2 |
| 1960 |
Inverse check: 8 |
| 1961 |
|
| 1962 |
-1 +1.73205080757*i |
| 1963 |
Inverse check: 8 |
| 1964 |
|
| 1965 |
-1 -1.73205080757*i |
| 1966 |
Inverse check: 8 |
| 1967 |
|
| 1968 |
1—> |
| 1969 |
</pre> |
| 1970 |
<p> |
| 1971 |
"repeat roots" repeatedly prompts for all input, |
| 1972 |
performing its function again and again, until empty lines are given. |
| 1973 |
|
| 1974 |
<br> |
| 1975 |
<br> |
| 1976 |
<hr> |
| 1977 |
<a name="save"></a> |
| 1978 |
<h2>Save command</h2> |
| 1979 |
<p> |
| 1980 |
Syntax: <b>save file-name</b> |
| 1981 |
<p> |
| 1982 |
This command saves all expressions in all equation spaces into the specified text file. |
| 1983 |
If the file exists, Mathomatic will ask you if you want to overwrite it. |
| 1984 |
The saved expressions and equations can be reloaded (restored) at a later time |
| 1985 |
by using the <a href="#read">read command</a>. |
| 1986 |
You can edit the saved expressions with your favorite ASCII text editor. |
| 1987 |
<p> |
| 1988 |
Another way to save all equation spaces exactly as they are is to enter: |
| 1989 |
|
| 1990 |
<pre class="indent"> |
| 1991 |
list hex all >filename |
| 1992 |
</pre> |
| 1993 |
|
| 1994 |
<p> |
| 1995 |
into the main Mathomatic prompt, |
| 1996 |
however this saves all constants in hexadecimal |
| 1997 |
and it always overwrites "filename". |
| 1998 |
Because internally constants are binary, |
| 1999 |
hexadecimal can represent them exactly. |
| 2000 |
Reading in the result of this "list hex" command should result in exactly |
| 2001 |
the same expressions in the same numbered equation spaces. |
| 2002 |
<p> |
| 2003 |
The save command does not save the associated equation number, |
| 2004 |
it only saves all of your equations and expressions. |
| 2005 |
It is much easier to read and edit than "list hex". |
| 2006 |
If you have done anything you want to keep, be sure and "save" it before quitting. |
| 2007 |
|
| 2008 |
<br> |
| 2009 |
<br> |
| 2010 |
<hr> |
| 2011 |
<a name="set"></a> |
| 2012 |
<h2>Set command</h2> |
| 2013 |
<p> |
| 2014 |
Syntax: <b>set [["no"] option [value]] …</b> |
| 2015 |
<p> |
| 2016 |
This command sets various options listed below, for the current session. |
| 2017 |
They remain in effect until you exit Mathomatic. |
| 2018 |
Typing "set" without arguments shows all current option settings. |
| 2019 |
<p> |
| 2020 |
The specified <b>option</b> is turned on, unless it is preceded by "no", which turns it off. |
| 2021 |
Some options can be followed by a number and some options can be followed by text, |
| 2022 |
setting that option to the following <b>value</b>. |
| 2023 |
<p> |
| 2024 |
To permanently change the default settings of Mathomatic, |
| 2025 |
set options can be put in the file <i>~/.mathomaticrc</i> |
| 2026 |
(for Microsoft Windows: <i>mathomatic.rc</i> |
| 2027 |
in the same directory as the Mathomatic executable or in the $HOME directory). |
| 2028 |
It should be a text file with one or more set options per line. |
| 2029 |
That file is loaded every time Mathomatic starts up, when not in test, demo, or high security mode. |
| 2030 |
The command "set <b>save</b>" conveniently saves all current session options in that file, |
| 2031 |
making them permanent. |
| 2032 |
"set no <b>save</b>" removes that file, so then Mathomatic will start up with all options |
| 2033 |
set to the program defaults. |
| 2034 |
"set <b>save</b> string" saves only the specified literal ASCII string in that file, |
| 2035 |
for only permanently setting a few options, without using your text editor. |
| 2036 |
Each "set <b>save</b>" command overwrites the previously saved settings. |
| 2037 |
"set <b>load</b>" loads the startup set options file once again, displaying each line before it is processed. |
| 2038 |
If the startup file doesn't exist, or something is wrong, then an error message is |
| 2039 |
displayed and this set command returns with failure. |
| 2040 |
|
| 2041 |
<h3>Options:</h3> |
| 2042 |
<blockquote> |
| 2043 |
<p> |
| 2044 |
"set <b>precision</b>" followed by an integer |
| 2045 |
less than or equal to 15 sets the display precision |
| 2046 |
in number of decimal digits for most numerical output. |
| 2047 |
All arithmetic in Mathomatic is double precision floating point, |
| 2048 |
so it is not useful to set this higher than 15 digits. |
| 2049 |
Display output is rounded to the precision set by this option, |
| 2050 |
though internally all constants are rounded to fit in a double precision float data type |
| 2051 |
of about 15 decimal digits precision. |
| 2052 |
The default for this display "precision" set variable is 14 digits. |
| 2053 |
<p> |
| 2054 |
"set no <b>autosolve</b>" will turn off solving by typing the solve variable at the main prompt, |
| 2055 |
unless an equals sign (=) is included. |
| 2056 |
This allows entry of single variable expressions into equation spaces. |
| 2057 |
Solving is always allowed using the <a href="#solve">solve command</a>. |
| 2058 |
<p> |
| 2059 |
"set no <b>autocalc</b>" will turn off automatic approximation and display |
| 2060 |
with the <a href="#calculate">calculate command</a> of |
| 2061 |
purely numerical input entered at the main prompt. |
| 2062 |
Numerical expressions are simply entered as is when this |
| 2063 |
option is turned off. |
| 2064 |
When <b>autocalc</b> is on, the current calculation is deleted when the next calculation is entered, |
| 2065 |
if "set <b>autodelete</b>" is specified, otherwise it remains in memory for later use. |
| 2066 |
The default is no <b>autodelete</b>, so to be helpful, |
| 2067 |
all old numeric calculations are automatically |
| 2068 |
deleted from memory if memory ever becomes exhausted. |
| 2069 |
Note that the Mathomatic Symbolic Math Library does not support use of the calculate command at this time. |
| 2070 |
<p> |
| 2071 |
"set no <b>autoselect</b>" will turn off selecting of equation spaces by just typing in |
| 2072 |
the equation number. |
| 2073 |
Selecting is still possible using the <a href="#selecting"><b>#</b> operator</a>. |
| 2074 |
<p> |
| 2075 |
"set <b>auto</b>" and "set no <b>auto</b>" turn on and off all three of the above auto options |
| 2076 |
at once. |
| 2077 |
If turned off, all expressions entered at the main prompt will be entered into equation spaces, |
| 2078 |
so they can be operated on by Mathomatic commands. |
| 2079 |
<p> |
| 2080 |
"set <b>debug</b>" followed by an integer sets the debug level number. |
| 2081 |
The initial debug level is 0, for no debugging. |
| 2082 |
If the level number is 2 ("set debug=2"), |
| 2083 |
Mathomatic will show you how it solves equations. |
| 2084 |
Level 4 debugs the <a href="#simplify">simplify</a> |
| 2085 |
command and its polynomial routines. |
| 2086 |
Levels 5 and 6 show all intermediate expressions. |
| 2087 |
Set the debug level to −1 for suppression of helpful messages, |
| 2088 |
or set the debug level to −2 to even suppress warnings. |
| 2089 |
<p> |
| 2090 |
"set <b>case_sensitive</b>" will set alphabetic case sensitive mode, while |
| 2091 |
"set no case" will set case insensitive mode (all alphabetic characters |
| 2092 |
will be converted to lower case). |
| 2093 |
"set case" is the default. |
| 2094 |
<p> |
| 2095 |
"set <b>color</b>" enables color mode, which is the default. |
| 2096 |
When color mode is on, |
| 2097 |
ANSI color escape sequences are output to make expressions easier to read. |
| 2098 |
Requires a terminal emulator that supports ANSI color escape sequences. |
| 2099 |
Enter "set save no color" |
| 2100 |
to always startup Mathomatic with color mode disabled, |
| 2101 |
unless the <b>-c</b> or <b>-b</b> option is given. |
| 2102 |
Use "set color 0" to display normal text as all green, |
| 2103 |
as it was for many years. The default for normal text is no color, |
| 2104 |
but if "color" is followed by a number, the normal text color is set to that number. |
| 2105 |
<p> |
| 2106 |
"set <b>bold</b>" enables highlighting in color mode. |
| 2107 |
It makes all output brighter. |
| 2108 |
Use this if any colors are difficult to see. |
| 2109 |
The <b>-b</b> option also sets this and color mode on. |
| 2110 |
<p> |
| 2111 |
"set <b>html</b>" (same as the <b>-x</b> option) |
| 2112 |
enables HTML mode for all standard output. |
| 2113 |
"set <b>html</b> all" enables HTML mode for all output, even redirected output. |
| 2114 |
HTML mode is very useful by itself, or with color mode. |
| 2115 |
With color mode, ANSI color will be turned off and HTML color will be turned on. |
| 2116 |
Even "bold colors" makes a difference here, allowing easier viewing on a dim background. |
| 2117 |
<p> |
| 2118 |
"set <b>alternative</b>" (same as the <b>-a</b> option) |
| 2119 |
switches color mode to its alternative color mode, if any. |
| 2120 |
So far, only the MinGW version uses this option |
| 2121 |
for switching to ANSI color mode when using Cygwin. |
| 2122 |
<p> |
| 2123 |
"set <b>columns</b>" followed by a positive integer sets the expected number of |
| 2124 |
character columns (width) on a terminal screen with line wrap. |
| 2125 |
When an expression is to be displayed in multi-line fraction format (two-dimensional) |
| 2126 |
and it is wider than this number of screen columns, |
| 2127 |
single-line format is used instead, |
| 2128 |
because otherwise the expression would not display properly due to wrap-around. |
| 2129 |
"set no columns" or "set columns=0" does no checking for screen size and always |
| 2130 |
displays in fraction format, which is useful for a terminal that doesn't wrap lines. |
| 2131 |
In most cases, this value is set automatically to be the correct width on startup, |
| 2132 |
or by typing "set columns". |
| 2133 |
This value only affects 2D expression output. |
| 2134 |
<p> |
| 2135 |
"set <b>wide</b>" sets the number of screen columns |
| 2136 |
(like "set columns=0" above does) and screen rows to 0, |
| 2137 |
so that no checking for screen size is done, |
| 2138 |
forcing 2D display of expressions that are too wide to display properly |
| 2139 |
on a terminal with line wrap. |
| 2140 |
Setting this option is useful if output is going to a file. |
| 2141 |
<p> |
| 2142 |
"set no <b>display2d</b>" will set the expression |
| 2143 |
display mode to single-line format (one-dimensional) |
| 2144 |
using the <a href="#list">list command</a>, |
| 2145 |
instead of the default fraction format (two-dimensional) |
| 2146 |
using the <a href="#display">display command</a>. |
| 2147 |
Single-line format is useful when feeding Mathomatic output into another program. |
| 2148 |
<p> |
| 2149 |
<b>fractions_display_mode</b> is a new set option that allows controlling |
| 2150 |
whether or not to display numerical fractions. |
| 2151 |
It also can set the preference of |
| 2152 |
<a target="_blank" rel="nofollow" href="http://en.wikipedia.org/wiki/Simple_fractions">"simple"</a> or |
| 2153 |
<a target="_blank" rel="nofollow" href="http://en.wikipedia.org/wiki/Mixed_fraction">"mixed" fractions</a>. |
| 2154 |
The Mathomatic default is to display simple fractions. |
| 2155 |
"set no <b>fractions_display</b>" sets the mode to 0, |
| 2156 |
disabling the automatic conversion of |
| 2157 |
non-integer constants like .5 to <b>1/2</b> for display. |
| 2158 |
"set <b>fractions</b>=simple" means display some constants |
| 2159 |
like .5 and 2.25 as their simple fraction equivalents: <b>1/2</b> and <b>9/4</b>. |
| 2160 |
"set <b>fractions</b>=mixed" means display some constants as mixed or simple fractions, |
| 2161 |
for example, <b>9/4</b> is displayed as <b>(2+(1/4))</b>, which is a mixed fraction |
| 2162 |
(also called a mixed number). |
| 2163 |
<p> |
| 2164 |
"set no <b>prompt</b>" turns off Mathomatic prompt output, |
| 2165 |
exactly like the <b>-q</b> (quiet mode) option does. |
| 2166 |
<p> |
| 2167 |
"set <b>rationalize</b>" will set the "rationalize_denominators" option, |
| 2168 |
which attempts to move radicals from the denominator of fractions |
| 2169 |
to the numerator during simplification. This is the default. |
| 2170 |
<p> |
| 2171 |
"set <b>modulus_mode</b>" should be followed by an integer from 0 to 2, or a language name: C, Java, Python, or positive. |
| 2172 |
When a modulus operation (<b>%</b>) is done on two constants: <b>dividend % divisor</b>, |
| 2173 |
mode 0 is a type of remainder modulus, that returns a result that is the same sign as the dividend |
| 2174 |
(same as C and Java's % operator give); |
| 2175 |
mode 1 returns a result that is the same sign as the divisor (same as Python's % operator gives); |
| 2176 |
and mode 2 returns an always positive or zero result. |
| 2177 |
Mode 2 is the default and is 100% mathematically correct and the |
| 2178 |
type of modulus operation that can be generally simplified always and be correct. |
| 2179 |
Other types (modes) of modulus operations will be simplified the same way, |
| 2180 |
and the result will be correct as long as they remain positive or zero. |
| 2181 |
Setting the modulus mode only affects modulus operator (<b>%</b>) numeric calculations. |
| 2182 |
All modulus simplification rules are enabled, regardless of the modulus mode. |
| 2183 |
Modulus simplification for integer modulus expressions is always |
| 2184 |
accomplished by using integer variables |
| 2185 |
(variable names that start with "integer") and constants, and no non-integer division. |
| 2186 |
Modulus simplification with integer variables and expressions |
| 2187 |
will almost always simplify more than with normal variables and non-integer expressions. |
| 2188 |
Most modulus simplification is done by the <a href="#simplify">simplify command</a> only. |
| 2189 |
<p> |
| 2190 |
"set <b>fixed_point</b>" sets finance, fixed point, or integer display. |
| 2191 |
Finance mode (set with no arguments or an argument of "2") |
| 2192 |
displays all constants with 2 digits after the decimal point (for example: "2.00") |
| 2193 |
and negative numbers are always parenthesized (for example: "(−2.00)"). |
| 2194 |
Displayed constants are rounded to the nearest cent, |
| 2195 |
though internally there is no loss of accuracy until more than 15 digits have been used. |
| 2196 |
The number of digits to display after the decimal point may be specified with "set <b>fixed_point</b>=number". |
| 2197 |
This is not truly fixed point arithmetic, it is floating point displayed as fixed point. |
| 2198 |
With double precision floating point, |
| 2199 |
only the most significant 15 decimal digits will ever be correct. |
| 2200 |
"set <b>fixed_point</b>=0" sets rounded, integer-only output, with no decimal points; |
| 2201 |
this might be useful for something. |
| 2202 |
The default is floating point display and no fixed point display ("set no <b>fixed_point</b>"). |
| 2203 |
<p> |
| 2204 |
"set <b>factor_integers</b>" sets automatic factoring of integers for all displayed expressions. |
| 2205 |
When set, all integers of up to 15 decimal digits are factorized into their prime factors before |
| 2206 |
the result of any command is displayed. |
| 2207 |
This command can be shortened to "set factor". |
| 2208 |
<p> |
| 2209 |
"set <b>right_associative_power</b>" associates power operators from right to left |
| 2210 |
in the absence of parentheses, so that <b>x^a^b</b> is interpreted as <b>x^(a^b)</b>. |
| 2211 |
Other math programs typically associate power operators from right to left. |
| 2212 |
The default is "set no right", which associates power operators the same |
| 2213 |
as all other operators in Mathomatic, |
| 2214 |
from left to right, resulting in <b>(x^a)^b</b>. |
| 2215 |
<p> |
| 2216 |
"set <b>plot_prefix</b>" followed by a string of 8-bit characters will |
| 2217 |
prepend the string to the gnuplot plot string, when using the Mathomatic |
| 2218 |
plot command. For example, "set plot set polar\;" typed at the |
| 2219 |
Mathomatic main prompt will allow 2D polar plots |
| 2220 |
with subsequent plot commands, using variable "t" instead of "x". |
| 2221 |
<p> |
| 2222 |
"set <b>special_variable_characters</b>" followed by a string of 8-bit characters will allow Mathomatic |
| 2223 |
to use those characters in variable names, in addition to the normal variable name characters, |
| 2224 |
which are the alphanumeric characters and underline (_). |
| 2225 |
For example, "set special $" will allow variable names like "$a" and "a$", |
| 2226 |
and "set special []" will allow entry of array elements like "a[3]" for simulated array arithmetic. |
| 2227 |
Most non-alphanumeric characters in variable names are converted to underline characters (_) |
| 2228 |
when exporting to a programming language or to a different program. |
| 2229 |
<p> |
| 2230 |
"set <b>directory</b>" followed by a directory name will change the current working directory |
| 2231 |
to that directory. |
| 2232 |
Not specifying a directory name defaults to your home directory. |
| 2233 |
This command can be shortened to "set dir". |
| 2234 |
</blockquote> |
| 2235 |
|
| 2236 |
<br> |
| 2237 |
<br> |
| 2238 |
<hr> |
| 2239 |
<a name="simplify"></a> |
| 2240 |
<h2>Simplify command</h2> |
| 2241 |
<p> |
| 2242 |
Syntax: <b>simplify ["sign"] ["symbolic"] ["quick[est]"] ["fraction"] [equation-number-ranges]</b> |
| 2243 |
<p> |
| 2244 |
This command fully simplifies (reduces) expressions in selected equation spaces. |
| 2245 |
The result is usually the smallest possible, easily readable expression, |
| 2246 |
that is mathematically equivalent to the original expression. |
| 2247 |
<p> |
| 2248 |
Use this command whenever you think an expression is not completely |
| 2249 |
simplified or if you don't like the way an expression is factored. |
| 2250 |
Sometimes simplifying more than once or using the "symbolic" option |
| 2251 |
simplifies even more. |
| 2252 |
This command always tries to factor polynomials, |
| 2253 |
if it will make the expression smaller, |
| 2254 |
unless the "<b>quickest</b>" option is given. |
| 2255 |
<p> |
| 2256 |
More than one option may be specified at a time. |
| 2257 |
|
| 2258 |
<h3>Options:</h3> |
| 2259 |
<blockquote> |
| 2260 |
<p> |
| 2261 |
"simplify <b>sign</b>" conveniently expands all "sign" variables |
| 2262 |
by substituting them with all possible combinations of values (+1 and -1), |
| 2263 |
storing the unique results into new equation spaces and simplifying. |
| 2264 |
This will effectively create one simplified equation for each solution. |
| 2265 |
<p> |
| 2266 |
The "<b>symbolic</b>" option indicates <b>(a^n)^m</b> should always be reduced to <b>a^(n*m)</b>. |
| 2267 |
This often simplifies more and removes any absolute value operations: |
| 2268 |
(<b>(a^2)^.5 = a^(2*.5) = a^1 = a</b>). |
| 2269 |
Try this "symbolic" option if the simplify command doesn't simplify well, |
| 2270 |
it often helps with powers raised to powers, |
| 2271 |
though it is sometimes not 100% mathematically correct. |
| 2272 |
<p> |
| 2273 |
The "<b>quick</b>" option skips expanding sums raised to the power of 2 or higher, like <b>(x+1)^5</b>. |
| 2274 |
Also, algebraic fractions might be simpler with this option, and unlike denominators are not combined at all. |
| 2275 |
This option often simplifies the best, unless expanding sums raised to an integer power is needed. |
| 2276 |
<p> |
| 2277 |
The "<b>quickest</b>" option very basically simplifies without any unfactoring nor factoring. |
| 2278 |
Running the simplify command with this option makes it complete almost instantaneously. |
| 2279 |
<p> |
| 2280 |
"simplify <b>fraction</b>" usually simplifies any expression with |
| 2281 |
division in it down to the ratio of two polynomials |
| 2282 |
or expressions, |
| 2283 |
like <a target="_blank" rel="nofollow" href="http://maxima.sourceforge.net">Maxima's</a> |
| 2284 |
<code>ratsimp()</code> function does, |
| 2285 |
though sometimes the <a href="#fraction">fraction command</a> works better because it always reduces to a simple fraction, |
| 2286 |
the difference here being the simplify command result will be completely simplified. |
| 2287 |
This is accomplished by simplification without doing |
| 2288 |
"<a href="#unfactor">unfactor</a> fraction" and without doing |
| 2289 |
polynomial or smart (algebraic) division on the divide operators. |
| 2290 |
</blockquote> |
| 2291 |
|
| 2292 |
<p> |
| 2293 |
This simplify command applies many algebraic transformations |
| 2294 |
and their inverses (for example, <a href="#unfactor">unfactor</a> and then <a href="#factor">factor</a>) |
| 2295 |
and then tries to combine and reduce algebraic fractions and rationalize their denominators. |
| 2296 |
Complex fractions are converted to simple fractions by |
| 2297 |
making the denominators of fractions added together the same, combining and simplifying. |
| 2298 |
Polynomials with repeated or symbolic factors are factored next. |
| 2299 |
Then smart (heuristic) division and polynomial division are tried on any algebraic divides, |
| 2300 |
possibly making complex fractions if it reduces the expression size. |
| 2301 |
Lastly, the expressions are nicely factored and displayed. |
| 2302 |
<p> |
| 2303 |
Smart division is a symbolic division like polynomial division, |
| 2304 |
but it tries every term in the dividend, |
| 2305 |
instead of only the term with the base variable raised to the highest power, |
| 2306 |
to make the expression smaller. |
| 2307 |
<p> |
| 2308 |
"repeat simplify" repeatedly runs the simplify command until the result stabilizes |
| 2309 |
to the smallest size expression. |
| 2310 |
In other computer algebra systems, this is called full simplification. |
| 2311 |
|
| 2312 |
<br> |
| 2313 |
<br> |
| 2314 |
<hr> |
| 2315 |
<a name="solve"></a> |
| 2316 |
<h2>Solve command</h2> |
| 2317 |
<p> |
| 2318 |
Syntax: <b>solve ["verify" or "verifiable"] [equation-number-range] ["for"] expression</b> |
| 2319 |
<p> |
| 2320 |
This command automatically solves the specified equations |
| 2321 |
for the specified <b>expression</b>, which may be a variable or zero. |
| 2322 |
For each successful solve operation, the equation solved is replaced with the solution, |
| 2323 |
becomes the current equation and is displayed. |
| 2324 |
See the section on <a href="#solving">Solving Equations</a> |
| 2325 |
for more information on solving with Mathomatic. |
| 2326 |
<p> |
| 2327 |
Solving for <b>variable^2</b> or <b>0^2</b> will isolate the square root |
| 2328 |
of the largest expression containing the specified variable, |
| 2329 |
and then square both sides of the equation. |
| 2330 |
This is a new feature for properly squaring, cubing, etc. both sides of an equation, |
| 2331 |
and it works for any power and variable with any equation with roots. |
| 2332 |
<p> |
| 2333 |
The "<b>verify</b>" and "<b>verifiable</b>" options check the result of solving for a variable |
| 2334 |
by plugging all solutions into the original equation and then simplifying and comparing. |
| 2335 |
If the resulting equation sides are identical (an identity), |
| 2336 |
a "Solutions verified" message is displayed, |
| 2337 |
meaning that all of the solutions are correct. |
| 2338 |
Otherwise "Solution may be incorrect" is displayed, meaning at least one of the solutions |
| 2339 |
is incorrect or unverifiable, causing the "verifiable" option to return with failure, |
| 2340 |
and the "verify" option to return with 2. |
| 2341 |
Use the "verifiable" option if verification is required, otherwise use the "verify" option. |
| 2342 |
<p> |
| 2343 |
The verify options work when solving for a single variable, |
| 2344 |
and indicate if the solve result can be trusted. |
| 2345 |
If the verify options are used when solving for zero, they only check if the result |
| 2346 |
of the zero solve is an identity. |
| 2347 |
The "<a href="#simplify">simplify</a> quick" command is automatically |
| 2348 |
used after every successful solve operation when using the verify options. |
| 2349 |
<p> |
| 2350 |
The "<b>for</b>" option has no additional effect |
| 2351 |
and is to make entering this solve command more natural. |
| 2352 |
|
| 2353 |
<br> |
| 2354 |
<br> |
| 2355 |
<hr> |
| 2356 |
<a name="sum"></a> |
| 2357 |
<h2>Sum command</h2> |
| 2358 |
<p> |
| 2359 |
Syntax: <b>sum variable start end [step-size]</b> |
| 2360 |
<br> |
| 2361 |
Alternate syntax: <b>sum variable "=" start "to" end ["step" step-size]</b> |
| 2362 |
<p> |
| 2363 |
This command performs a mathematical summation |
| 2364 |
(<abbr title="Math using this Greek Sigma symbol can be calculated using this sum command.">∑</abbr>) |
| 2365 |
of the current expression |
| 2366 |
or the RHS of the current equation |
| 2367 |
as the index <b>variable</b> goes from <b>start</b> to <b>end</b> |
| 2368 |
in steps of <b>step-size</b> (default 1). |
| 2369 |
The result is approximated/simplified, stored, and displayed. |
| 2370 |
The current equation is not changed. |
| 2371 |
|
| 2372 |
<pre class="sample"> |
| 2373 |
1—> y=a*x |
| 2374 |
|
| 2375 |
#1: y = a*x |
| 2376 |
|
| 2377 |
1—> sum |
| 2378 |
Enter variable: x |
| 2379 |
x = 1 |
| 2380 |
To: 10 |
| 2381 |
|
| 2382 |
#2: y = 55*a |
| 2383 |
|
| 2384 |
1—> |
| 2385 |
</pre> |
| 2386 |
|
| 2387 |
<p> |
| 2388 |
To see all of the intermediate results, |
| 2389 |
type "<a href="#set">set</a> debug 1" before this. |
| 2390 |
|
| 2391 |
<br> |
| 2392 |
<br> |
| 2393 |
<hr> |
| 2394 |
<a name="tally"></a> |
| 2395 |
<h2>Tally command</h2> |
| 2396 |
<p> |
| 2397 |
Syntax: <b>tally ["average"] [equation-number-ranges]</b> |
| 2398 |
<p> |
| 2399 |
This command prompts for a value, adds it to a running (grand) |
| 2400 |
total, approximates/simplifies and displays the running total and optional average, and repeats. |
| 2401 |
The average is the arithmetic mean, that is the running total divided by the number of entries ("count"). |
| 2402 |
When finished, the ending total is returned in the next available equation space, |
| 2403 |
displayed, and made the current equation. |
| 2404 |
<p> |
| 2405 |
It is a convenient way of adding, subtracting, and averaging many numbers and/or variables. |
| 2406 |
Enter a minus sign (−) before each value you wish to subtract. |
| 2407 |
Enter an empty line to end. |
| 2408 |
<p> |
| 2409 |
The grand total may be set at the start by specifying equation spaces on the command-line to add the expressions |
| 2410 |
or Right-Hand Sides contained therein together. |
| 2411 |
Type "tally -" to resume where you left off last time, if the current equation hasn't changed. |
| 2412 |
This works because the final result of the last tally session is saved in the next available equation space |
| 2413 |
and made the current equation. |
| 2414 |
|
| 2415 |
<br> |
| 2416 |
<br> |
| 2417 |
<hr> |
| 2418 |
<a name="taylor"></a> |
| 2419 |
<h2>Taylor command</h2> |
| 2420 |
<p> |
| 2421 |
Syntax: <b>taylor ["nosimplify"] variable order point</b> |
| 2422 |
<p> |
| 2423 |
This command computes the Taylor series expansion of the current |
| 2424 |
expression or RHS of the current equation, with respect to the specified <b>variable</b>. |
| 2425 |
The Taylor series uses <a href="#derivative">differentiation</a> |
| 2426 |
and is often used to approximate expressions near the specified <b>point</b>. |
| 2427 |
<p> |
| 2428 |
The Taylor series of <b>f(x)</b> at <b>point a</b> is the power series: |
| 2429 |
|
| 2430 |
<!-- |
| 2431 |
Enter this into aamath to get the Taylor series looking nice: |
| 2432 |
f(a) + f'(a)*(x-a)/1! + f''(a)*(x-a)^2/2! + f'''(a)*(x-a)^3/3! + … |
| 2433 |
--> |
| 2434 |
<pre class="indent"> |
| 2435 |
2 3 |
| 2436 |
f'(a) (x - a) f''(a) (x - a) f'''(a) (x - a) |
| 2437 |
f(a) + ------------- + --------------- + ---------------- + … |
| 2438 |
1! 2! 3! |
| 2439 |
</pre> |
| 2440 |
|
| 2441 |
<p> |
| 2442 |
where <b>f'(x)</b> is the first derivative of <b>f(x)</b> with respect to <b>x</b>, |
| 2443 |
<b>f''(x)</b> is the second derivative, etc. |
| 2444 |
<p> |
| 2445 |
This command prompts you for the <b>point</b> of expansion, |
| 2446 |
which is usually a variable or 0, but may be any expression. |
| 2447 |
Typically 0 is used to generate Maclaurin polynomials. |
| 2448 |
<p> |
| 2449 |
Then it prompts you for the <b>order</b> |
| 2450 |
of the series, which is an integer indicating how many derivatives to |
| 2451 |
take in the expansion. |
| 2452 |
The default is a large number, |
| 2453 |
stopping when the derivative reaches 0. |
| 2454 |
<p> |
| 2455 |
The result is simplified unless the "nosimplify" option is specified, |
| 2456 |
and placed in the next available |
| 2457 |
equation space, displayed, and becomes the current equation. |
| 2458 |
The original expression is not modified. |
| 2459 |
|
| 2460 |
<pre class="sample"> |
| 2461 |
1—> e^x |
| 2462 |
|
| 2463 |
#1: e^x |
| 2464 |
|
| 2465 |
1—> taylor x |
| 2466 |
Taylor series expansion around x = point. |
| 2467 |
Enter point: 0 |
| 2468 |
Enter order (number of derivatives to take): 8 |
| 2469 |
Computing the Taylor series and simplifying... |
| 2470 |
8 derivatives applied. |
| 2471 |
|
| 2472 |
x^2 x^3 x^4 x^5 x^6 x^7 x^8 |
| 2473 |
#2: 1 + x + ––– + ––– + ––– + ––– + ––– + –––– + ––––– |
| 2474 |
2 6 24 120 720 5040 40320 |
| 2475 |
|
| 2476 |
2—> |
| 2477 |
</pre> |
| 2478 |
|
| 2479 |
<br> |
| 2480 |
<br> |
| 2481 |
<hr> |
| 2482 |
<a name="unfactor"></a> |
| 2483 |
<h2>Unfactor command</h2> |
| 2484 |
<p> |
| 2485 |
Syntax: <b>unfactor ["count"] ["fraction"] ["quick"] ["power"] [equation-number-range]</b> |
| 2486 |
<br> |
| 2487 |
Alternate command name: <b>expand</b> |
| 2488 |
<p> |
| 2489 |
This command algebraically expands expressions in selected equation spaces by |
| 2490 |
multiplying out products of sums and exponentiated sums and then simplifying a little, |
| 2491 |
displaying the results. |
| 2492 |
One or more options may be specified, like "count", which also displays the number of additive terms. |
| 2493 |
<p> |
| 2494 |
To illustrate what unfactoring does (more often known as "expanding"), |
| 2495 |
suppose you have the following equations: |
| 2496 |
|
| 2497 |
<pre class="sample"> |
| 2498 |
1—> a=b*(c+d) |
| 2499 |
|
| 2500 |
#1: a = b*(c + d) |
| 2501 |
|
| 2502 |
1—> z=(x+y)^2 |
| 2503 |
|
| 2504 |
#2: z = (x + y)^2 |
| 2505 |
|
| 2506 |
2—> unfactor all |
| 2507 |
|
| 2508 |
#1: a = (b*c) + (b*d) |
| 2509 |
|
| 2510 |
|
| 2511 |
#2: z = (x^2) + (2*x*y) + (y^2) |
| 2512 |
|
| 2513 |
2—> |
| 2514 |
</pre> |
| 2515 |
|
| 2516 |
<p> |
| 2517 |
<b>(x+y)^2</b> is called an exponentiated sum and |
| 2518 |
is converted to <b>(x+y)*(x+y)</b> and then multiplied out, |
| 2519 |
unless the "<b>quick</b>" option is given. |
| 2520 |
Because this is a general but inefficient expansion method, |
| 2521 |
exponentiated sums usually fail expansion when the power is greater than 10, |
| 2522 |
growing larger than will fit in an equation space. |
| 2523 |
It is also CPU time-consuming, so |
| 2524 |
"unfactor <b>quick</b>" and |
| 2525 |
"<a href="#simplify">simplify</a> <b>quick</b>" were created to only expand products of sums, |
| 2526 |
and not exponentiated sums. |
| 2527 |
<p> |
| 2528 |
The opposite of unfactoring is <a href="#factor">factoring</a>. |
| 2529 |
Careful and neat factoring is always done by the <a href="#simplify">simplify command</a>. |
| 2530 |
<p> |
| 2531 |
"unfactor <b>fraction</b>" by itself expands algebraic fractions by also |
| 2532 |
expanding division of sums, |
| 2533 |
multiplying out each fraction with a sum in the numerator into the sum of |
| 2534 |
smaller fractions with the same denominator for each term in numerator. |
| 2535 |
See the example under the <a href="#fraction">fraction command</a>. |
| 2536 |
<p> |
| 2537 |
"unfactor <b>power</b>" does only power operator expansion; |
| 2538 |
that is, <b>(a*b)^(n+m)</b> |
| 2539 |
is transformed to <b>(a^n)*(a^m)*(b^n)*(b^m)</b>. |
| 2540 |
|
| 2541 |
<br> |
| 2542 |
<br> |
| 2543 |
<hr> |
| 2544 |
<a name="variables"></a> |
| 2545 |
<h2>Variables command</h2> |
| 2546 |
<p> |
| 2547 |
Syntax: <b>variables ["c" "java" "integer" "count"] [equation-number-ranges]</b> |
| 2548 |
<p> |
| 2549 |
Show or define all variable names used within the specified expressions, |
| 2550 |
from most frequent to least frequently occurring. |
| 2551 |
The programming language options output the variable definitions |
| 2552 |
required to make <a href="#code">code</a> from the specified equations. |
| 2553 |
This does not initialize any variables, it only defines them as needed for a C or Java compiler. |
| 2554 |
This command is not necessary for generating Python code. |
| 2555 |
<p> |
| 2556 |
The "count" option displays the total counts of each variable in a comment, for the specified expressions. |
| 2557 |
The count means the number of times the variable occurs. |
| 2558 |
<p> |
| 2559 |
This command returns false, with failure and an error message, |
| 2560 |
if no variables were found. |
| 2561 |
This may be useful for determining whether an expression is numeric or symbolic. |
| 2562 |
|
| 2563 |
<br> |
| 2564 |
<br> |
| 2565 |
<hr> |
| 2566 |
<a name="version"></a> |
| 2567 |
<h2>Version command</h2> |
| 2568 |
<p> |
| 2569 |
Syntax: <b>version ["status"]</b> |
| 2570 |
<p> |
| 2571 |
Shows the version number of Mathomatic. |
| 2572 |
<p> |
| 2573 |
If the "status" option is given, also displays the |
| 2574 |
last main prompt return value, |
| 2575 |
the C compile-time definitions used |
| 2576 |
and other useful C compiler information, |
| 2577 |
the expression array size, |
| 2578 |
the maximum possible memory usage, |
| 2579 |
the invoked security level, |
| 2580 |
and readline status |
| 2581 |
for the currently running version of Mathomatic. |
| 2582 |
<p> |
| 2583 |
The maximum memory usage displayed is the amount of |
| 2584 |
RAM used when all equation spaces have been filled. |
| 2585 |
It does not include stack size (which varies) or executable (code) size. |
| 2586 |
The Unix/Linux "size" command gives all the other sizes when run as "size mathomatic", like "text" |
| 2587 |
size, which is really code size. Adding together all size values will probably give |
| 2588 |
a close approximation of the total amount of free RAM required by Mathomatic. |
| 2589 |
Define "HANDHELD=1" when compiling to reduce this. |
| 2590 |
|
| 2591 |
<br> |
| 2592 |
<br> |
| 2593 |
<hr> |
| 2594 |
|
| 2595 |
<a name="license"></a> |
| 2596 |
<h2>Documentation License</h2> |
| 2597 |
<p> |
| 2598 |
<a target="_blank" rel="nofollow" href="http://www.gnu.org/copyleft/fdl.html"><img src="gnu-fdl.png" alt="GFDL logo"></a> |
| 2599 |
<font color="red">Mathomatic documentation copyright © 1987-2012 George Gesslein II</font> |
| 2600 |
<p> |
| 2601 |
Permission is granted to copy, distribute and/or modify this document |
| 2602 |
under the terms of the GNU Free Documentation License, Version 1.3 |
| 2603 |
or any later version published by the Free Software Foundation; |
| 2604 |
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. |
| 2605 |
A copy of the license is included <a href="fdl-1.3-standalone.html">here</a> |
| 2606 |
in the Mathomatic documentation directory. |
| 2607 |
|
| 2608 |
<br> |
| 2609 |
<br> |
| 2610 |
<hr> |
| 2611 |
<a class="left" href="index.html">Up to the documentation index</a> |
| 2612 |
<a class="right" href="http://www.mathomatic.org" title="Go to the Mathomatic home page"><img src="mathomatic16x16.png" alt="Mathomatic icon"> www.mathomatic.org</a> |
| 2613 |
|
| 2614 |
</body> |
| 2615 |
</html> |