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 Website 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. United-TI Top Management => Website
Author Message
Authentic INTJ

Super Elite (Last Title)

Joined: 25 Nov 2004
Posts: 3976

Posted: 07 Mar 2010 03:47:16 am    Post subject:

Meishe91 and I were talking about a possible new TI-Basic subforum. Here is how it would look:

Forum Name: "Here's the Breakdown." (that's with quotes)

Forum Description: Give your own explanations for how code works.

Pinned Topic: Breakdown of the Rules!
[indent]This subforum is not intended for people asking questions on how a particular program does stuff. Instead, here we ask members to dissect the code themselves! If you have stumbled upon or written a short-ish program that behaves in a very clever way, and all you can think about is sharing with others the secret behind the way it operates, then this is your haven.

Be clear. Be comprehensive. But most importantly, be courteous – if you are describing someone else's work of art, then please give credit where it is due. You can do this simply by providing a link to the place where you found it. Asking the code author's permission would even be the most honorable thing you could do.

This forum is an open-minded environment. If a part of an explanation turned out to be imperfect, then that can be let slide with the understanding that the reviewer gave it a serious effort. On the flipside, if it was false or misleading to the point where it would give an inexperienced programmer some terrible new habits, then some points of criticism are to be expected. This is only in the interest of adding enlightenment to the subject, rather than merely calling out mistakes.

Besides, no one likes seeing a good language getting mangled. Sheer exposure of many well-thought-out routines may act as an antidote to bad programming. Perhaps some of the snippets you'll find in this section will encourage you to write your programs with cleverness and beauty in mind.[/indent]
Example Thread: Pythagorean Theorem
[indent]Prompt X,Y
Menu("´´Find What?´´","Leg",0,"Hypotenuse",1
Lbl 0
Lbl 1

If you want to solve for a right triangle's chosen missing side but without the surplus of conditions, this is how it's done.

Given two legs of a right triangle, √(sideone[font="verdana"]²+sidetwo[font="verdana"]²) always equals the hypotenuse via the Pythagorean Theorem.

For a missing leg, you'd use √(sideone[font="verdana"]²-sidetwo[font="verdana"]²), where sideone is selected as the larger of the two known sides.

But if you use √(abs(sideone[font="verdana"]²-sidetwo[font="verdana"]²)), it doesn't matter which is larger, and the difference will stay the same.

The only real difference now is the sign of sidetwo: it's positive if searching for the hypotenuse; negative if not.

Any number minus twice itself becomes its negative. Make this subtraction only if looking for the leg, though.

√(abs(sideone[font="verdana"]²+sidetwo[font="verdana"]²-2*sidetwo[font="verdana"]²*L)); L is 0 if you want a positive sidetwo, 1 if you want it negative.

Factor the sidetwo[font="verdana"]² in the expression to end up with fewer terms: √(abs(sideone[font="verdana"]²+sidetwo[font="verdana"]²(1-2*L)))

To minimize the amount of work, assume "hypotenuse" until the user specifies the leg, then switch.

Do this by executing 0 on a line to save it to Ans, and then asking for a choice of side with Menu(.

If he selects "Hypotenuse," then go straight down to the expression, with Ans still equal to 0.

If he selects "Leg," then take a detour to Lbl 0 where 1 is executed, which increases Ans.

With Ans adopting the role that L had earlier, do the calculation for the respective side.

This handles all possible unknowns coming from any order of the inputs of knowns.[/indent]

Last edited by Guest on 01 Jul 2010 08:40:23 am; edited 1 time in total
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