11.07.2015 Views

Advanced Programming Guide

Advanced Programming Guide

Advanced Programming Guide

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

194 • Chapter 5: Numerical <strong>Programming</strong> in Maple1. Not all problems have analytical or symbolic solutions. For example,there are many forms of partial differential equations, but only a smallsubset have known closed-form solutions. Despite this, it is usuallypossible to find numerical solutions.2. The analytic solution that Maple returns to a problem may be verylarge or complex. To understand the behavior of these expressions,compute a floating-point approximation.3. In some cases, it is wasteful to compute an exact answer. Computingan analytic solution is not necessary if only an approximation isneeded. For example, to plot a solution, an approximation accurateto the resolution of the plotting device is sufficient.5.1 The Basics of evalfThe evalf command is the primary tool in Maple for performing floatingpointcalculations. It causes Maple to evaluate in software floating-pointmode. The Maple software floating-point arithmetic has an n-digit machinefloating-point model as its basis, but allows computations at arbitraryprecision. The environment variable Digits, which has an initialsetting of 10, determines the default number of digits for calculations.> evalf(Pi);3.141592654You can alter the number of digits either by changing the value ofDigits, or by specifying the number as an index to evalf. Note thatwhen you specify the number of digits as an index to evalf, the default,Digits, remains unchanged.> Digits := 20:> evalf(Pi);3.1415926535897932385> evalf[200](Pi);

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!