SOLVING EQUATIONS

We first introduce in this section the function notation as distinct from the expression notation. If you are given a function and wish to operate on it (evaluate, graph, differentiate, etc.) it is usually advisable to use the function notatation which assigns to an independent variable x, or t, or u, or whatever, a value f(x), or g(t), or Q(u), etc. Consider the polynomial P(x)=x^2-5*x-14 and we write it as a function:

> P:=x->x^2-5*x-14;

[Maple Math]

Now evaluate it at x=1.75.

> P(1.75);

[Maple Math]

Now find its roots.

> solve(P(x)=0,x);

[Maple Math]

The expression =0 may be omitted from the solve command in which case it is understood that you are solving P(x)=0. If the right hand side is not zero then make the necessary adjustments.

> solve(P(x)=4,x);

[Maple Math]

The solve( ) command will only find exact roots. If it can't find any it returns no answer or an unusable one. For instance

> solve(P(x)=4*sin(x),x);

[Maple Math]

Now we write a polynomial as an expression.

> P:=x^2-7*x-11;

[Maple Math]

> P(1.75);

[Maple Math]

The evaluation must be done differently and requires more effort.

> subs(x=1.75,P);

[Maple Math]

The solve command can be used as before.

> solve(P,x);

[Maple Math]

> evalf(%);

[Maple Math]

The command evalf( ) uses the very accurate floating point arithmetic. It must be used whenever irrational numbers occur and we recommend it be used at all times. To go directly to decimal approximations of roots use the fsolve( ) command.

> fsolve(P,x);

[Maple Math]

However, fsolve( ) will only find real roots, and it produces approximate values.

> Q:=x->x^3+5*x^2+6*x+8;

[Maple Math]

> fsolve(Q(x),x);

[Maple Math]

> solve(Q(x),x);

[Maple Math]

> evalf(%);

[Maple Math]

If solving an equation is a one shot deal we can conveniently type in the function in the solve( ) command.

> solve(x^4-x^3-x^2+3*x-6,x);

[Maple Math]

> evalf(%);

[Maple Math]

However, if the equation is not a polynomial then the fsolve( ) command, which initiates a numerical zero finding scheme, must be used. For instance, to find the intersection point of the graphs of 2*x and cos(x) we must solve the transcendental equation cos(x)-2*x=0.

> solve(cos(x)-2*x,x);

[Maple Math]

We must use fsolve( ).

> fsolve(cos(x)-2*x,x);

[Maple Math]

>

>

SOLVING AND GRAPHING

When using the fsolve( ) command to find real roots some graphing may be needed since the fsolve( ) command is very nearsighted. PROBLEM: Find the zeros of the following function.

> g:=x->x-x^2+x^4/(10*x+4);

[Maple Math]

> fsolve(g(x),x);

[Maple Math]

The fsolve( ) command has only found the obvious zero. A little analysis will convince us there are two more positive zeros and we use some graphing.

> plot(g(x),x=0..4);

[Maple Plot]

> plot(g(x),x=4..12);

[Maple Plot]

From the plots shown we can give ranges for fsolve( ) to find the other zeros.

> fsolve(g(x),x=0.8..1.2);

[Maple Math]

> fsolve(g(x),x=8..10);

[Maple Math]

If we only need rough estimates of the zeros we can box the graphs then put the cursor on the x-axis crossing and read off an approximate value.

PROBLEM: Find the eighth positive zero of sin(x)-x/40. This time we want to graph two functions simultaneously and the easy way is the command plot({f(x),g(x)}, x=a..b).

> plot({sin(x),x/40},x=0..50);

[Maple Plot]

> f:=x->sin(x)-x/40=0;

[Maple Math]

Note that we inserted the =0 term - this is good practice.

> solve(f(x),x);

[Maple Math]

> fsolve(f(x),x);

[Maple Math]

As expected, nothing happened except the obvious. Box the graph and use the cursor to estimate the x-coordinate of the intersection point of the two graphs, then give a range for x.

> fsolve(f(x),x,x=24..26);

[Maple Math]

PROBLEMS

1. Find all roots of the following polynomials

a) x^3-7*x^2+14*x-6 b) x^6-1 c) 5*x^4-12*x^2+8*x-1.

2. Find all zeros of the function 18*x^5-8*x^3+18*x^2-2-2*sin(x)^2.

3. Find all intersection points of the graphs of y=x^2 and y=sin(6*x).

4. A fixed point of a function f(x) is a solution of the equation x=f(x). Find the fixed points of

a) 2^(-x) b) cos(x^2).

5. Find a value k>0 for which exp(x^2/k) will have a fixed point. Estimate the smallest value of k.


Maple Worksheet
Maple Tutorial Main Page