This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. TI-Basic => TI-BASIC
Author Message
navyfalcon


Advanced Newbie


Joined: 17 Mar 2008
Posts: 77

Posted: 04 Apr 2009 12:19:08 pm    Post subject:

The below code, except for the first 5 lines is the original line numbers.
It is not my program, but I'm trying to learn optimization
It has undergone some basic optimization from the information "tibasic optimization"
by dark line.
Can anyone tell me how to further optimize the code
Thank You
falcon


Code:

1. AAMath
2. from ticalc.org
3. Output(3,3,"MATH PROGRAM"
4. Output(5,2,"BY: LARS WEBB"
5. Primal_Fusion@hotmail.com
6. Lbl Z
7. ClrHome
8. Menu("MATH PROG","3-D",1,"2-D",2,"QUIT",4
9. Lbl 4
12. ClrHome
14. End
15. Lbl 1
16. Menu("3-D","CUBE",1A,"BOX",1B,"PYRAMID",1C,"CYLINDER",1D,"SPHERE",1E,"CONE",1F,"MORE",5
17. Lbl 5
18. Menu("MORE 3-D","SPHERICAL SECTOR",1G,"1 BASE SEGMENT OF SPHERE",1H,...
..."2 BASE SEGMENT OF SPHERE",1I,"TOPLESS CONE",1J,"PRISM",1K,"FRUSTUM(PYRAMID)",1L,"BACK",6
19. Lbl 6
20. Goto Z
21. Lbl 1A                  CUBE
24. Input "SIDE LENGTH=",S
25. S³->Z             
31. 6S²->X
    Lbl V                   VOLUME - SURFACE AREA
26. Disp "VOLUME=",Z
32. Disp "SURFACE AREA="
27. Pause X
    DelVar ZDelVar X
    Goto 1
35. Lbl 1B                 BOX
38. Prompt A,B,C
39. ABC->Z
45. 2(AB+BC+AC)->X
    Goto V
49. Lbl 1C                 PYRAMID
52. Input "AREA OF BASE=",B
53. Input "ALTITUDE=",A
59. Input "LATERAL HEIGHT",H
60. Input "SIDE OF BASE=",C
54. AB/3->Z
61. C²->V
62. 4CH/2->R
63. V+R->X
    Goto V
68. Input "LATERAL HEIGHT",A
69. Input "SIDE OF BASE=",C
70. v(3)C)/4->L
71. (C3A)/2->M
72. L+M->X
    Goto V
76. Lbl 1D                 CYLINDER
79. Input "RADIUS=",R
80. Input "HEIGTH=",H
81. piR²H->Z
88. 2piR(R+H)->X
    Goto V
92. Lbl 1E                 SPHERE
95. Input "RADIUS=",R
96. (4/3)*(piR^3))->Z
102. 4piR²->X
     Goto V
106. Lbl 1F                CONE
109. Input "AREA OF BASE=",A
110. Input "HEIGHT=",H
111. AH/3->Z
116. Input "RADIUS=",R
118. piR²+piRH->X
     Goto V
122. Lbl 1G                SPHERICAL SECTOR
123. Input "RADIUS=",R
124. Input "HEIGHT=",H
125. (piR²H)*(2/3)->Z
     Goto V
129. Lbl 1H                1 BASE SEGMENT OF SPHERE
132. Input "RADIUS=",R
133. Input "HEIGHT=",H
134. (piH²(3R-H))/3->Z
141. 2piRH->X
     Goto V
145. Lbl 1I                2 BASE SEGMENT OF SPHERE
148. Prompt A,B,H
149. (piH(3A²+3B²+H²))/6->Z
154. Input "RADIUS=",R
156. 2piRH->X
     Goto V
160. Lbl 1J                TOPLESS CONE
163. Input "RADIUS 1=",R
164. Input "RADIUS 2=",A
165. Input "HEIGHT=",H
166. (H/3)((piR²)²+(piA²)²+sqrt((piR²)(piA²)->Z
174. pi(R²+A²+(R+A)sqrt(R-A)²+H))->X
     Goto V
178. Lbl 1K                PRISM
181. Input "AREA OF BASE=",B     
182. Input "ALTITUDE=",A
183. AB->Z
189. Input "NUMBER OF SIDES=",N
190. Input "AREA OF SIDE=",S
191. 2B+SN->X
     Goto V
195. Lbl 1L                      FRUSTUM(PYRAMID)
196. Menu("FRUSTUM(PYRIMAD)","SURFACE AREA",8A,"VOLUME",8B
197. Lbl 8A
198. Input "BASE 1 LENGTH",A
199. Input "BASE 1 WIDTH",B
200. Input "BASE 2 LENGTH",C
201. Input "BASE 2 WIDTH",D
202. Input "HEIGHT",H
203. AB+CD->V
204. (A+C)H/2->U
205. (B+D)H/2->T
206. 2U+2T+V->X
     Goto V
210. Lbl 8B
211. Input "AREA OF BASE 1=",A
212. Input "AREA OF BASE 2=",B
213. Input "HEIGHT=",H
214. (H/3)(A+B+sqrt(AB)->Z
     Goto V
218. Lbl 2
219. Menu("2-D","RIGHT TRI",2A,"EQUAL TRI",2B,"TRIANGLE",2C,"DIAGNOL PERP",2D,...
..."RECTANGLE",2E,"RHOMBUS",2F,"MORE",7
220. Lbl 7
221. Menu("MORE 2-D","TRAPEZIOD",2G,"QUAD",2H,"POLYGON",2I,"CIRCLE",2J,"BACK",8
222. Lbl 8
223. Goto Z
224. Lbl 2A             RIGHT TRI
225. Prompt A,B
226. (AB)/2->Z
     Lbl A
227. Disp "AREA=",Z
     Disp "SURFACE AREA="
     Pause X
     DelVar ZDelVar X
     Goto 2
230. Lbl 2B             EQUAL TRI
231. Input "SIDE",S
232. sqrt(3S)/4->Z
     Goto A
236. Lbl 2C             TRIANGLE
237. Prompt A,B,C
238. (A+B+C)/2->S
239. sqrt(S(S-A)(S-B)(S-C))->Z
     Goto A
243. Lbl 2D             DIAGNOL PERP
244. Input "DIAGNOL 1=",D
245. Input "DIAGNOL 2=",A
246. (DA)/2->Z
     Goto A
250. Lbl 2E             RECTANGLE
251. Prompt B,H
252. BH->Z
     Goto A
256. Lbl 2F             RHOMBUS
257. Input "DIAGONAL 1=",D
258. Input "DIAGONAL 2=",A
259. (AD)/2->Z
     Goto A
263. Lbl 2G             TRAPEZIOD
264. Prompt A,B,H
265. ((A+B)H)/2->Z
     Goto A
269. Lbl 2H             QUAD
270. Prompt A,B,C,D
271. Input "DIAGNOL 1=",E
272. Input "DIAGNOL 2=",F
273. (v(4E²F²-(B²+D²-A²-C²)²))/4->Z
     Goto A
277. Lbl 2I             POLYGON
278. Input "RADIUS=",R
279. Input "NUMBER OF SIDES=",N
280. ((NR²)(sin(360/N))/2->Z
     Goto A
284. Lbl 2J             CIRCLE
285. Input "RADIUS=",R
286. piR²->Z
     Goto A
 


Last edited by Guest on 04 Apr 2009 08:27:46 pm; edited 1 time in total
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 04 Apr 2009 08:50:36 pm    Post subject:

Four things:

  1. "DarkerLine." He went out of his way to help you, so the least you could do is spell his name right.
  2. Because of some very long lines in your post, a horizontal scrollbar was created, and the edit/quote buttons were pushed well outside of the browser window. I edited your post to split these long lines into two lines, and even used a "..." to indicate where.
  3. Emoticons. Disable them under "Post Options" whenever they crop up inside your code (ex: √(AB) produces √(A).
  4. Explain the line numbering to me again?
I'm going to copy, search/replace as necessary, and then paste the original code here to give myself and others a chance to start fresh with the original code (without comments), and just to be certain that it will function the same way as the author intended. Be aware that this will also carry over the mistakes that the author made, such as the extra closing parentheses in lines 70 and 174 (both of which will cause errors), and various spelling mistakes.


Code:
ClrHome
Output(3,3,"MATH PROGRAM"
Output(5,2,"BY: LARS WEBB"
Pause
ClrHome
Lbl Z
ClrHome
Menu("MATH PROG","3-D",1,"2-D",2,"QUIT",4
Lbl 4
Output(4,3,"ENJOY CLASS"
Pause
ClrHome
Stop
End
Lbl 1
Menu("3-D","CUBE",1A,"BOX",1B,"PYRAMID",1C,"CYLINDER",1D,"SPHERE",1E,"CONE",1F,"MORE",5
Lbl 5
Menu("MORE 3-D","SPHERICAL SECTOR",1G,"1 BASE SEGMENT OF SPHERE",1H,...
..."2 BASE SEGMENT OF SPHERE",1I,"TOPLESS CONE",1J,"PRISM",1K,"FRUSTUM(PYRAMID)",1L,"BACK",6
Lbl 6
Goto 1
Lbl 1A
Menu("CUBE","SURFACE AREA",A,"VOLUME",B
Lbl B
Input "SIDE LENGTH=",S
S³→Z
Disp "VOLUME IS",Z
Pause
Goto Z
Lbl A
Input "SIDE=",S
6S²→Z
Disp "SURFACE AREA IS",Z
Pause
Goto Z
Lbl 1B
Menu("BOX","SURFACE AREA",C,"VOLUME",D
Lbl D
Prompt A,B,C
ABC→Z
Disp "VOLUME IS",Z
Pause
Goto Z
Lbl C
Prompt A,B,C
2(AB+BC+AC)→Z
Disp "SURFACE AREA IS",Z
Pause
Goto Z
Lbl 1C
Menu("PYRAMID","AREA (SQUARE)",E,"AREA (TRIANGLEL",W,"VOLUME",F
Lbl F
Input "AREA OF BASE=",B
Input "ALTITUDE=",A
AB/3→Z
Disp "VOLUME IS",Z
Pause
Goto Z
Lbl E
Input "LATERAL HEIGHT",A
Input "SIDE OF BASE=",C
C²→V
4CA/2→R
V+R→Z
Disp "SURFACE AREA IS",Z
Pause
Goto Z
Lbl W
Input "LATERAL HEIGHT",A
Input "SIDE OF BASE=",C
√(3)C)/4→L
(C3A)/2→M
L+M→Z
Disp "SURFACE AREA",Z
Pause
Goto Z
Lbl 1D
Menu("CYLINDER","SURFACE AREA",G,"VOLUME",H
Lbl H
Input "RADIUS=",R
Input "HEIGTH=",H
πR²H→Z
Disp "VOLUME IS",Z
Pause
Goto Z
Lbl G
Input "RADIUS=",R
Input "HEIGHT=",H
2πR(R+H)→Z
Disp "SURFACE AREA IS",Z
Pause
Goto Z
Lbl 1E
Menu("SPHERE","SURFACE AREA",I,"VOLUME",J
Lbl J
Input "RADIUS=",R
(4/3)*(πR³))→Z
Disp "VOLUME IS",Z
Pause
Goto Z
Lbl I
Input "RADIUS=",R
4πR²→Z
Disp "SURFACE AREA IS",Z
Pause
Goto Z
Lbl 1F
Menu("CONE","SURFACE AREA",K,"VOLUME",L
Lbl L
Input "AREA OF BASE=",A
Input "HEIGHT=",H
AH/3→Z
Disp "VOLUME IS",Z
Pause
Goto Z
Lbl K
Input "RADIUS=",R
Input "HEIGHT=",H
πR²+πRH→Z
Disp "SURFACE AREA IS",Z
Pause
Goto Z
Lbl 1G
Input "RADIUS=",R
Input "HEIGHT=",H
(πR²H)*(2/3)→Z
Disp "VOLUME IS",Z
Pause
Goto Z
Lbl 1H
Menu("1 BASE SEGMENT OF A SPHERE","SURFACE AREA",M,"VOLUME IS",N
Lbl N
Input "RADIUS=",R
Input "HEIGHT=",H
(πH²(3R-H))/3→Z
Disp "VOLUME IS",Z
Pause
Goto Z
Lbl M
Input "RADIUS=",R
Input "HEIGHT=",H
2πRH→Z
Disp "SURFACE AREA IS",Z
Pause
Goto Z
Lbl 1I
Menu("2 SEGMENTBASE OF A SPHERE","SURFACE AREA",O,"VOLUME",P
Lbl P
Prompt A,B,H
(πH(3A²+3B²+H²))/6→Z
Disp "VOLUME IS",Z
Pause
Goto Z
Lbl O
Input "RADIUS=",R
Input "HEIGHT=",H
2πRH→Z
Disp "SURFACE AREA IS",Z
Pause
Goto Z
Lbl 1J
Menu("TOPLESS CONE","SURFACE AREA",Q,"VOLUME",R
Lbl R
Input "RADIUS ONE=",R
Input "RADIUS TWO=",A
Input "HEIGHT=",H
(H/3)((πR²)²+(πA²)²+√((πR²)(πA²)→Z
Disp "VOLUME IS",Z
Pause
Goto Z
Lbl Q
Input "RADIUS 1=",R
Input "RADIUS 2=",A
Input "HEIGHT=",H
π(R²+A²+(R+A)√(R-A)²+H))→Z
Disp "SURFACE AREA IS",Z
Pause
Goto Z
Lbl 1K
Menu("PRISM","SURFACE AREA",U,"VOLUME",T
Lbl T
Input "AREA OF BASE=",B
Input "ALTITUDE=",A
AB→Z
Disp "VOLUME IS",Z
Pause
Goto Z
Lbl U
Input "AREA OF BASE=",A
Input "NUMBER OF SIDES=",N
Input "AREA OF SIDE=",S
2A+SN→Z
Disp "SURFACE AREA IS",Z
Pause
Goto Z
Lbl 1L
Menu("FRUSTUM(PYRIMAD)","SURFACE AREA",8A,"VOLUME",8B
Lbl 8A
Input "BASE 1 LENGTH",A
Input "BASE 1 WIDTH",B
Input "BASE 2 LENGTH",C
Input "BASE 2 WIDTH",D
Input "HEIGHT",H
AB+CD→V
(A+C)H/2→U
(B+D)H/H→T
2U+2T+V→Z
Disp "SURFACE AREA IS",Z
Pause
Goto Z
Lbl 8B
Input "AREA OF BASE 1=",A
Input "AREA OF BASE 2=",B
Input "HEIGHT=",H
(H/3)(A+B+√(AB)→Z
Disp "VOLUME IS",Z
Pause
Goto Z
Lbl 2
Menu("2-D","RIGHT TRI",2A,"EQUAL TRI",2B,"TRIANGLE",2C,"DIAGNOL PERP",2D,...
..."RECTANGLE",2E,"RHOMBUS",2F,"MORE",7
Lbl 7
Menu("MORE 2-D","TRAPEZIOD",2G,"QUAD",2H,"POLYGON",2I,"CIRCLE",2J,"BACK",8
Lbl 8
Goto 2
Lbl 2A
Prompt A,B
(AB)→Z
Disp "AREA IS",Z
Pause
Goto Z
Lbl 2B
Input "SIDE",S
√(3S)/4→Z
Disp "AREA IS",Z
Pause
Goto Z
Lbl 2C
Prompt A,B,C
(A+B+C)/2→S
√(S(S-A)(S-B)(S-C))→Z
Disp "AREA IS",Z
Pause
Goto Z
Lbl 2D
Input "DIAGNOL 1=",D
Input "DIAGNOL 2=",A
(DA)/2→Z
Disp "AREA IS",Z
Pause
Goto Z
Lbl 2E
Prompt B,H
BH→Z
Disp "AREA IS",Z
Pause
Goto Z
Lbl 2F
Input "DIAGONAL ONE=",D
Input "DIAGONAL TWO=",A
(AD)/2→Z
Disp "AREA IS",Z
Pause
Goto Z
Lbl 2G
Prompt A,B,H
((A+B)H)/2→Z
Disp "AREA IS",Z
Pause
Goto Z
Lbl 2H
Prompt A,B,C,D
Input "DIAGNOL ONE=",E
Input "DIAGNOL TWO=",F
(√(4E²F²-(B²+D²-A²-C²)²))/4→Z
Disp "AREA IS",Z
Pause
Goto Z
Lbl 2I
Input "RADIUS=",R
Input "NUMBER OF SIDES=",N
((NR²)(sin(360/N))/2→Z
Disp "AREA IS",Z
Pause
Goto Z
Lbl 2J
Input "RADIUS=",R
πR²→Z
Disp "AREA IS",Z
Pause
Goto Z


Last edited by Guest on 04 Apr 2009 08:53:54 pm; edited 1 time in total
Back to top
navyfalcon


Advanced Newbie


Joined: 17 Mar 2008
Posts: 77

Posted: 05 Apr 2009 05:17:44 pm    Post subject:

Original code:
from ticalc.org
-
the changes to the code are my crude attempts at optimizing
the linenumbers from the original and changed code are the same
My goal is to learn more about optimizing code
The information I used was published on ticalc.org
tibasic optimizer by Dark side programming
(my appologies to DarkerLine)
Thank You
falcon
-


Last edited by Guest on 05 Apr 2009 11:50:53 pm; edited 1 time in total
Back to top
kalan_vod


Advanced Member


Joined: 04 Sep 2005
Posts: 446

Posted: 05 Apr 2009 11:38:31 pm    Post subject:

That is funny, I have used this program a few times early on in High School...This program is jumping all over the place, I would suggest starting out with a smaller program, this one should be around 15k on calc IIRC (18k ish)..
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 05 Apr 2009 11:55:55 pm    Post subject:

*removes code from post #3*

navyfalcon, I pasted the original code already – there's no need to duplicate efforts. Plus, it broke the page layout in the same fashion as the last time. I have to wonder whether you read the second half of my post at all.


Last edited by Guest on 05 Apr 2009 11:58:41 pm; edited 1 time in total
Back to top
navyfalcon


Advanced Newbie


Joined: 17 Mar 2008
Posts: 77

Posted: 06 Apr 2009 10:40:54 am    Post subject:

Yes, I read all of the reply
it was the answer to this question

Explain the line numbering to me again?

The original code, I numbered the lines
and when I changed it, I left the original
line numbers in for reference
I thought it might help

Yes, I really appreciate the help I get here
and after I learn enough, I may be able to help others

Thank You
falcon
Back to top
TKD_01


Advanced Newbie


Joined: 20 Feb 2009
Posts: 51

Posted: 10 Apr 2009 02:02:46 pm    Post subject:

Well, that program seems quite optimized already, thus rendering it a bad example of ways to optimize code. I recommend that what you do is write your own program, optimize it to the best of your ability, then post it up on this forum for other people to further optimize. This way, you can easily understand what you're optimizing, because you wrote the code yourself.

Just a thought Smile
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 10 Apr 2009 11:01:36 pm    Post subject:

TKD_01 wrote:
Well, that program seems quite optimized already, thus rendering it a bad example of ways to optimize code.
You can't look at (AB)→Z in line 228 and say that this program is well-optimized. Rather, it provides several opportunities to illustrate how to improve this code from a mathematical standpoint. Before we do that, however, if we move Pause:ClrHome below Lbl Z, remove the extra ClrHome, and change Lbl Z to Repeat 0, we can replace every Pause:Goto Z with an End and it will still work the same, but saving 104 bytes in the process. An additional three bytes can be saved for every instance where a calculation is stored to a variable prior to the variable being displayed, as opposed to the calculation itself being displayed; essentially, that's three bytes per label.

Now, here are just a few items which could stand some improvement:

Old
Improved

C[font="verdana"]²→V
4CA/2→R
V+R→Z

C(2A+C

√(3)C)/4→L [sic]
(C3A)/2→M
L+M→Z

C/4(6A+√(3

(4/3)*([font="times new roman"]πR[font="verdana"]³))→Z [sic]
4/3[font="times new roman"]πR[font="verdana"]³

[font="times new roman"]πR[font="verdana"]²+[font="times new roman"]πRH→Z
[font="times new roman"]πR(H+R

(H/3)(([font="times new roman"]πR[font="verdana"]²)[font="verdana"]²+([font="times new roman"]πA[font="verdana"]²)[font="verdana"]²+√(([font="times new roman"]πR[font="verdana"]²)([font="times new roman"]πA[font="verdana"]²)→Z
[font="times new roman"]πHmean({[font="times new roman"]πA^4,AR,[font="times new roman"]πR^4

[font="times new roman"]π(R[font="verdana"]²+A[font="verdana"]²+(R+A)√(R-A)[font="verdana"]²+H))→Z [sic]
[font="times new roman"]πH+2[font="times new roman"]πR[font="verdana"]²

AB+CD→V
(A+C)H/2→U
(B+D)H/H→T [sic]
2U+2T+V→Z

AB+CD+AH+CH+2B+2D

√(3S)/4→Z
4‾¹√(3S

(A+B+C)/2→S
√(S(S-A)(S-B)(S-C))→Z

.5(A+B+C
√(Ansprod(Ans-{A,B,C

(Remember that each of these will become the argument of the Disp that follows it.)

A smarter, adaptive approach to related problems is especially important when building optimizations. Regarding the Pythagorean Theorem, instead of giving the user a different set of prompts for each unknown side (totaling six prompts in a program), you can note that there are two expressions—one for a leg and one for a hypotenuse—and then use the similarity in those two expressions to craft one adaptive statement that will cover all cases of two known sides versus one unknown side:

1:Menu( "░░░Find what?░░░","Leg",0,"Hypotenuse",1
Lbl 0:0:Lbl 1
Disp "Two known sides?
Prompt A,B
√(abs(A[font="verdana"]²
+B[font="verdana"]²(2Ans-1

I agree wholeheartedly that designing your own programs is a good way to move forward, but you should avoid mimicking others' programming habits, especially if you don't have good enough reason to believe that their approaches are better than yours. I have seen many otherwise good programmers abusing the "technique" of multiplying two piecewise expressions together rather than simply applying the basic logic operators, and it's those kinds of mental roadblocks that will blind a person from beautiful solutions that exist right under their noses.

[EDIT] – Fixed an error in the above program.

Last edited by Guest on 11 Jul 2010 05:54:11 pm; edited 1 time in total
Back to top
TKD_01


Advanced Newbie


Joined: 20 Feb 2009
Posts: 51

Posted: 11 Apr 2009 12:38:37 pm    Post subject:

Once again, you could find tens of hundreds of optimizations in some other persons code. I know for a fact that doing these corrections in some other persons code is as good as sitting down and screwing a piece of wood on a random place on a couch. If you don't make the code, or build the couch, you won't know where you're putting it into putting into the code, or why you putting it in there. Now, I'm not saying that general optimizations that could be found in any code should be overlooked.

A+A+A+A->A


4A->A

That is a simple example of a good general optimization.

However,
"Before we do that, however, if we move Pause:ClrHome below Lbl Z, remove the extra ClrHome, and change Lbl Z to Repeat 0, we can replace every Pause:Goto Z with an End and it will still work the same, but saving 104 bytes in the process."
Would not help anybody, because they don't know what the label is for, or what's in between the Repeat and End, and would not be able to expand beyond the fact that they're changing a couple of statements in some other code.

Now, I will fully admit that I overlooked several optimizations, and I will give credit to you for finding them, WereGoose, but what I do not appreciate is being looked down upon because one bit that I mentioned was incorrect. I'm asking that you please consider what I mentioned in the rest of my above statement.
Back to top
navyfalcon


Advanced Newbie


Joined: 17 Mar 2008
Posts: 77

Posted: 11 Apr 2009 01:15:33 pm    Post subject:

I appreciate all help that I receive.
And yes, I know what the code means. I learned math when we used slide rules and math tables
(before calculators). I am trying to learn how to program and optimize code for the TI-83.
I can teach you how to use a slide rule, but they are obsolete. I am trying to learn how to
use the calculator effectively and program it. Now, most I can do is use a formula and enter
values for a solution. Pretty simple. What I am trying to learn is how to remove bits and bytes
(or code optimization).
The guidance I obtain on this forum is far superior to the other forums, and I appreciate all the help.
Thanks to everybody that helps
-
falcon
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 11 Apr 2009 05:35:18 pm    Post subject:

TKD_01, I often leave the initial impression that you just felt, but that's not at all the purpose behind my posts. Might it have been less jarring if I substituted the impersonal pronoun "one" for "you," as in "one can easily mistake pragmatism for arrogance?" Overall, please forgive me if I am not as sociable as practical. Wink

Last edited by Guest on 11 Apr 2009 06:50:11 pm; edited 1 time in total
Back to top
TKD_01


Advanced Newbie


Joined: 20 Feb 2009
Posts: 51

Posted: 11 Apr 2009 08:19:21 pm    Post subject:

Weregoose wrote:
TKD_01, I often leave the initial impression that you just felt, but that's not at all the purpose behind my posts. Might it have been less jarring if I substituted the impersonal pronoun "one" for "you," as in "one can easily mistake pragmatism for arrogance?" Overall, please forgive me if I am not as sociable as practical. Wink

No, I do appreciate very much the fact that you are direct and practical. I believe that part of the problem is the fact that expression cannot be shown easily over text. In most cases, I accept your kinds of comments as constructive criticism because of that very reason. I would like to apologize, myself, because after reading the first paragraph, I skimmed the rest of your post and then vented in mine. I did not read the last paragraph in which you agreed with me on the subject of self-programming--which turned out to be the basis for my follow-up post.

So once again, I apologize for arriving at hasty conclusions in my previous post, and, as previously stated, I do not feel that your post was anything more than well thought through constructive criticism. :)

Sorry for this whole misunderstanding that I started Neutral
Back to top
Weregoose
Authentic INTJ


Super Elite (Last Title)


Joined: 25 Nov 2004
Posts: 3976

Posted: 11 Apr 2009 09:09:31 pm    Post subject:

Don't worry: I'm goose enough to accept it. :)

And navyfalcon, your appreciation is certainly not unnoticed – we're glad to be of help!


Last edited by Guest on 12 Apr 2009 07:30:03 am; edited 1 time in total
Back to top
thebetter1


Advanced Newbie


Joined: 09 Jul 2008
Posts: 86

Posted: 15 Apr 2009 08:00:35 pm    Post subject:

You can optimize expressions like (X+Y)/2 by doing .5(X+Y. However, the calculator will occasionally give a slightly different result when doing this, so you may need to add int(.
Back to top
calc84maniac


Elite


Joined: 22 Jan 2007
Posts: 770

Posted: 15 Apr 2009 11:57:06 pm    Post subject:

thebetter1 wrote:
You can optimize expressions like (X+Y)/2 by doing .5(X+Y. However, the calculator will occasionally give a slightly different result when doing this, so you may need to add int(.

With .5 I doubt there will be any rounding errors though. Smile
Back to top
navyfalcon


Advanced Newbie


Joined: 17 Mar 2008
Posts: 77

Posted: 30 Apr 2009 01:45:39 am    Post subject:

I optimized it a little:
Added "VOLUME="->Str1
"SURFACE AREA="->STR2
Changed:
Lbl 1A
Input "SIDE LENGTH=",S
S^3->Z
6S^2->X
Lbl V
Disp Str1,Z
Disp Str2
Pause X
DelVar ZDelVar X:ClrHome
Goto Z
Lbl 1B
Input "LENGTH=",A:Input "WIDTH=",B:Input "HEIGHT=",C
ABC->Z
2(AB+BC+AC)->X
Goto V
-
by using Goto V, I was able to eliminate a lot of repeats
Also using the strings to store words, I eliminated a lot of repeats
which reduced the code a lot
-
Thank you for all the help.
I am learning by the help and reading the optimization tutorials.
-
falcon
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement