# Riemann Sum Maplet restart; PlotRiemann := proc( f, a, b, n ) Student:-Calculus1:-ApproximateInt( f, x=a..b, partition=n, output=plot, title=""); end proc: WriteRiemann := proc( f, a, b, n ) Student:-Calculus1:-ApproximateInt( f, x=a..b, partition=n, output=sum, title=""); end proc: use Maplets:-Elements in RiemannSumMaplet := Maplet( [["Enter a function ", TextBox['F']( value="cos(x)", width=10 ), "Left endpoint ", TextBox['a']( value="0", width=3 ), "Right endpoint ", TextBox['b']( value="4", width=3 )], ["Number of partitions", Slider['n']( 0..100, 10, 'majorticks'=20, 'minorticks'=5, 'snapticks'='false' )], [Plotter['P']( width=300, height=300 )], [MathMLViewer['RS']( height=75, width=400 )], [Button['B1']("Close", Shutdown(['F'])), Button['B2']("Plot", onclick = 'JustPlot'), Button['B3']("Show Riemann Sum", onclick = 'ShowSum')] ], Action['JustPlot']( Evaluate('P' = 'plot(F, x=a..b)') ), Action['ShowSum']( Evaluate('target'='P', 'function'='PlotRiemann', Argument( 'F' ), Argument( 'a' ), Argument( 'b' ), Argument( 'n' ) ), Evaluate('target'='RS', 'function'='WriteRiemann', Argument( 'F' ), Argument( 'a' ), Argument( 'b' ), Argument( 'n' ) ) ) ): end use: Maplets:-Display( RiemannSumMaplet );