11.07.2015 Views

Advanced Programming Guide

Advanced Programming Guide

Advanced Programming Guide

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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

270 • Chapter 6: <strong>Programming</strong> with Maple Graphics> eval(z);> end proc:The second argument to evalgrid must be the array (or hfarray)which receives the results; Maple must not convert it to a number beforeit calls evalhf. Indicate this special status to Maple using the specialfunction var whenever you call evalgrid from within evalhf. For moreinformation on numerical calculations, see Chapter 5.Testing the ProceduresHere gridpoints can use hardware floating-point arithmetic to calculatetwo of the numbers, but it must resort to software calculations in fourcases where the function turns out to be undefined.> gridpoints( (x,y) -> 1/sin(x*y) , 0..3, 0..3, 2, 3 );[undefined , undefined , undefined ][undefined , 1.00251130424672485 ,7.08616739573718667]In the following example, gridpoints can use hardware floating-pointfor all the calculations. Therefore, this calculation is faster, although thedifference is not apparent unless you try a much larger example.> gridpoints( (x,y) -> sin(x*y) , 0..3, 0..3, 2, 3 );[0. , 0. , 0.][0. , 0.997494986604054445 , 0.141120008059867213]If you ask for more digits than hardware floating-point arithmeticcan provide, then gridpoints must always use software floating-pointoperations.> Digits := 22:> gridpoints( (x,y) -> sin(x*y) , 0..3, 0..3, 2, 3 );> Digits := 10:[0. , 0. , 0.][0. , 0.9974949866040544309417 ,0.1411200080598672221007]

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

Saved successfully!

Ooh no, something went wrong!