Appendix
A-5: Evaluation
Example A-5.1
Evaluate x2+3 x−5 for
x=7
x=a2−1−a2.
Solution
Interactive Solution
Part (a)
Control-drag (or type) the given expression.
Context Panel: Evaluate at a Point≻7
x2+3 x−5→evaluate at point65
Part (b)
Expression palette: Evaluation template
Context Panel: Evaluate and Display Inline
x2+3 x−5x=a|f(x)x=a2−1−a2 = a2−1−a22+3⁢a2−3⁢1−a2−5
If the evaluation is at a value that is easily typed into a dialog box, the Context Panel options are convenient. However, if the value is more cumbersome, then the evaluation template can be the more convenient tool.
Coded Solution
Assign the given expression to q1.
q1≔x2+3 x−5
Use the eval command for immediate evaluation.
q2≔evalq1,x=7
Use the Eval command for delayed evaluation. Apply the value command to execute the evaluation.
q3≔Evalq1,x=a2−1−a2
valueq3
The older subs command, which makes a literal replacement, is not equivalent to the eval command because it does not evaluate after making the replacement. For example, using subs to set x=0 in x/sinx returns 0 because Maple sees 0/sin0 and does not evaluate the denominator to zero. The eval command evaluates the denominator to zero, and Maple issues a division-by-zero error, as it should. In general, the eval command should be used for making "substitutions" into expressions; subs is used for strictly literal replacements.
<< Previous Section of Appendix Section A-5 Next Example >>
© 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
Download Help Document