Docsity
Docsity

Prepara tus exámenes
Prepara tus exámenes

Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity


Consigue puntos base para descargar
Consigue puntos base para descargar

Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium


Orientación Universidad
Orientación Universidad


Guia de programa maple, Guías, Proyectos, Investigaciones de Matemáticas

este manual se divide en 2 partes

Tipo: Guías, Proyectos, Investigaciones

2018/2019

Subido el 05/03/2019

carlosgtzof
carlosgtzof 🇲🇽

1 documento

1 / 44

Toggle sidebar

Esta página no es visible en la vista previa

¡No te pierdas las partes importantes!

bg1
An Introduction to Maple
Computer Algebra System (CAS) Exercises
Prior to attempting to solve any CAS Exercises, spend a few minutes reading through this introduction to
become more familiar with some of the basic features, commands and structure of Maple. You are also
encouraged to complete the Maple modules that accompany the Eleventh Editions of Thomas' Calculus and
Thomas' Calculus: Early Transcendentals. These modules will give you more experience using
Maple in the context of mathematical modeling and include several interesting applications of calculus.
Information about the modules can be found at the following web site: www.aw-bc.com/thomas.
Maple Arithmetic
At the simplest level, you can think of Maple as a powerful calculator that can do symbolic (exact)
manipulations as well as floating point (approximate) arithmetic.
Addition, Subtraction, Multiplication, and Division
The symbols +, -, *, and / are used for addition, subtraction, multiplication, and division,
respectively. Don't try any of these on your graphing calculator!
> 575754575849849885 + 748949854985944749598984;
748950430740520599448869
> 87575750 - 4897475988744894574949;
-4897475988744806999199
> 6868868686 * 18234987271740;
125253733060463458733640
> 996868686127325465986865000000000000 / 5000;
199373737225465093197373000000000
Remember that each command has to end with a semi-colon (or colon, if you don't wish to see the
result).
Powers
Either ^ or ** can be used to raise a number to a power.
> 55757^22;
2621722782213073468606173269872464991004411425248561190057363350310737714673774557\
20035345978636911261049
> 109**5;
15386239549
Exponentials are handled with the exp command.
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c

Vista previa parcial del texto

¡Descarga Guia de programa maple y más Guías, Proyectos, Investigaciones en PDF de Matemáticas solo en Docsity!

An Introduction to Maple

Computer Algebra System (CAS) Exercises

Prior to attempting to solve any CAS Exercises, spend a few minutes reading through this introduction to become more familiar with some of the basic features, commands and structure of Maple. You are also encouraged to complete the Maple modules that accompany the Eleventh Editions of Thomas' Calculus and Thomas' Calculus: Early Transcendentals. These modules will give you more experience using Maple in the context of mathematical modeling and include several interesting applications of calculus. Information about the modules can be found at the following web site: www.aw-bc.com/thomas.

Maple Arithmetic

At the simplest level, you can think of Maple as a powerful calculator that can do symbolic (exact) manipulations as well as floating point (approximate) arithmetic.

Addition, Subtraction, Multiplication, and Division

The symbols +, -, *, and / are used for addition, subtraction, multiplication, and division, respectively. Don't try any of these on your graphing calculator!

Remember that each command has to end with a semi-colon (or colon, if you don't wish to see the result).

Powers

Either ^ or ** can be used to raise a number to a power.

> 55757^22;

2621722782213073468606173269872464991004411425248561190057363350310737714673774557\

Exponentials are handled with the exp command.

> exp(2);

e

2

Euler's constant, e , is obtained as

> exp(1); e

The Maple name for ’^ is infinity.

> infinity; ’

Palettes

Maple has four palettes containing shortcuts to entering commands via the keyboard. The Expression palette can be used to compute powers, roots, elementary transcendental functions, limits, derivatives, and other basic calculus-based quantities. To view this palette, pull down the View menu, choose Palettes and then select Expression. Then click on the tiny right arrow symbol at the bottom left corner of the worksheet window. The pallette will pop out of the left margin. It can be resized by dragging its right side.

To use the palette to enter a quantity like 390625, position the cursor in an input region and click on the symbol a^ in the palette. This produces sqrt(%a) with the argument selected. Type 390625 and then execute the group. Your final input and output should appear as

> sqrt(390625); 625

When a palette generates a template that involves more than one argument, the Tab key can be used to move from one argument to the next. For example, to compute

, use the a/b button on the

palette, enter 757555, press Tab , enter 5, then press Return to obtain

The Expression pallette can be moved to one of the other three sides of the worksheet. Right click on the Expression button, choose Dock then the desired position. To make the pallette disappear, click on the left arrow at the bottom of the worksheet.

Exact vs. Approximate Calculations

Maple is designed to provide exact answers to mathematical computations.

> sqrt( 27 ); 3 3

> sqrt( 23.1 ); 2 - 9;

In this case, the most recent result is -7. The next most recent result can recalled with %%^.

> %%^2 + %;

Assigning Names

The Maple command for assigning a value to a name is the two-character sequence " := ''. The single character " = '' is used to form equations or to test for equality of two objects. Names generally consist of a letter followed by one or more letters, numbers, and underscores.

The commands to assign x the value 2 and y the value 3 are

> x := 2; y := 3; x := 2 y := 3

The name prod will be assigned the product of x and y

> prod := xy;* prod := 6

From now on, the name prod will be replaced with this value. Thus,

> prod; 6

and, if the value of x is changed, the value of prod is not affected

> x := 9; prod; x := 9 6

The unassign command removes assignments that have been made. (To erase all assignments, it is easier to use restart; .)

> unassign( 'x', 'y', 'prod' );

> x, y, prod;

x , y , prod

Note that if we define prod before assigning values to x and y ,

> prod := xy;* prod := x y

Now, when values are assigned to x and y , these values are used to compute the current value of prod.

> x := 10; y := 9; prod; x := 10 y := 9 90

And, if one or both of x and y are changed, the value of prod changes as well.

> x := 3; prod; x := 3 27

The difference in these two examples is whether the names used in the definition of prod have values at the time the definition is made.

Suppressing Output

The last few examples have had more than one command in each input region. These commands can appear on separate lines or on the same line. If you wish to suppress the display of results of a command, use a colon to terminate the command.

> x := 90: y := 30: prod; 2700

Maple Commands

> restart;

Built-In Commands and Constants

Maple commands consist of a string of letters (and numbers) followed by one or more arguments enclosed in round brackets (parentheses). The evalf and unassign commands have already been encountered in this worksheet. Here are a few more examples.

If m^ and n^ are integers, $ m^ .. n^ returns the list of all integers from m^ to n^ inclusive.

In Maple, the equation cos^ ( ) - x^ x^ = 0 is represented exactly as we would write by hand. Note the use

of = to form an equation, not the assignment operator :=. The following fsolve command locates a solution to cos^ ( ) - x^ x^ = 0 between x = 0 and x = 2.

> fsolve( cos(x) - x = 0, x = 0..2 );

As mentioned previously, some Maple names are predefined to standard constants. For example, Pi is ʌ. Recall that Euler's constant, e , is obtained with exp(1).

> evalf( Pi ); evalf( exp(1) );

The command for the square root of a number x^ is sqrt(x).

> sqrt( 4 );

2

Note that Maple has no trouble handling the square root of a negative number; I is the imaginary

unit, i.e. , I^

> sqrt( -4 ); 2 I

Each of these quantities could also have been assembled using the palettes and context-sensitive menus.

Command Options

Many Maple commands, particularly the plotting commands, accept optional arguments for customizing the output. For example, the option linestyle=3 plots the command using a dashed line. The equation linestyle=DASH can also be used.

> plot( sin(x) + cos(2x), x = 0..2Pi, linestyle = 3 );**

In the next plot command, two functions, x^

2 , x^

(^2) sin ( ) x 2 , are plotted simultaneously with the first function appearing as a dashed line and the second as a solid line. (Although it is not apparent in a hardcopy of this worksheet, Maple displays the first plot in red and the second in green. The color= option can be used to control the colors used in a plot.)

> plot( [ x^2, x^2sin(x)^2 ], x = -5Pi..5Pi, linestyle = [1,3] );*

conformal3d , contourplot , contourplot3d , coordplot , coordplot3d , cylinderplot , densityplot , display , display3d , fieldplot , fieldplot3d , gradplot , gradplot3d , graphplot3d , implicitplot , implicitplot3d , inequal , interactive , interactiveparams , listcontplot , listcontplot3d , listdensityplot , listplot , listplot3d , loglogplot , logplot , matrixplot , multiple , odeplot , pareto , plotcompare , pointplot , pointplot3d , polarplot , polygonplot , polygonplot3d , polyhedra_supported , polyhedraplot , replot , rootlocus , semilogplot , setoptions , setoptions3d , spacecurve , sparsematrixplot , sphereplot , surfdata , textplot , textplot3d , tubeplot ]

The output of a successful with command is the list of commands that have been added to Maple's repertoire. If this list is unwanted, use a colon to terminate the command.

One of the commands that is now defined is implicitplot.

> implicitplot( x^2 + y^4 = y^2 - x, x = -1.3..0.3, y = -1.2..1.2, scaling=constrained );

The scaling=constrained option instructs Maple to use the same scaling for each axis in the plot.

Creating Functions

You can also create your own Maple commands, including Maple implementations of mathematical functions. For example, the function f x ( ) =^ x^

(^2) sin ( ) x 2 can be defined using

> f := x -> x^2sin(x)^2;*

f := x x^2 sin ( ) x^2

The variable x^ is a dummy variable; it is replaced by whatever object appears as the first argument to

f.

> f(y);

y^2 sin ( ) y^2

> f(fred);

fred^2 sin ( fred ) 2

> f(Pi/2); 1 4

ʌ^2

Notice how Maple automatically simplifies the value of the function when possible.

To plot the function you can use either of the following commands

> plot( f(x), x = -5Pi..5Pi );**

Lists and Sets

Definitions

Two of the most important data structures in Maple are the list and set. A list is an ordered expression sequence contained in square brackets, [ exprseq^ ] , and a set is an unordered expression sequence contained in braces { exprseq^ }. (An expression sequence is a comma-separated collection of numbers, names, equations, or other Maple objects.)

> S := { 1, 3, 111 };

S := {1, 3, 111 }

> L := [ $ 6..10 ];

L := 6, 7, 8, 9, 10[ ]

Notice that the elements of a list or set can be any valid Maple object, including another list or set.

> SS := { S, L };

SS := {[ 6, 7, 8, 9, 10 ], {1, 3, 111 }}

> LL := [ S, L ];

LL := [{ 1, 3, 111 }, 6, 7, 8, 9, 10[ ]]

Look carefully at the previous results. Even though the only difference in the definition of LL and SS is the type of brackets, the order of the elements in SS might appear in the opposite of the order in which they appeared in the definition. Recalling that the elements of a set are not ordered, this is not surprising. (It should also not be surprising to know that the order in which Maple displays the elements of a set can change from one session to another.)

Creating Lists and Sets

Except for the surrounding brackets, lists and sets are created in exactly the same ways. We have already seen how to create lists and sets from explicit collections of numbers and with the repetition command ( $ ). The seq and map command provide two additional methods for creating lists and sets.

The seq command generates an expression sequence consisting of terms formed from the first argument for each value of the second argument. For example, the squares of the first ten positive integers is

> pts := [ seq( i^2, i = 1..10 ) ]; pts := 1, 4, 9, 16, 25, 36, 49, 64, 81, 100[ ]

This list could also be created using $ as

> [ i^2 $ i=1..10 ]; [ 1, 4, 9, 16, 25, 36, 49, 64, 81, 100 ]

To plot a list of values against their index in the set, use the listplot command from the plots package. The style=point optional argument instructs Maple to display discrete points (not connected), symbol=cross sets the plot symbol (the default is a diamond), and symbolsize=20 sests the size of the symbols (in points; the default is 10).

> listplot( pts, style=point, symbol=cross, symbolsize=20);

The same plot could also have been created directly with either of the following variations of the plot command. The output of these commands is suppressed by terminating the commands with a colon.

The first shows how to plot a polar function by specifying only the radius function and the range for the polar angle.

> plot( r(t), t = 0..2Pi, coords=polar ):*

The second shows how the function can be displayed as a parametric curve.

> plot( [ r(t)cos(t), r(t)sin(t), t = 0..2Pi ] ):*

Extracting Elements of a List or Set

Much more than plotting can be done with a list or set. The third element of the list pts can be accessed as

> pts[3];

Notice that it does not make sense to talk about the third element of a set. While Maple will not object to this, you should not expect to receive the same result every time the command is executed. The select and remove commands are designed to extract elements of a set that meet certain criteria. For example, the subset of S containing all elements that are in the open interval ( -10, 10 ) can be found as follows.

> S;

> select( x -> abs(x-10) < 20, S ); { 1, 3 }

The number of elements in a list or set can be determined with the nops command.

> nops( rose4 ); 101

Recall that each element of rose4 is an ordered pair -- actually, a two-element list.

> rose4[10];

sin

ʌ cos

ʌ , sin

ʌ sin

ʌ

A floating-point approximation to this point is

> evalf( % );

[ 0.7639707480, 0.4848305795 ]

The y -coordinate of the tenth element of the list is

> rose4[10,2];

sin

ʌ sin

ʌ

Negative indices can be used to reference elements relative to the end of the list. The last point in rose4 is

> rose4[-1] = rose4[nops(rose4)];

[ 0, 0] = [ 0, 0]

The first ten elements of rose for can be specified using rose4[ 1 .. 10 ]. The floating point approximations to the x-coordinates of each of these points can be obtained with

> polysol[3];

The largest element of a set can be found using

> max( polysol[] );

The absolute value of each solution can be obtained using

> map( abs, polysol );

{ 1.532088886, 1.879385242, 0.3472963553, 0. }

To sort the four solutions in increasing order, re-express the solutions as a list and then call the sort command

> polysol2 := convert( polysol, list );

polysol2 := 1.532088886, -1.879385242, 0.3472963553, 0.[ ]

> sort( polysol2 );

[ -1.879385242, 0., 0.3472963553, 1.532088886 ]

To sort the solutions by the magnitude of the solutions, the following variation of sort in which a user-defined ordering is used

> sort( polysol2, (a,b) -> abs(a) < abs(b) );

[ 0., 0.3472963553, 1.532088886, -1.879385242 ]

To conclude this discussion, consider the system of equations that describes the set of all points on the unit circle and the line x^ + 2^ y^ = 1.

> eq1 := x^2 + y^2 = 1; eq2 := x + 2y = 1;* eq1 := x^2 + y^2 = 1 eq2 := x + 2 y = 1

The system of equations and variables are each specified as sets that, when fed to the solve command, show two solutions

> syssol := [ solve( { eq1, eq2 }, { x, y } ) ];

syssol := { y^^ = 0,^ x^ = 1},^ y^ =

, x =

Each solution is a set of equations giving the x - and y -coordinates of a point on both curves. Note that the order of the equations within each solution is not consistent. These solutions can be converted to ordered pairs using

> syspts := seq( eval( [x,y], pt ), pt = syssol );

syspts := 1, 0[ ],

The two curves involved in this problem can be plotted with the implicitplot command from the plots package. The two solutions can be plotted using plot with style=point. The display command (also from the plots package) can be used to display the information in both plots in a single plot. The output from the plot-creating commands in the definition of p1 and p2 is the corresponding "plot data structure'', not a graphical object. (If you really want to see this, change the colons to semi-colons.)

> p1 := implicitplot( { eq1, eq2 }, x = -2 .. 2, y = -2 .. 2, scaling=constrained ): p2 := plot( [ syspts ], style=point, color=black, symbol=circle, symbolsize=30 ): display( [ p1, p2 ] );