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.

PLOT( CURVES( points ) );6.3 Maple Plotting Data Structures • 2311.551.51.451.41.351.31.252 4 6 8 10The sumplot procedure automates this technique.> sumplot := proc( s )> local term, n, a, b, psum, m, points, i;> if typematch( s, ’Sum’( term::algebraic,> n::name=a::integer..b::integer ) ) then> psum := evalf @ unapply( Sum(term, n=a..(a+m)), m );> points := [ seq( [[i,psum(i)], [i+1,psum(i)]],> i=1..(b-a+1) ) ];> points := map(op, points);> PLOT( CURVES( points ) );> else> error "expecting a Sum structure as input"> end if> end proc:Here is a sumplot of an alternating series.> sumplot( Sum((-1)^k/k, k=1..25 ));–0.5–0.55–0.6–0.65–0.7–0.75–0.85 10 15 20 25The limit of this sum is − ln 2.> Sum((-1)^k/k, k=1..infinity): % = value(%);

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

Saved successfully!

Ooh no, something went wrong!