1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!-- Created on September, 20 2006 by texi2html 1.76 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
Karl Berry <karl@freefriends.org>
Olaf Bachmann <obachman@mathematik.uni-kl.de>
and many others.
Maintained by: Many creative people <dev@texi2html.cvshome.org>
Send bugs and suggestions to <users@texi2html.cvshome.org>
-->
<head>
<title>Maxima Manual: 23. Numerical</title>
<meta name="description" content="Maxima Manual: 23. Numerical">
<meta name="keywords" content="Maxima Manual: 23. Numerical">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 1.76">
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
pre.display {font-family: serif}
pre.format {font-family: serif}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: serif; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: serif; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.sansserif {font-family:sans-serif; font-weight:normal;}
ul.toc {list-style: none}
body
{
color: black;
background: white;
margin-left: 8%;
margin-right: 13%;
}
h1
{
margin-left: +8%;
font-size: 150%;
font-family: sans-serif
}
h2
{
font-size: 125%;
font-family: sans-serif
}
h3
{
font-size: 100%;
font-family: sans-serif
}
h2,h3,h4,h5,h6 { margin-left: +4%; }
div.textbox
{
border: solid;
border-width: thin;
/* width: 100%; */
padding-top: 1em;
padding-bottom: 1em;
padding-left: 2em;
padding-right: 2em
}
div.titlebox
{
border: none;
padding-top: 1em;
padding-bottom: 1em;
padding-left: 2em;
padding-right: 2em;
background: rgb(200,255,255);
font-family: sans-serif
}
div.synopsisbox
{
border: none;
padding-top: 1em;
padding-bottom: 1em;
padding-left: 2em;
padding-right: 2em;
background: rgb(255,220,255);
/*background: rgb(200,255,255); */
/* font-family: fixed */
}
pre.example
{
border: none;
padding-top: 1em;
padding-bottom: 1em;
padding-left: 1em;
padding-right: 1em;
background: rgb(247,242,180); /* kind of sandy */
/* background: rgb(200,255,255); */ /* sky blue */
font-family: "Lucida Console", monospace
}
div.spacerbox
{
border: none;
padding-top: 2em;
padding-bottom: 2em
}
div.image
{
margin: 0;
padding: 1em;
text-align: center;
}
-->
</style>
<link rel="icon" href="http://maxima.sourceforge.net/favicon.ico"/>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Numerical"></a>
<a name="SEC76"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="maxima_22.html#SEC75" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC77" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima_22.html#SEC74" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_24.html#SEC81" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_72.html#SEC264" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h1 class="chapter"> 23. Numerical </h1>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#SEC77">23.1 Introduction to Numerical</a></td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#SEC78">23.2 Fourier packages</a></td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#SEC79">23.3 Definitions for Numerical</a></td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#SEC80">23.4 Definitions for Fourier Series</a></td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr size="6">
<a name="Introduction-to-Numerical"></a>
<a name="SEC77"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC76" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC78" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC76" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC76" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_24.html#SEC81" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_72.html#SEC264" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section"> 23.1 Introduction to Numerical </h2>
<hr size="6">
<a name="Fourier-packages"></a>
<a name="SEC78"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC77" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC79" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC76" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC76" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_24.html#SEC81" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_72.html#SEC264" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section"> 23.2 Fourier packages </h2>
<p>The <code>fft</code> package comprises functions for the numerical (not symbolic) computation
of the fast Fourier transform.
<code>load ("fft")</code> loads this package.
See <code>fft</code>.
</p>
<p>The <code>fourie</code> package comprises functions for the symbolic computation
of Fourier series.
<code>load ("fourie")</code> loads this package.
There are functions in the <code>fourie</code> package to calculate Fourier integral
coefficients and some functions for manipulation of expressions.
See <code>Definitions for Fourier Series</code>.
</p>
<hr size="6">
<a name="Definitions-for-Numerical"></a>
<a name="SEC79"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC78" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#SEC80" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC76" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC76" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_24.html#SEC81" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_72.html#SEC264" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section"> 23.3 Definitions for Numerical </h2>
<dl>
<dt><u>Function:</u> <b>polartorect</b><i> (<var>magnitude_array</var>, <var>phase_array</var>)</i>
<a name="IDX698"></a>
</dt>
<dd><p>Translates complex values of the form <code>r %e^(%i t)</code> to the form <code>a + b %i</code>.
<code>load ("fft")</code> loads this function into Maxima. See also <code>fft</code>.
</p>
<p>The magnitude and phase, <code>r</code> and <code>t</code>, are taken from <var>magnitude_array</var> and
<var>phase_array</var>, respectively. The original values of the input arrays are
replaced by the real and imaginary parts, <code>a</code> and <code>b</code>, on return. The outputs are
calculated as
</p>
<table><tr><td> </td><td><pre class="example">a: r cos (t)
b: r sin (t)
</pre></td></tr></table>
<p>The input arrays must be the same size and 1-dimensional.
The array size need not be a power of 2.
</p>
<p><code>polartorect</code> is the inverse function of <code>recttopolar</code>.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>recttopolar</b><i> (<var>real_array</var>, <var>imaginary_array</var>)</i>
<a name="IDX699"></a>
</dt>
<dd><p>Translates complex values of the form <code>a + b %i</code> to the form <code>r %e^(%i t)</code>.
<code>load ("fft")</code> loads this function into Maxima. See also <code>fft</code>.
</p>
<p>The real and imaginary parts, <code>a</code> and <code>b</code>, are taken from <var>real_array</var> and
<var>imaginary_array</var>, respectively. The original values of the input arrays
are replaced by the magnitude and angle, <code>r</code> and <code>t</code>, on return. The outputs are
calculated as
</p>
<table><tr><td> </td><td><pre class="example">r: sqrt (a^2 + b^2)
t: atan2 (b, a)
</pre></td></tr></table>
<p>The computed angle is in the range <code>-%pi</code> to <code>%pi</code>.
</p>
<p>The input arrays must be the same size and 1-dimensional.
The array size need not be a power of 2.
</p>
<p><code>recttopolar</code> is the inverse function of <code>polartorect</code>.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>ift</b><i> (<var>real_array</var>, <var>imaginary_array</var>)</i>
<a name="IDX700"></a>
</dt>
<dd><p>Fast inverse discrete Fourier transform. <code>load ("fft")</code> loads this function
into Maxima.
</p>
<p><code>ift</code> carries out the inverse complex fast Fourier transform on
1-dimensional floating point arrays. The inverse transform is defined as
</p>
<table><tr><td> </td><td><pre class="example">x[j]: sum (y[j] exp (+2 %i %pi j k / n), k, 0, n-1)
</pre></td></tr></table>
<p>See <code>fft</code> for more details.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>fft</b><i> (<var>real_array</var>, <var>imaginary_array</var>)</i>
<a name="IDX701"></a>
</dt>
<dt><u>Function:</u> <b>ift</b><i> (<var>real_array</var>, <var>imaginary_array</var>)</i>
<a name="IDX702"></a>
</dt>
<dt><u>Function:</u> <b>recttopolar</b><i> (<var>real_array</var>, <var>imaginary_array</var>)</i>
<a name="IDX703"></a>
</dt>
<dt><u>Function:</u> <b>polartorect</b><i> (<var>magnitude_array</var>, <var>phase_array</var>)</i>
<a name="IDX704"></a>
</dt>
<dd><p>Fast Fourier transform and related functions. <code>load ("fft")</code>
loads these functions into Maxima.
</p>
<p><code>fft</code> and <code>ift</code> carry out the complex fast Fourier transform and
inverse transform, respectively, on 1-dimensional floating
point arrays. The size of <var>imaginary_array</var> must equal the size of <var>real_array</var>.
</p>
<p><code>fft</code> and <code>ift</code> operate in-place. That is, on return from <code>fft</code> or <code>ift</code>,
the original content of the input arrays is replaced by the output.
The <code>fillarray</code> function can make a copy of an array, should it
be necessary.
</p>
<p>The discrete Fourier transform and inverse transform are defined
as follows. Let <code>x</code> be the original data, with
</p>
<table><tr><td> </td><td><pre class="example">x[i]: real_array[i] + %i imaginary_array[i]
</pre></td></tr></table>
<p>Let <code>y</code> be the transformed data. The forward and inverse transforms are
</p>
<table><tr><td> </td><td><pre class="example">y[k]: (1/n) sum (x[j] exp (-2 %i %pi j k / n), j, 0, n-1)
x[j]: sum (y[j] exp (+2 %i %pi j k / n), k, 0, n-1)
</pre></td></tr></table>
<p>Suitable arrays can be allocated by the <code>array</code> function. For example:
</p>
<table><tr><td> </td><td><pre class="example">array (my_array, float, n-1)$
</pre></td></tr></table>
<p>declares a 1-dimensional array with n elements, indexed from 0 through
n-1 inclusive. The number of elements n must be equal to 2^m for some m.
</p>
<p><code>fft</code> can be applied to real data (imaginary array all zeros) to obtain
sine and cosine coefficients. After calling <code>fft</code>, the sine and cosine
coefficients, say <code>a</code> and <code>b</code>, can be calculated as
</p>
<table><tr><td> </td><td><pre class="example">a[0]: real_array[0]
b[0]: 0
</pre></td></tr></table>
<p>and
</p>
<table><tr><td> </td><td><pre class="example">a[j]: real_array[j] + real_array[n-j]
b[j]: imaginary_array[j] - imaginary_array[n-j]
</pre></td></tr></table>
<p>for j equal to 1 through n/2-1, and
</p>
<table><tr><td> </td><td><pre class="example">a[n/2]: real_array[n/2]
b[n/2]: 0
</pre></td></tr></table>
<p><code>recttopolar</code> translates complex values of the form <code>a + b %i</code> to
the form <code>r %e^(%i t)</code>. See <code>recttopolar</code>.
</p>
<p><code>polartorect</code> translates complex values of the form <code>r %e^(%i t)</code>
to the form <code>a + b %i</code>. See <code>polartorect</code>.
</p>
<p><code>demo ("fft")</code> displays a demonstration of the <code>fft</code> package.
</p>
</dd></dl>
<dl>
<dt><u>Option variable:</u> <b>fortindent</b>
<a name="IDX705"></a>
</dt>
<dd><p>Default value: 0
</p>
<p><code>fortindent</code> controls the left margin indentation of
expressions printed out by the <code>fortran</code> command. 0 gives normal
printout (i.e., 6 spaces), and positive values will causes the
expressions to be printed farther to the right.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>fortran</b><i> (<var>expr</var>)</i>
<a name="IDX706"></a>
</dt>
<dd><p>Prints <var>expr</var> as a Fortran statement.
The output line is indented with spaces.
If the line is too long, <code>fortran</code> prints continuation lines.
<code>fortran</code> prints the exponentiation operator <code>^</code> as <code>**</code>,
and prints a complex number <code>a + b %i</code> in the form <code>(a,b)</code>.
</p>
<p><var>expr</var> may be an equation. If so, <code>fortran</code> prints an assignment
statement, assigning the right-hand side of the equation to the left-hand side.
In particular, if the right-hand side of <var>expr</var> is the name of a matrix,
then <code>fortran</code> prints an assignment statement for each element of the matrix.
</p>
<p>If <var>expr</var> is not something recognized by <code>fortran</code>,
the expression is printed in <code>grind</code> format without complaint.
<code>fortran</code> does not know about lists, arrays, or functions.
</p>
<p><code>fortindent</code> controls the left margin of the printed lines.
0 is the normal margin (i.e., indented 6 spaces). Increasing <code>fortindent</code>
causes expressions to be printed further to the right.
</p>
<p>When <code>fortspaces</code> is <code>true</code>, <code>fortran</code> fills out
each printed line with spaces to 80 columns.
</p>
<p><code>fortran</code> evaluates its arguments;
quoting an argument defeats evaluation.
<code>fortran</code> always returns <code>done</code>.
</p>
<p>Examples:
</p>
<table><tr><td> </td><td><pre class="example">(%i1) expr: (a + b)^12$
(%i2) fortran (expr);
(b+a)**12
(%o2) done
(%i3) fortran ('x=expr);
x = (b+a)**12
(%o3) done
(%i4) fortran ('x=expand (expr));
x = b**12+12*a*b**11+66*a**2*b**10+220*a**3*b**9+495*a**4*b**8+792
1 *a**5*b**7+924*a**6*b**6+792*a**7*b**5+495*a**8*b**4+220*a**9*b
2 **3+66*a**10*b**2+12*a**11*b+a**12
(%o4) done
(%i5) fortran ('x=7+5*%i);
x = (7,5)
(%o5) done
(%i6) fortran ('x=[1,2,3,4]);
x = [1,2,3,4]
(%o6) done
(%i7) f(x) := x^2$
(%i8) fortran (f);
f
(%o8) done
</pre></td></tr></table>
</dd></dl>
<dl>
<dt><u>Option variable:</u> <b>fortspaces</b>
<a name="IDX707"></a>
</dt>
<dd><p>Default value: <code>false</code>
</p>
<p>When <code>fortspaces</code> is <code>true</code>, <code>fortran</code> fills out
each printed line with spaces to 80 columns.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>horner</b><i> (<var>expr</var>, <var>x</var>)</i>
<a name="IDX708"></a>
</dt>
<dt><u>Function:</u> <b>horner</b><i> (<var>expr</var>)</i>
<a name="IDX709"></a>
</dt>
<dd><p>Returns a rearranged representation of <var>expr</var> as
in Horner's rule, using <var>x</var> as the main variable if it is specified.
<code>x</code> may be omitted in which case the main variable of the canonical rational expression
form of <var>expr</var> is used.
</p>
<p><code>horner</code> sometimes improves stability if <code>expr</code> is
to be numerically evaluated. It is also useful if Maxima is used to
generate programs to be run in Fortran. See also <code>stringout</code>.
</p>
<table><tr><td> </td><td><pre class="example">(%i1) expr: 1e-155*x^2 - 5.5*x + 5.2e155;
2
(%o1) 1.0E-155 x - 5.5 x + 5.2E+155
(%i2) expr2: horner (%, x), keepfloat: true;
(%o2) (1.0E-155 x - 5.5) x + 5.2E+155
(%i3) ev (expr, x=1e155);
Maxima encountered a Lisp error:
floating point overflow
Automatically continuing.
To reenable the Lisp debugger set *debugger-hook* to nil.
(%i4) ev (expr2, x=1e155);
(%o4) 7.0E+154
</pre></td></tr></table>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>find_root</b><i> (<var>f</var>(<var>x</var>), <var>x</var>, <var>a</var>, <var>b</var>)</i>
<a name="IDX710"></a>
</dt>
<dt><u>Function:</u> <b>find_root</b><i> (<var>f</var>, <var>a</var>, <var>b</var>)</i>
<a name="IDX711"></a>
</dt>
<dd><p>Finds the zero of function <var>f</var> as variable <var>x</var> varies over the range <code>[<var>a</var>, <var>b</var>]</code>.
The function must have a
different sign at each endpoint. If this condition is not met, the
action of the function is governed by <code>find_root_error</code>. If
<code>find_root_error</code> is <code>true</code> then an error occurs, otherwise the value of
<code>find_root_error</code> is returned (thus for plotting <code>find_root_error</code> might be set to
0.0). Otherwise (given that Maxima can evaluate the first argument
in the specified range, and that it is continuous) <code>find_root</code> is
guaranteed to come up with the zero (or one of them if there is more
than one zero). The accuracy of <code>find_root</code> is governed by
<code>find_root_abs</code> and <code>find_root_rel</code> which must be non-negative floating
point numbers. <code>find_root</code> will stop when the first arg evaluates to
something less than or equal to <code>find_root_abs</code> or if successive
approximants to the root differ by no more than <code>find_root_rel * <one of the approximants></code>.
The default values of <code>find_root_abs</code> and <code>find_root_rel</code> are
0.0 so <code>find_root</code> gets as good an answer as is possible with the
single precision arithmetic we have. The first arg may be an
equation. The order of the last two args is irrelevant. Thus
</p>
<table><tr><td> </td><td><pre class="example">find_root (sin(x) = x/2, x, %pi, 0.1);
</pre></td></tr></table>
<p>is equivalent to
</p>
<table><tr><td> </td><td><pre class="example">find_root (sin(x) = x/2, x, 0.1, %pi);
</pre></td></tr></table>
<p>The method used is a binary search in the range specified by the last
two args. When it thinks the function is close enough to being
linear, it starts using linear interpolation.
</p>
<p>Examples:
</p>
<table><tr><td> </td><td><pre class="example">(%i1) f(x) := sin(x) - x/2;
x
(%o1) f(x) := sin(x) - -
2
(%i2) find_root (sin(x) - x/2, x, 0.1, %pi);
(%o2) 1.895494267033981
(%i3) find_root (sin(x) = x/2, x, 0.1, %pi);
(%o3) 1.895494267033981
(%i4) find_root (f(x), x, 0.1, %pi);
(%o4) 1.895494267033981
(%i5) find_root (f, 0.1, %pi);
(%o5) 1.895494267033981
</pre></td></tr></table>
</dd></dl>
<dl>
<dt><u>Option variable:</u> <b>find_root_abs</b>
<a name="IDX712"></a>
</dt>
<dd><p>Default value: 0.0
</p>
<p><code>find_root_abs</code> is the accuracy of the <code>find_root</code> command is
governed by <code>find_root_abs</code> and <code>find_root_rel</code> which must be
non-negative floating point numbers. <code>find_root</code> will stop when the
first arg evaluates to something less than or equal to <code>find_root_abs</code> or if
successive approximants to the root differ by no more than <code>find_root_rel * <one of the approximants></code>.
The default values of <code>find_root_abs</code> and
<code>find_root_rel</code> are 0.0 so <code>find_root</code> gets as good an answer as is possible
with the single precision arithmetic we have.
</p>
</dd></dl>
<dl>
<dt><u>Option variable:</u> <b>find_root_error</b>
<a name="IDX713"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p><code>find_root_error</code> governs the behavior of <code>find_root</code>.
When <code>find_root</code> is called, it determines whether or not the function
to be solved satisfies the condition that the values of the
function at the endpoints of the interpolation interval are opposite
in sign. If they are of opposite sign, the interpolation proceeds.
If they are of like sign, and <code>find_root_error</code> is <code>true</code>, then an error is
signaled. If they are of like sign and <code>find_root_error</code> is not <code>true</code>, the
value of <code>find_root_error</code> is returned. Thus for plotting, <code>find_root_error</code>
might be set to 0.0.
</p>
</dd></dl>
<dl>
<dt><u>Option variable:</u> <b>find_root_rel</b>
<a name="IDX714"></a>
</dt>
<dd><p>Default value: 0.0
</p>
<p><code>find_root_rel</code> is the accuracy of the <code>find_root</code> command is
governed by <code>find_root_abs</code> and <code>find_root_rel</code> which must be
non-negative floating point numbers. <code>find_root</code> will stop when the
first arg evaluates to something less than or equal to <code>find_root_abs</code> or if
successive approximants to the root differ by no more than <code>find_root_rel * <one of the approximants></code>.
The default values of <code>find_root_abs</code> and
<code>find_root_rel</code> are 0.0 so <code>find_root</code> gets as good an answer as is possible
with the single precision arithmetic we have.
</p>
</dd></dl>
<hr size="6">
<a name="Definitions-for-Fourier-Series"></a>
<a name="SEC80"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC79" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="maxima_24.html#SEC81" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#SEC76" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#SEC76" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="maxima_24.html#SEC81" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_72.html#SEC264" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section"> 23.4 Definitions for Fourier Series </h2>
<dl>
<dt><u>Function:</u> <b>equalp</b><i> (<var>x</var>, <var>y</var>)</i>
<a name="IDX715"></a>
</dt>
<dd><p>Returns <code>true</code> if <code>equal (<var>x</var>, <var>y</var>)</code> otherwise <code>false</code> (doesn't give an
error message like <code>equal (x, y)</code> would do in this case).
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>remfun</b><i> (<var>f</var>, <var>expr</var>)</i>
<a name="IDX716"></a>
</dt>
<dt><u>Function:</u> <b>remfun</b><i> (<var>f</var>, <var>expr</var>, <var>x</var>)</i>
<a name="IDX717"></a>
</dt>
<dd><p><code>remfun (<var>f</var>, <var>expr</var>)</code>
replaces all occurrences of <code><var>f</var> (<var>arg</var>)</code> by <var>arg</var> in <var>expr</var>.
</p>
<p><code>remfun (<var>f</var>, <var>expr</var>, <var>x</var>)</code>
replaces all occurrences of <code><var>f</var> (<var>arg</var>)</code> by <var>arg</var> in <var>expr</var>
only if <var>arg</var> contains the variable <var>x</var>.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>funp</b><i> (<var>f</var>, <var>expr</var>)</i>
<a name="IDX718"></a>
</dt>
<dt><u>Function:</u> <b>funp</b><i> (<var>f</var>, <var>expr</var>, <var>x</var>)</i>
<a name="IDX719"></a>
</dt>
<dd><p><code>funp (<var>f</var>, <var>expr</var>)</code>
returns <code>true</code> if <var>expr</var> contains the function <var>f</var>.
</p>
<p><code>funp (<var>f</var>, <var>expr</var>, <var>x</var>)</code>
returns <code>true</code> if <var>expr</var> contains the function <var>f</var> and the variable
<var>x</var> is somewhere in the argument of one of the instances of <var>f</var>.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>absint</b><i> (<var>f</var>, <var>x</var>, <var>halfplane</var>)</i>
<a name="IDX720"></a>
</dt>
<dt><u>Function:</u> <b>absint</b><i> (<var>f</var>, <var>x</var>)</i>
<a name="IDX721"></a>
</dt>
<dt><u>Function:</u> <b>absint</b><i> (<var>f</var>, <var>x</var>, <var>a</var>, <var>b</var>)</i>
<a name="IDX722"></a>
</dt>
<dd><p><code>absint (<var>f</var>, <var>x</var>, <var>halfplane</var>)</code>
returns the indefinite integral of <var>f</var> with respect to
<var>x</var> in the given halfplane (<code>pos</code>, <code>neg</code>, or <code>both</code>).
<var>f</var> may contain expressions of the form
<code>abs (x)</code>, <code>abs (sin (x))</code>, <code>abs (a) * exp (-abs (b) * abs (x))</code>.
</p>
<p><code>absint (<var>f</var>, <var>x</var>)</code> is equivalent to <code>absint (<var>f</var>, <var>x</var>, pos)</code>.
</p>
<p><code>absint (<var>f</var>, <var>x</var>, <var>a</var>, <var>b</var>)</code>
returns the definite integral of <var>f</var> with respect to <var>x</var> from <var>a</var> to <var>b</var>.
<var>f</var> may include absolute values.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>fourier</b><i> (<var>f</var>, <var>x</var>, <var>p</var>)</i>
<a name="IDX723"></a>
</dt>
<dd><p>Returns a list of the Fourier coefficients of <code><var>f</var>(<var>x</var>)</code> defined
on the interval <code>[-%pi, %pi]</code>.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>foursimp</b><i> (<var>l</var>)</i>
<a name="IDX724"></a>
</dt>
<dd><p>Simplifies <code>sin (n %pi)</code> to 0 if <code>sinnpiflag</code> is <code>true</code> and
<code>cos (n %pi)</code> to <code>(-1)^n</code> if <code>cosnpiflag</code> is <code>true</code>.
</p>
</dd></dl>
<dl>
<dt><u>Option variable:</u> <b>sinnpiflag</b>
<a name="IDX725"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>See <code>foursimp</code>.
</p>
</dd></dl>
<dl>
<dt><u>Option variable:</u> <b>cosnpiflag</b>
<a name="IDX726"></a>
</dt>
<dd><p>Default value: <code>true</code>
</p>
<p>See <code>foursimp</code>.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>fourexpand</b><i> (<var>l</var>, <var>x</var>, <var>p</var>, <var>limit</var>)</i>
<a name="IDX727"></a>
</dt>
<dd><p>Constructs and returns the Fourier series from the list of
Fourier coefficients <var>l</var> up through <var>limit</var> terms (<var>limit</var>
may be <code>inf</code>). <var>x</var> and <var>p</var> have same meaning as in
<code>fourier</code>.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>fourcos</b><i> (<var>f</var>, <var>x</var>, <var>p</var>)</i>
<a name="IDX728"></a>
</dt>
<dd><p>Returns the Fourier cosine coefficients for <code><var>f</var>(<var>x</var>)</code> defined on <code>[0, %pi]</code>.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>foursin</b><i> (<var>f</var>, <var>x</var>, <var>p</var>)</i>
<a name="IDX729"></a>
</dt>
<dd><p>Returns the Fourier sine coefficients for <code><var>f</var>(<var>x</var>)</code> defined on <code>[0, %pi]</code>.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>totalfourier</b><i> (<var>f</var>, <var>x</var>, <var>p</var>)</i>
<a name="IDX730"></a>
</dt>
<dd><p>Returns <code>fourexpand (foursimp (fourier (<var>f</var>, <var>x</var>, <var>p</var>)), <var>x</var>, <var>p</var>, 'inf)</code>.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>fourint</b><i> (<var>f</var>, <var>x</var>)</i>
<a name="IDX731"></a>
</dt>
<dd><p>Constructs and returns a list of the Fourier integral coefficients of <code><var>f</var>(<var>x</var>)</code>
defined on <code>[minf, inf]</code>.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>fourintcos</b><i> (<var>f</var>, <var>x</var>)</i>
<a name="IDX732"></a>
</dt>
<dd><p>Returns the Fourier cosine integral coefficients for <code><var>f</var>(<var>x</var>)</code> on <code>[0, inf]</code>.
</p>
</dd></dl>
<dl>
<dt><u>Function:</u> <b>fourintsin</b><i> (<var>f</var>, <var>x</var>)</i>
<a name="IDX733"></a>
</dt>
<dd><p>Returns the Fourier sine integral coefficients for <code><var>f</var>(<var>x</var>)</code> on <code>[0, inf]</code>.
</p>
</dd></dl>
<hr size="6">
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#SEC76" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="maxima_24.html#SEC81" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="maxima.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="maxima_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="maxima_72.html#SEC264" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="maxima_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<p>
<font size="-1">
This document was generated by <em>Robert Dodier</em> on <em>September, 20 2006</em> using <a href="http://texi2html.cvshome.org/"><em>texi2html 1.76</em></a>.
</font>
<br>
</p>
</body>
</html>
|