[an error occurred while processing this directive] [an error occurred while processing this directive] newuser,topic04

(4) Algebraic Computations

Before examining this topic, please make sure that you have read: (1) Working Through the New User's Tour.

Maple is a very powerful algebraic calculator that can manipulate and find solutions to many problems symbolically. Being able to use variables instead of specifying numbers at the beginning of a problem allows you to ask "What if...?" types of questions.

Use the restart command to clear Maple's internal memory and get started with this page of the tour.

> restart;

Working with Expressions

Maple provides different ways of manipulating and displaying expressions to make them easier to verify, or more effective to use. This flexibility allows you to do such things as expand binomials, factor results, simplify trigonometric expressions, assign variable names to results, and convert expressions to different forms.

Expanding and Factoring Expressions

Maple can expand binomials such as . The following Maple commands create the expression, and then expand it.

> expr := (x+y)^15;

> expand(expr);

After viewing the results, you can use the factor command to factor the last result and check the computation.

> factor(%);

Simplifying Expressions

Maple can apply identities to simplify many lengthy mathematical expressions, such as trigonometric expressions.

Consider .

> simplify( cos(x)^5 + sin(x)^4 + 2*cos(x)^2 - 2*sin(x)^2 - cos(2*x) );

Another way to simplify expressions is to use the normal command, which puts fractions on a common denominator and removes common factors in the numerator and denominator.

The fraction is much simpler after Maple removes the common factors.

> normal( (x^3-y^3)/(x^2+x-y-y^2) );

Assigning Variable Names

You can assign a variable name to the results of a computation. The use of variables is essential for managing large numbers of expressions and functions, especially if you want to reuse the output later in a session.

For example, create the expression , and store it as .

> expr1 := (41*x^2+x+1)^2*(2*x-1);

Use the expand command on and store the result as a variable, .

> expr2 := expand(expr1);

Evaluate at x =1.

> eval(expr2 , x=1 );

In the next example, is assigned the normalized quotient of the expansion of two expressions, and .

> top := expr2;

> bottom := expand((3*x+5)*(2*x-1));

> answer := normal( top/bottom );

Converting Expressions to Different Forms

The convert command allows you to convert many types of expressions into specific forms. For a complete list of conversions available in Maple, see the Help page for the convert command.

The following example converts a symbolic expression, , into its partial fraction decomposition.

> my_expr := (a*x^2+b)/(x*(-3*x^2-x+4));

> convert( my_expr, parfrac, x );

The following example converts a trigonometric expression, , into an exponential expression.

> convert( cot(x), exp );

Function Notation

Maple provides several ways to define functions. One way is to use arrow notation (which closely resembles standard mathematical notation for a mapping). You can also use the unapply command, which turns an expression into a function.

Define the function .

> f := x -> x^2+1/2 ;

Evaluate the function at numeric and symbolic values.

> f(2);

> f(a+b);

Use the unapply command to turn an expression into a function.

> g := unapply(x^2 + 1/2, x);

You can use Maple to solve and verify solutions to equations and systems of equations.

Solving an Equation

Use Maple to solve the following equation: .

> eqn := x^3-1/2*a*x^2+13/3*x^2 = 13/6*a*x+10/3*x-5/3*a;

> solve( eqn, {x} );

To verify one of the solutions, evaluate the equation at that particular value of x .

> eval( eqn , x=1/2*a );

Solving a System of Equations

You can also solve systems of equations in Maple.

Consider the following set of four equations and five unknowns:

> eqn1 := a+2*b+3*c+4*d+5*e=41;

> eqn2 := 5*a+5*b+4*c+3*d+2*e=20;

> eqn3 := 3*b+4*c-8*d+2*e=125;

> eqn4 := a+b+c+d+e=9;

Now solve the system for the variables , , , and d . Maple will return its solutions in terms of the fifth variable, e . Since there are four equations and five unknowns, we will have a parametric set of solutions. On the other hand, if we solved for a , b , c, d and e , Maple would choose one of the variables (at random) as a free parameter.

> solve( {eqn1, eqn2, eqn3, eqn4}, {a, b, c, d} );

To verify that this solution satisfies eqn1 and eqn2 , evaluate both of them at this solution.

> eval( {eqn1, eqn2} , % );

Further Examples of Solving Equations

The following examples show other types of equations that you can solve using Maple, such as equations using trigonometric functions and absolute values.

Solve an equation involving trigonometric functions.

> solve( arccos(x) - arctan(x)= 0, {x} );

As a final example, solve an equation containing absolute values: .

> solve( abs( (z+abs(z+2))^2-1 )^2 = 9, {z});

> abs( (z+abs(z+2))^2-1 )^2 = 9;

Solving Inequalities

The following examples show how easy it is to solve systems of inequalities in Maple.

Use Maple to solve systems of inequalities, such as .

> solve( {x^2<1, y^2<=1, x+y<1/2}, {x,y} );

Another example involves solving the inequality , for x in terms of y .

> ineq := x+y+4/(x+y) < 10:

> solve( ineq, {x} );

Not only does Maple solve inequalities, but it can also consider a complex inequality such as , and compute its Boolean value, by using the is command.

> expr := 2*sqrt(-1-I)*sqrt(-1+I):

> is( expr <> 0 );

Click here to return to the Main Menu.

[an error occurred while processing this directive]