** SOLVING
EQUATIONS**

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

Now evaluate it at x=1.75.

`> `
**P(1.75);**

Now find its roots.

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

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);**

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);**

Now we write a polynomial as an expression.

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

`> `
**P(1.75);**

The evaluation must be done differently and requires more effort.

`> `
**subs(x=1.75,P);**

The solve command can be used as before.

`> `
**solve(P,x);**

`> `
**evalf(%);**

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);**

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

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

`> `
**fsolve(Q(x),x);**

`> `
**solve(Q(x),x);**

`> `
**evalf(%);**

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);**

`> `
**evalf(%);**

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);**

We must use fsolve( ).

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

`> `

`> `

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);**

`> `
**fsolve(g(x),x);**

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);**

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

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

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

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

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);**

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

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

`> `
**solve(f(x),x);**

`> `
**fsolve(f(x),x);**

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);**

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.