Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
History of trigonometry wikipedia , lookup
Functional decomposition wikipedia , lookup
Big O notation wikipedia , lookup
Function (mathematics) wikipedia , lookup
System of polynomial equations wikipedia , lookup
Mathematics of radio engineering wikipedia , lookup
Principia Mathematica wikipedia , lookup
Getting Started with Maple V Introduction Maple V is a Symbolic Computation System or Computer Algebra System for mathematical computation symbolic, numeric and graphical. It does all the usual numerical operations to arbitrary precision. More importantly, it can manipulate symbolic expressions: polynomials can be factored, expanded and terms collected; functions can be integrated and differentiated; differential equations can be solved; random numbers can be generated and manipulated and problems of matrix algebra can be handled by Maple. Maple also has extensive facilities for plotting functions of one and two variables. This document describes some of the basic Maple operations and functions. It only serves as a guide to get a beginner acquainted with the basic features of Maple. For details please refer to references given at the end of this document. Like most packages, on line help is available. You can start Maple by double-clicking on the Maple icon on your desktop. Maple should start and present you with a new worksheet. Your Maple window will look like the one shown below: At the top of the window is the menu bar containing such menu items as File and Edit. Immediately below the menu bar is the tool bar, which contains button-based shortcuts to common operations such as opening, saving and printing. Below that is the context bar which contains controls specific to the task you are currently performing. The next area is large and displays your worksheet, the region in which you work. At the very bottom is the status bar, which displays system information. The worksheet is an integrated environment in which you interactively solve problems and document your work. Basics Maple is an interactive program. You type in an expression or command, and Maple evaluates or executes it and returns the result. For example : > 3*2; 6 The angle bracket > is the Maple prompt. As expressions can continue over more than one line, Maple does not begin to process your input until you indicate you have finished by typing a semicolon ; . This is illustrated by the following (fairly silly) example : > 2+2 > +2+2 > +2+2; 12 The use of a colon : suppresses the output of the answer completely. > 2+2: (No output will be displayed) To exit Maple, use the File-Exit menu like any other Windows program or just type ‘quit’ at the prompt. Note : there is no need to use a semi-colon for this command! > quit Numbers and constants Maple understands all the usual numbers (rational, floating point and complex) and numerical operations. In order to enter a number like 2.3456 10 6 , we would type: 2.3456*10^6. Try the following: > 2.3456*10^6 , 6.598*7.6986, 176/345+6768/1019; .2345600000 10 7 , 50.7953628 , 2514304 351555 Capital I is used to represent the square root of negative 1 when entering complex numbers. i.e. I 1 . > sqrt(3+4*I); 2 + I The constant is denoted by Pi in Maple. (Note that P in " Pi " must be in capitals) > Pi; 2 Digits and evalf The evalf function returns a floating point approximation of the expression given to it (evalf is read "e-val-F" and is short for "EVALuate as Floating point"). This enables us to look at the values in more familiar guise : > evalf(Pi), evalf(2/3) 3.141592654 , .6666666667 An optional argument to evalf allows us to work with any number of digits of precision. We could display with 20 digits by entering : > evalf(Pi,20); 3.1415926535897932385 Alternatively, we could set the number of digits in all our operations using the Digits command. For example : > Digits:=15: evalf(Pi); 3.14159265358979 Variables and Functions One of the keys to Maple’s usefulness is the ability to use arbitrary variables in expressions as in the following examples : > 2*x+3, x^2+2*x-1; 2 x 3 , x2 2 x - 1 Note the explicit multiplication operator * in the previous example. Unfortunately, it is compulsory as implicit multiplication is not recognised by Maple : > 2x+3; Syntax error, missing operator or `;` The assignment operator := is used to assign names to expressions. > y := 4*x+5; y := 4 x + 5 Then we can assign values to the variable x and see the value of y change. > x:=10; y; x := 10 45 3 We may repeat the command, setting a different value for x. You may do this either by retyping the line, or moving your cursor to the previous command and changing the "10" to "-3" and hitting the return key. > x:=-3; y; x := -3 -7 To recover the general form of y we use the following trick to remove the value assigned to x : > x:= ’x’; y; x := x 4 x + 5 Note that the above is not the same as saying " y is a function of x ". In order to do that, we use the functional operator -> > y := x -> 4*x+5; y := x -> 4 x + 5 We can read this as “y is the function that takes x and gives 4x+5”. Besides these user-defined functions, there are also a number of pre-defined functions in Maple. For instance, the exponential function, e x , is defined as exp . We can use y and exp like an ordinary function, evaluating them at specific points or at different arbitrary points. For example : > y(10), y(-3), y(x), y(z+20/z^2); 45, -7, 4 x + 5, 4 z + 80 + 5 z2 > exp(1), evalf(exp(1)), exp(2), y(exp(y(x))); e, 2.718281828, e 2 , 4 e (4x + 5) + 5 Besides the exponential function, Maple has definitions for almost all of the so-called elementary functions : all the trigonometric functions and their inverses (sine, arcsine, and so on), natural logarithm and many others. Some examples are given below : > sin(Pi/4), cos(3*Pi/2), ln(1), 12! ; 1 2 , 0, 0, 479001600 2 4 A sample list of functions found in Maple is given in the table below : Function Maple name ex (exponential) exp(x) ln x (natural logarithm) ln(x) or log(x) log10 x (logarithm to the base 10) log10(x) x sqrt(x) | x| (absolute value) abs(x) sine, cosine, tangent (in radians) sin(x), cos(x), tan(x) secant, cosecant, cotangent sec(x), csc(x), cot(x) inverse trigonometric functions arcsin(x), arccos(x), arctan(x), arcsec(x), arccsc(x), arccot(x) Hyperbolic functions sinh(x), cosh(x), tanh(x), sech(x), csch(x), coth(x) Inverse hyperbolic functions arcsinh(x), arccosh(x), arctanh(x), arcsech(x), arccsch(x), arccoth(x) Factorial of n n! Close and Start new worksheets At this point, it may be useful to close your present worksheet and start a new worksheet. To close a worksheet, click FILE from menu bar, and select CLOSE. To start a new worksheet, click FILE from the menu bar and select NEW. Plotting 2-D Graphs When plotting an explicitly given function, y f (x) , Maple needs to know the function and the domain. For example, > plot(sin(x), x = -2*Pi..2*Pi); 5 Maple can also graph user-defined functions. > f:=x -> x^3-3*x^2-5*x+2: > plot(f(x),x=-3..5); To graph more than one function in the same plot, you need to specify a list of functions. In addition, you may also specify the range for y, as well as the colours for the individual graphs. > plot([sin(x),1/x],x=-2*Pi..2*Pi,y=-3..3,color=[blue,black]); Help!! On-line help is available on the Maple system. Simply type a ? followed immediately by the topic on which you need help. Alternatively, you may click on the Help item on the menu bar and a help window will pop up. References 1. B.W. Char, et al., “First Leaves : A Tutorial Introduction to Maple V”, Springer-Verlag, New York, 1992. 2. B.W. Char, et al., “Maple V Language Reference Manual”, Springer-Verlag, New York, 1991. [QA 155.7 E4 Map] 3. R.M. Corless, “Essential Maple : An Introduction for Scientific Programmers”, SpringerVerlag, New York, 1995. [QA 76.95 Cor] 4. A. Heck, Springer-Verlag, New York, 1993. [QA 155.7 E4 Hec] 5. Heal, K.M., et al, “Maple V Learning Guide”, Springer-Verlag, New York, 1996. NTU/NIE/99/AKC 6 Solving Algebraic Equations Maple can be used to solve algebraic equations. For example, to solve for a single unknown in the equation, 3x+4=5x : > solve(3*x+4=5*x); 2 If you give an expression rather then an equation, Maple automatically assumes that the expression is equal to zero. > solve(x^3-13*x+12,x); 1, 3, -4 To solve an equation with more than one solution : > solve(ln(x^2-1)=a,x); e a 1, ea 1 Maple may also be used to solve simultaneous equations. For example, to solve the simultaneous equations, 3x + 4y = 8 and 2x - 3y = 2 : > eqs := {3*x + 4*y = 8, 2*x - 3*y = 2}: > solve(eqs); {y 10 32 ,x } 17 17 Other Maple Features Try the following commands : solve(a*x^2+b*x+c=0,x); diff(cos(x),x); int(x^3*cos(x),x); expand((x-2)^4); factor(x^3-3*x^2+3*x-1); sum(i,i=1..100); factor(sum(i,i=1..n)); plot(sin(x),x=-Pi..Pi); 7