Appendix
A-10: Solving Equations
Example A-10.5
Determine all real solutions of the equation cosx=x/4.
Solution
Maple Solution - Interactive
In Figure A-10.5(a), the graph of the line y=x/4 intersects the graph of the cosine in three places.
The Context Panel option Solve≻Numerically Solve for the given equation returns just the positive root, x=1.252353234.
plot([cos(x),x/4],x=-5..2,-1..1,color=[black,red]);
Figure A-10.5(a) Graph of cosx and x/4
The other two solutions could be obtained with the option Solve≻Numerically Solve from point, which launches a dialog into which a starting point for a root search can be entered. Starting from x = -2, say, yields the root x=−2.133332252, whereas starting from x = -4, say, yields the root x=−3.595304867.
The most efficient solution is obtained with the Roots option in the Student Calculus1 package. Its interactive implementation is detailed below.
Tools≻Load Package: Student Calculus 1
Loading Student:-Calculus1
Control-drag the equation; press the Enter key.
Context Panel: Student Calculus1≻Find Roots (From Figure A-10.5(a), it is clear that the roots lie in the interval −5,5.) Select "calculate numerically" as per Figure A-10.5(b)
Figure A-10.5(b) Roots dialog box
cosx=x/4→roots−3.595304867,−2.133332252,1.252353234
Maple Solution - Coded
If the functionalities of the solve command (for exact solutions of equations) and the fsolve command for numeric solutions are compared, it will be found that the only command in Maple that is capable of returning all exact or numeric real solutions of a single equation (of any type) is the Roots command in the Student Calculus1 package.
Student:-Calculus1:-Rootscosx=x/4,x,numeric
−3.595304867,−2.133332252,1.252353234
The alternative is to use fsolve, with a great deal more work.
Assign the equation to the name eq.
eq≔cosx=x/4:
Apply the fsolve command to the equation. This yields the positive root.
fsolveeq,x
Provide a starting value.
fsolveeq,x=−2;fsolveeq,x=−4
Provide an interval in which a root lies.
fsolveeq,x=−3..−1;fsolveeq,x=−5..−3
<< Previous Example Section A-10 Next Section of Appendix >>
© Maplesoft, a division of Waterloo Maple Inc., 2024. All rights reserved. This product is protected by copyright and distributed under licenses restricting its use, copying, distribution, and decompilation.
For more information on Maplesoft products and services, visit www.maplesoft.com
cosx=x/4
Download Help Document