> j := 2*x^3-5*x^2-2*x+5; > factor(j); > plot(j,x=-100..100); > plot(j,x=-3..3);Note that there is only one argument that is necessary for the

> factor(sin(x)+3); > plot(sin(x)+3,x=-4*Pi..4*Pi); > factor(x*sin(x)-1); > plot(x*sin(x)-1,x=-50..50);When an expression is already in factored form or cannot be factored, the Maple output is the same expression that was entered. Remember, not every expression has roots. That is, some expressions, when plotted, don't intersect with the -axis at all while others may intersect the -axis infinitely many times. When an expression cannot be factored, this does not necessarily imply that there are no roots. You may want to plot the expression first to see if there are any roots. The example above shows that cannot be factored, however you can see by the plot that there are infinitely many roots.

> solve(equation,variable);The following example illustrates how we can find the roots of the function

using the

> f := x-> 2*x^3-5*x^2-2*x+5; > solve(f(x)=0,x); > solve(2*x^3-5*x^2-2*x+5=0,x);Here the ``='' sign is used in the equation, not ``:='' which is used for assignment. If you forget to type in an equation and only type in an expression without setting it equal to zero, Maple automatically sets the expression equal to zero. The

> solve(sin(x)=tan(x),x); > solve(x^2+2*x-1=x^2+1,x);Unfortunately, many equations cannot be solved analytically. For example, we can use the quadratic formula to find the roots of any quadratic polynomial. There also exist formulas for finding roots of cubic and quartic (fourth order) equations, but they are so complicated that they are hardly ever used. However, it can be proven that there is no general formula for the roots of a fifth or higher order polynomial. Once we get away from polynomial equations, the situation is even worse. For example, even the relatively simple equation sin(x) = x/2 has no analytical solution.

If an equation cannot be solved analytically, then the only possibility is to solve it numerically. In Maple, the command to use is

> solve(sin(x)=x/2,x); RootOf(_Z-2sin(_Z))This is not incorrect, as some of the zeros of a function may be imaginary and others may be real. What you need to do is read the output carefully looking for real solutions (each solution is separated by a comma) or use the

> fsolve(sin(x) = x/2, x);Note that the result is a decimal approximation and is not exact. Also, a plot of both equations on the same graph will show that this solution is not complete. There are two other intersection points that the

> plot({sin(x),x/2},x=-2*Pi..2*Pi); > fsolve(sin(x) = x/2, x=-3..-1); > fsolve(sin(x) = x/2, x=-1..1); > fsolve(sin(x) = x/2, x=1..3);Once you have solved an equation, you may want to use the output or the solution later. In order to label the output to a solution, you need to assign a label in the same line as the

> expr2 := x^2 + 2*x - 5; > answer := solve(expr2=0,x); > evalf(subs(x=answer[1], expr2));Here, an expression was defined first and then the solution was assigned to the label ``answer''. Note that there was more than one solution. In order to substitute the answer that was listed first back into the expression, the

- Given the expression
,
- Plot the expression. Experiment with the plotting range until you can see all roots and state how many roots there are.
- Use the Maple
`solve`command to find roots of the expression. - Use the Maple
`fsolve`command to find roots of the expression. - State the real roots of the expression in text.

- Given the function
,
- Plot the function over the interval . Then plot the function again over a smaller range of values that better helps you solve for the roots.
- Find all roots and label the output.
- Substitute each root back into the function to show that the answer is zero.

- Find all points where the functions and intersect each other. A plot of both functions on the same graph may be necessary to ensure that you have found all intersection points. Once you have found the coordinate(s), substitute the solution(s) back into either function to get the corresponding coordinate(s).

2012-09-08