{VERSION 6 0 "IBM INTEL NT" "6.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 1 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 1 }{CSTYLE "2D Comment" 2 18 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 256 "" 1 18 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{PSTYLE "Normal " -1 0 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Heading 1" 0 3 1 {CSTYLE "" -1 -1 "" 1 18 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }1 0 0 0 8 4 0 0 0 0 0 0 -1 0 } {PSTYLE "" 0 256 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 0 257 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 0 258 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {EXCHG {PARA 256 "" 0 "" {TEXT 256 9 "Functions" }}{PARA 257 " " 0 "" {TEXT -1 12 "March 2005\n\n" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 252 "In the worksheet on Fundamentals of Maple we already say a lis itng of elementary functions, and how to invoke them in maple. In the sequel we shall revisit this list, but before we do so let's look at \+ the fundamentals of the definition of a function. " }{MPLTEXT 1 0 0 " " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 113 "Remember to use the sequence -> to defin e a function, which is a dash followed by an inequality symbol. Examp le:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "f := x -> x + 1/(1+x^2);" }} }{EXCHG {PARA 0 "" 0 "" {TEXT -1 89 "Once the function is defined, you may perform all kinds of operations with it. Examples:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "f(x); # the output from f" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 33 "f(2*x); # horizontal compression" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 61 "f(t); # the name of the ind ependent variable is immaterial " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 41 "(f(x+h) - f(x))/h; # Difference Quotient" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "simplify(%);" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 0 "" }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 57 "Polyn omials, Rational Functions, Roots and Absolute Value" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 134 "For polynomials it is important to remember to include the sta r (*) for multiplication; carrets (^) are used for exponents. Example s:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "p := x -> 3*x^3 - 4*x^2 + 6*x - 5;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 48 "factor(p(x)); # j ust because it can be factored" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "q := x -> (x-1)*(x+3)*x^2;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 53 "expand(q(x)); # 'expand' is the opposite of 'factor' " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 51 "Rational functions are equall y simple to deal with." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "r := x -> (3*x -5)/(4- 25*x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "r(x) ;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 30 "The square root is entered as " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "f:= x -> sqrt(x);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 25 "For othe r order roots use" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "f := x -> root [4](x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "f(x); # check\n f(625);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "f(x);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 15 "Absolute value:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "f := x -> abs(x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "abs(-4); # check" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 27 "Exponential s and Logarithms" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart; " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 22 "The generic function " } {XPPEDIT 18 0 "a^x;" "6#)%\"aG%\"xG" }{TEXT -1 20 " can be entered as " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "f := x -> a^x;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 56 "and you can actually do some math with it . For example " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "f(1/2);\nf(t)*f( s); \nsimplify(%);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 96 "If you want to temporarily use a specific value for a, say a=5/2, you may substit ute this value:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "subs(a=5/2,f(x)) ;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 20 "You can also define " } {XPPEDIT 18 0 "f(x) = (5/2)^x;" "6#/-%\"fG6#%\"xG)*&\"\"&\"\"\"\"\"#! \"\"F'" }{TEXT -1 13 " directly. " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "f := x -> (5/2)^x;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 86 "The nat ural exponential function using the Euler constant e = 2.71828.... is given by" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "f := x -> exp(x);" }}} {EXCHG {PARA 258 "" 0 "" {TEXT -1 13 "This is wrong" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 35 "e^x; # WARNING, don't to this !!!!" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 123 "This does not work because maple conside rs e just as any other constant, and it does not associate e = 2.71828 ... Compare:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "e^2.5;\nexp(2.5); " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 48 "The natural logarithm can be entered in two ways" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "ln(x);\nlog(x);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 47 "A logarithm with a different base is entered as" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "f := x -> log[4](x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "f(32); " }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 26 "4^%; # Check\nsimplify(%);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 176 "Logs are inverses of exponential functions. For th is demo we have to make the assumption that we are dealing with real n umbers (since maple also works for complex arithmetic):" }}{PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 28 "assume(x,real);\nln(exp(x));\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 48 "assume(a,positive);\na^x;\nlog[a](% );\nsimplify(%);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}} {SECT 1 {PARA 3 "" 0 "" {TEXT -1 23 "Trigonometric Functions" }} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 " " 0 "" {TEXT -1 72 "When dealing with trigonometric functions it is ve ry important to enter " }{XPPEDIT 18 0 "Pi;" "6#%#PiG" }{TEXT -1 23 " \+ with an upper case P." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "Pi;\npi; \+ # WRONG" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 126 "There doesn't appear \+ to be any difference among the two, but evaluation as floating point n umbers will reveal the distinction:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "evalf(Pi);\nevalf(pi);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 110 "We conclude that 'pi' is just some constant, while 'Pi' associates the v alue 3.14159.... with that constant. " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 42 "The trig functions are entered as follows:" }}{PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 47 "sin(x);\ncos(x);\ntan(x);\ncot(x);\nsec(x);\nc sc(x);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 24 "Never enter the sine as " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "sin*x; # WRONG, don't do thi s" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 272 "While it almost looks like \+ the sine function, 'sin*x' represents a constant, called sin, multipli ed by x. Keep in mind that sin(x) is a function, just like f(x), exce pt that we use three letters (s-i-n) to represent it, rather than a si ngle letter f. Some more examples:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 52 "f := x -> 2*cos(x) + sin(2*x);\nf(0);\nf(Pi/3);\nf(Pi);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "tan(x)/sec(x);\nsimplify(%); " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 85 "Here is a way to enter power s of trig functions. Example: We all know that 1 - " }{XPPEDIT 18 0 "sin^2;" "6#*$%$sinG\"\"#" }{TEXT -1 1 " " }{XPPEDIT 18 0 "x;" "6 #%\"xG" }{TEXT -1 4 " = " }{XPPEDIT 18 0 "cos^2;" "6#*$%$cosG\"\"#" } {TEXT -1 2 " " }{XPPEDIT 18 0 "x;" "6#%\"xG" }{TEXT -1 24 " . To che ck this, enter" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "1-sin(x)^2;\nsimp lify(%);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 17 "Or, for example " } {XPPEDIT 18 0 "sin^2;" "6#*$%$sinG\"\"#" }{TEXT -1 1 " " }{XPPEDIT 18 0 "Pi/3;" "6#*&%#PiG\"\"\"\"\"$!\"\"" }{TEXT -1 42 " means to take t he square of the number " }{XPPEDIT 18 0 "sin(Pi/3) = sqrt(3)/2;" "6#/ -%$sinG6#*&%#PiG\"\"\"\"\"$!\"\"*&-%%sqrtG6#F*F)\"\"#F+" }{TEXT -1 20 " . Thus we enter" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "sin(Pi/3)^ 2;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 63 "Inverse functions are denot ed with the prefix 'arc'. Examples:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "arcsin(x);\narctan(x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 37 "arcsin(1/2); # angle with sine = 1/2" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 48 "arctan(sqrt(3)); # angle with tangent = sqrt(3)" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "sin(Pi/6); # Checks\ntan (Pi/3);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 49 "tan(arcsin(x)); \+ # Draw a triangle to check this" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 19 "Piecewise F unctions" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 176 "It's a little tricky to define pi ecewise function. The syntax is piecewise( condition1, expression1, c ondition2, expressions2, ....., otherwise). Let's look at an example: " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 51 "f := x -> piecewise( x<1, x^ 2, x<=4, x-3, sqrt(x));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 " f(x); # display f(x)" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 49 "pl ot(f, -2..8,discont=true); # plot the function" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 43 "f(1), f(4); # Test at the transition points" } }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 72 "The absolute value function as a piecewise function would be entered as " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "f := x -> piecewise(x<0,-x,x);" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 5 "f(x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "f(x) - abs(x); # Check\nsimplify(%);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}}{MARK "0 1 0" 11 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }