Page 810 - Advanced_Engineering_Mathematics o'neil
P. 810

790    APPENDIX A A MAPLE Primer

                                 This will return the decimal 26.82836630. As another example,
                                                         evalf(cos(3) + sin(3));
                                 will return the decimal value -.8488724885 of cos(3) + sin(3).
                                    To solve an algebraic equation, use the solve command. For example,
                                                                        ∗
                                                        solve(x∧2+2 x - 1=0,x);
                                                      √          √
                                                                       2
                                 will return the roots −1 +  2 and −1 −  2of x + 2x − 1 = 0. This solve command includes
                                 a designation of x as the variable for which to solve—an essential piece of information for the
                                 program. Of course, other symbols than x can be used in the equation and the instruction. For
                                 the solutions in decimal form, use
                                                    evalf(solve(x∧2+2 x - 1=0,x);
                                                                           ∗
                                 which will return the decimal values 0.414213562 and −2.414213562 of these roots. As another
                                 example, enter
                                                    evalf(solve(cos(t) - t = 0,t));
                                 to obtain the approximate solution 0.7390851332 of cos(t) − t = 0.
                                    To solve a system of equations, enter the system in curly brackets in the solve command. For
                                 example,
                                                                        ∗
                                               solve({x - 2 * y=4,5 x + y = -3},{x,y});
                                 gives the solution x =−2/11, y =−23/11. Again, note the designation of x and y as the variables
                                 for which solutions are wanted.
                                    In order to define a function, say f (x) = x sin(5x) − 3x, enter
                                                                  ∗
                                                                                 ∗
                                                                         ∗
                                                          f:=x→x sin(5 x) - 3 x;
                                 This names the function f and the variable x. The arrow must be typed into MAPLE as a dash
                                 followed by a “greater than” symbol. If we want to evaluate this function at a point, say π/4,
                                 type
                                                                  f(Pi/4);
                                                   √
                                 to obtain the value −π 2/8 − 3π/4.
                                    To plot a graph of f , say on the interval [−1,3], enter
                                                           plot(f(x), x=-1..3);
                                    If we wish, we can enter a function directly into the plot command without prior definition.
                                 For example,
                                                          ∗
                                                                ∗
                                                  plot(x cos(3 x) - exp(x), x=-1..1);
                                                    x
                                 will graph x cos(3x) − e for −1 ≤ x ≤ 1.
                                    To plot several graphs of functions that have been defined, enter, for example,
                                                     plot({f(x),g(x),h(x)},x=a..b);
                                 We can arrange for all the graphs to be in one color, say black, by
                                              plot({f(x),g(x),h(x)},x=a..b,color=black);
                                    Sometimes we want to enter a function having jump discontinuities. This is done by
                                 specifying the value of the function on successive intervals. For example, to define
                                                               ⎧
                                                               ⎪x        for x < −1
                                                               ⎪
                                                               ⎪
                                                                cos(3x)  for −1 < x < 4
                                                               ⎨
                                                         s(x) =
                                                               ⎪x  2     for 4 < x < 9
                                                               ⎪
                                                               ⎪
                                                                sin(4x)  for x > 9
                                                               ⎩
                      Copyright 2010 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s).
                      Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.

                                   October 14, 2010  15:43  THM/NEIL   Page-790        27410_24_appA_p789-800
   805   806   807   808   809   810   811   812   813   814   815