I'm writing a program to do left, middle and right handed rectangular approximation of an integral for an arbitrary number of rectangles. The program works fine at 5 or 10, but it takes a good five minutes to finish at 1000.

It goes like this:

```
:ClrHome
:Output(1,1,"Make sure that F(x)=Y[size=8]1[/size]!!!
:Pause
:Lbl θ
:ClrHome
:Menu("RAM Method","L,M&RRAM Approx.",A,"Setup",B,"About",C,"Exit",Z
:Lbl A
:DelVar R:DelVar M:DelVar L
:(P-N)/Q→D
:For(C,N,P-D,D
:R+Y1(C+D)*D→R
:M+Y1(C+.5D)*D→M
:L+Y1(C)*D→L
:End
:Output(1,1,"L=":Output(1,3,L
:Output(2,1,"M=":Output(2,3,M
:Output(3,1,"R=":Output(3,3,R
:Pause
:Goto θ
:Lbl B
:ClrHome
:Menu("Setup","N. Rectangles",D,"Interval",E,"Back",θ
:Lbl D
:Input " rectangles? ",Q
:Goto B
:Lbl E
:Input "Interval start? ",N
:Input "Interval end? ",P
:Goto B
:Lbl C
:ClrHome
:Output(1,1,"PATRICK COLLINS.
:Output(2,1,"2009.
:Pause
:Goto θ
:Lbl Z
:Return
```

I'm not too experienced with TI Basic, but I feel like there should be a more concise way to do the "R+Y1(C+D)*D→R" part. Am I just crazy?