Skip to content Skip to sidebar Skip to footer

Maple Approximate Int Just Shows Command Again

next up previous
Side by side: About this document ... Up: lab_template Previous: lab_template

Subsections

  • Introduction
  • Finding roots of a function or an expression
  • Solving equations
  • Exercises

Solving Equations with Maple

Introduction

The purpose of this lab is to locate roots and find solutions to i equation.

Finding roots of a function or an expression

At that place are several different methods for finding the roots or the zeros of an expression. For instance, if it is possible, yous could factor the expression and set each gene equal to zero. This can exist washed past using the Maple cistron command. Another method for finding roots is to plot the expression and estimate the zeros by looking at where the graph intersects the $x$-axis. This is not the best method since the root is not always an integer value and therefore, it will be difficult to go the exact roots. Plotting the expression may not give us the exact roots, yet information technology is very useful to see how many roots there actually are. The instance below shows how to factor and plot the expression $2x^3-5x^2-2x+5$.
> j := ii*10^three-v*x^2-2*ten+5; > factor(j); > plot(j,10=-100..100); > plot(j,ten=-three..three);      
Notation that there is only i argument that is necessary for the cistron command. The plot command is used to verify that at that place are exactly iii roots for this expression. Equally the ii plot commands show, it is sometimes difficult to come across exactly how many roots there are based on the $x$ range that is chosen. You lot should attempt different ranges until yous obtain a plot that is acceptable. Here are a few more examples.
> factor(sin(ten)+3); > plot(sin(x)+iii,x=-four*Pi..4*Pi); > factor(x*sin(x)-ane); > plot(x*sin(x)-one,x=-50..l);      
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 $x$-axis at all while others may intersect the $x$-axis infinitely many times. When an expression cannot be factored, this does non necessarily imply that there are no roots. You lot may desire to plot the expression first to see if there are any roots. The example above shows that $x \sin(x)-1$ cannot be factored, all the same you can run into past the plot that at that place are infinitely many roots.

Solving equations

Finding roots of an expression or a function $f(x)$ is the same as solving the equation $f(x)=0$. Since not every expression can be factored and information technology is sometimes difficult to get the exact root based on the plot, the all-time method for finding roots is to utilize Maple'south solving capabilities. Commencement, a plot of the function or expression is needed to determine how many roots at that place are. In one case you know how many roots there are, you can apply the Maple solve command. The basic syntax for the solve command is
> solve(equation,variable);      
The following instance illustrates how nosotros tin can observe the roots of the part
$f(x)=2x^3-5x^2-2x+5$ using the solve command.
> f := 10-> two*x^3-v*x^2-2*x+v; > solve(f(x)=0,10); > solve(2*x^iii-5*x^2-2*x+five=0,ten);      
Hither the ``='' sign is used in the equation, not ``:='' which is used for assignment. If y'all forget to type in an equation and only type in an expression without setting information technology equal to null, Maple automatically sets the expression equal to nada. The solve command is not only used for solving for zeros, it tin be used to solve other equations as well. In the examples below, yous tin can see some of the solving capabilities of Maple.
> solve(sin(10)=tan(10),10); > solve(x^2+2*x-1=10^2+1,x);      
Unfortunately, many equations cannot exist solved analytically. For example, we can use the quadratic formula to find the roots of any quadratic polynomial. In that location also exist formulas for finding roots of cubic and quartic (fourth order) equations, simply they are so complicated that they are hardly ever used. All the same, information technology tin be proven that there is no full general formula for the roots of a 5th or college 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, and so the only possibility is to solve it numerically. In Maple, the command to employ is fsolve. The syntax for fsolve is very similar to that of solve. Sometimes when the solve command is used, the output looks similar:
> 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 existent. What you lot need to do is read the output carefully looking for existent solutions (each solution is separated by a comma) or use the fsolve command instead. A simple case will show how we can notice solutions to the equation $\displaystyle \sin(x) = \frac{x}{2}$.
> fsolve(sin(10) = 10/two, x);      
Note that the result is a decimal approximation and is non exact. As well, a plot of both equations on the same graph will show that this solution is non complete. In that location are two other intersection points that the fsolve command did non output. The fsolve control allows us to solve the equation in a range of $x$ values by replacing the second argument with what looks similar a plot range. This method simply works for the fsolve command and not for the solve command. Try the following examples to meet how nosotros can get all solutions to this equation.
> plot({sin(ten),x/2},10=-2*Pi..2*Pi); > fsolve(sin(x) = ten/2, ten=-3..-1); > fsolve(sin(x) = 10/2, ten=-one..ane); > fsolve(sin(x) = x/2, ten=1..3);      
Once you have solved an equation, yous may want to use the output or the solution later. In society to label the output to a solution, yous demand to assign a characterization in the same line as the solve or fsolve command. For instance,
> expr2 := ten^2 + 2*ten - 5; > answer := solve(expr2=0,x); > evalf(subs(10=answer[one], expr2));      
Here, an expression was divers starting time and then the solution was assigned to the label ``answer''. Annotation that there was more than i solution. In lodge to substitute the answer that was listed first back into the expression, the subs command was used and [1] was added onto the variable name respond to distinguish the starting time solution from the second.

Exercises

  1. Given the expression $\displaystyle x^3-\frac{3}{2}x^2-7x+\frac{15}{2}$,
    1. Plot the expression and state how many roots in that location are.
    2. Use the Maple factor command to factor the expression.
    3. Apply the Maple solve command to find roots of the expression.
    4. Employ the Maple fsolve control to find roots of the expression.
  2. Given the part $f(x)=x \cos(x)-x^2+10x+4$,
    1. Plot the function over the interval $-10 \leq x \leq 10$.
    2. Find all roots using the fsolve control and characterization the output.
    3. Substitute each root back into the function to show that the answer is zero.
  3. Find all points where the functions $f(x)=-5x^2+10$ and $g(x)=x^3-4x^2-7x+10$ intersect each other. A plot of both functions on the aforementioned graph may be necessary to ensure that yous have found all intersection points. Once you accept institute the $x$ coordinate(s), substitute the solution(s) dorsum into either function to get the corresponding $y$ coordinate(s).

next up previous
Next: About this certificate ... Upwardly: lab_template Previous: lab_template
Dina Solitro
2004-09-13

watleyweepleget.blogspot.com

Source: http://www.math.wpi.edu/Course_Materials/MA1021A04/solve/node1.html

Enviar um comentário for "Maple Approximate Int Just Shows Command Again"