Don't have an account? Register now to chat, post, use our tools, and much more.
Online Users
There are 121 users online: 4 members, 87 guests and 30 bots.
Bots: VoilaBot (2), Spinn3r (2), MSN/Bing (1), Magpie Crawler (3), VoilaBot (1), Googlebot (19), MSN/Bing (2).
SAX
 » Goto page 1, 2  Next
Author Message
ThankYouGod

Newbie

Joined: 17 Nov 2011
Posts: 11

 Posted: 17 Nov 2011 05:31:12 pm    Post subject: Need Some Newbie TI-BASIC Help 3 Problems I have: Be warned, very basic: Write 3 separate programs that: Find the hypotenuse, c, of a right triangle when both legs are given. Find a leg, b, of a right triangle when c and a are given. Calculates the solutions for any quadratic equation, with coefficients a, b and c using the keys on the calculator and the Quadratic Formula.
_player1537

Guru-in-Training

Joined: 25 Nov 2009
Posts: 2958

 Posted: 17 Nov 2011 05:32:26 pm    Post subject: Just making sure, this isn't homework, right?_________________http://tanner.myserverathome.com
KermMartian

Joined: 14 Mar 2005
Posts: 55763
Location: Earth, Sol, Milky Way

 Posted: 17 Nov 2011 05:33:27 pm    Post subject: And if it is, let us help you correct your proposed solutions rather than writing the code for you. What sort of ideas did you have thus far?_________________
souvik1997

Guru-in-Training

Joined: 19 Apr 2010
Posts: 2870

 Posted: 17 Nov 2011 05:34:41 pm    Post subject: Code: ```Prompt A,B Disp abs(A+Bi //complex i ``` Code: ```Prompt A,C Disp √(CČ-AČ ``` Code: ```a+bi Prompt A,B,C √(BČ+4AC {-B+Ans, -B-Ans Disp Ans/(2A ``` That should be it, but I think it could be optimized. Edit: If you want, we could help you try to understand this code so you could make programs like this on your own in the future. Please post any questions, if you have any._________________CALCnet Tournament-38% deviantArt Last edited by souvik1997 on 17 Nov 2011 05:41:22 pm; edited 1 time in total
ThankYouGod

Newbie

Joined: 17 Nov 2011
Posts: 11

 Posted: 17 Nov 2011 05:36:37 pm    Post subject: It is homework, so I was thinking for my first one: Code: ```PROGRAM: Hypotenuse :INPUT "a=", :INPUT "b=", :(a^2)+(b^2)=c :sqrt c``` I didn't get further than that, at the moment.
souvik1997

Guru-in-Training

Joined: 19 Apr 2010
Posts: 2870

Posted: 17 Nov 2011 05:37:52 pm    Post subject:

 ThankYouGod wrote: It is homework, so I was thinking for my first one: PROGRAM: Hypotenuse :INPUT "a=", :INPUT "b=", a^2)+(b^2)=c :sqrt c I didn't get further than that, at the moment.

In TI-BASIC, you would use the → (STO>) token to store values into variables, not the = that is present in most computer programming languages.
_________________
CALCnet Tournament-38%

deviantArt
ThankYouGod

Newbie

Joined: 17 Nov 2011
Posts: 11

 Posted: 17 Nov 2011 05:41:16 pm    Post subject: Instead of the =, I should replace it as →? Code: ```PROGRAM: Hypotenuse :INPUT "a→", :INPUT "b→", :(aČ)+(bČ)→c :√c :DISP "HYPOTENUSE=",c```
Aes_Sedia5

Minor Calculator Deity

Joined: 01 Sep 2011
Posts: 1002
Location: Where Nightmares end and Dreams begin

 Posted: 17 Nov 2011 05:42:23 pm    Post subject: Ok I have good code for you that should answer any problem like this you would ever need. And then some. Code: ``` :"SIDE→Str1 :"ANGLE→Str2 :Disp "INPUT ZERO","FOR PIECES","NOT KNOWN :Input Str1+"A",A :Input Str2+"A",Z :Input Str1+"B",B :Input Str2+"B",Y :Input Str1+"C",C :Input Str2+"C",X :Repeat ABCXYZ :If BZYnot(A :Bsin(Z)/sin(Y)→A :If ZYnot(X :180-(Z+Y)→X :If AXZnot(C :Asin(X)/sin(Z)→C :If ABZnot(B :Asin(Y)/sin(Z)→B :If BAZnot(Y :sin{^-1}(Bsin(Z)/A)→Y :If YXnot(Z :180-(Y+X)→Z :If AXCnot(Z :sin{^-1}(Asin(X)/C)→Z :If AYBnot(Z :sin{^-1}(Asin(Y)/B)→Z :If CYBnot(X :sin{^-1}(Csin(Y)/B)→X :If CZAnot(X :sin{^-1}(Csin(Z)/A)→X :If BXYnot(C :Bsin(X)/sin(Y)→C :If CYXnot(B :Csin(Y)/sin(X)→B :If CZXnot(A :Csin(Z)/sin(X)→A :If BXCnot(Y :sin{^-1}(Bsin(X)/C)→Y :If ZXnot(Y :180-(Z+X)→Y :If BCXnot(A :B{^2}+C{^2}-2BCcos(X)→A :If ACYnot(B :A{^2}+C{^2}-2ACcos(Y)→B :If ABZnot(C :A{^2}+B{^2}-2ABcos(Z)→C :End :Disp Str1+"A" :Pause A :Disp Str2+"A" :Pause Z :Disp Str1+"B" :Pause B :Disp Str2+"B" :Pause Y :Disp Str1+"C" :Pause C :Disp Str2+"C" :Pause X :End ``` It is a bit long, but use this as a base line. Make sure you understand it. If you need help understanding anything let me know._________________ Last edited by Aes_Sedia5 on 17 Nov 2011 05:43:53 pm; edited 1 time in total
souvik1997

Guru-in-Training

Joined: 19 Apr 2010
Posts: 2870

Posted: 17 Nov 2011 05:43:16 pm    Post subject:

 ThankYouGod wrote: Instead of the =, I should replace it as →? Code: ```PROGRAM: Hypotenuse :INPUT "a→", :INPUT "b→", :(aČ)+(bČ)→c :√c :DISP "HYPOTENUSE=",c```

For the Input statements, you wouldn't use the "→"; the second argument is just an optional prompt that you can display. The "→" token can't be stored in a string, so that would unfortunately not work. The third line, however is correct.
_________________
CALCnet Tournament-38%

deviantArt

Last edited by souvik1997 on 17 Nov 2011 05:43:57 pm; edited 1 time in total
_player1537

Guru-in-Training

Joined: 25 Nov 2009
Posts: 2958

 Posted: 17 Nov 2011 05:43:36 pm    Post subject: You can use [ code ] (without the spaces) tags and put your code inside of it, then end your code with [ / code ] (no spaces, again). Also, you can use SourceCoder to print out your code. If you feed it an .8xp file of your program (from the calculator), it will spit out the textual representation of it. In your code, you need a variable after the Input statements. Ie, Input "A=",A. To store to variables, you use the Sto-> symbol, for instance: AČ+BČ->C. To write out variables, numbers, or strings, you use Disp, like: Disp sqrt(C). You can read some TI-Basic tutorials at ticalc.org. Also, I urge you not to copy Souvik's code, and instead, to learn what the code does and know why it does what it does, and then to write your own. Your teacher isn't going to be impressed if you come up with that code, imho, because she will think that you stole it. Souvik wrote it very well, but if you had no idea how to program yesterday and you come in with that, it does seem very suspicious._________________http://tanner.myserverathome.com
ThankYouGod

Newbie

Joined: 17 Nov 2011
Posts: 11

 Posted: 17 Nov 2011 05:53:10 pm    Post subject: Code: ```PROGRAM: Hypotenuse    :Input "Leg 1=",A :Input "Leg 2=", B :(aČ)+(bČ)→C :√C→C :Disp "Hypotenuse=",C```Last edited by ThankYouGod on 17 Nov 2011 05:57:31 pm; edited 1 time in total
Aes_Sedia5

Minor Calculator Deity

Joined: 01 Sep 2011
Posts: 1002
Location: Where Nightmares end and Dreams begin

 Posted: 17 Nov 2011 05:55:54 pm    Post subject: Good. I think. But this will work a lot better. Depending on what you need. Code: ``` "SIDE"→Str9 :Disp " . "," . . C"," .  . "," .   . ","A.    . "," .......","   B" :Pause //THis just displays a triangle. :ClrDraw :Text(1,1,"ENTER ZERO FOR THE SIDE YOUR FINDIN :rand(100 :Input Str9+"A",A :Input Str9+"B",B :Input Str9+"C",C :If not(A :Then :ClrHome :Disp Str9+" A :Pause sqrt(((C{^2}-B{^2}) :End :If not(B :Then :ClrHome :Disp Str9+" B :Pause sqrt((C{^2}-A{^2}) :End :If not(C :Then :Disp Str9+" C :Pause sqrt((A{^2}+B{^2}) ``` This way it will solve for hypothesis or opposite or adaject depending on what you have. You may not need it all yet, but you will._________________ Last edited by Aes_Sedia5 on 17 Nov 2011 05:57:39 pm; edited 1 time in total
KermMartian

Joined: 14 Mar 2005
Posts: 55763
Location: Earth, Sol, Milky Way

 Posted: 17 Nov 2011 05:57:19 pm    Post subject: I hope you mean those to be uppercase A and B. Also, √C doesn't store back to C, so you need √C ->C. Code: ```PROGRAM: Hypotenuse  :Input "Leg 1=",A :Input "Leg 2=", B :AČ+BČ→C :√C→C :Disp "Hypotenuse=",C``` If you wanted to be super-efficient: Code: ```PROGRAM: Hypotenuse  :Input "Leg 1=",A :Input "Leg 2=", B :Disp "Hypotenuse=",√(AČ+BČ)```_________________
ThankYouGod

Newbie

Joined: 17 Nov 2011
Posts: 11

 Posted: 17 Nov 2011 05:59:36 pm    Post subject: Ah, Kerm, that makes sense. I was storing when I could just take the squareroot of A and B squared. Thanks! And Aes_, I see what you did there! Hopefully I can work upto that.
Weregoose

Cemetech Expert

Joined: 23 Oct 2009
Posts: 463

 Posted: 17 Nov 2011 06:00:58 pm    Post subject: If you wanted to be super-duper efficient: Code: ```:Prompt A,B :R►Pr(A,B ``` Quadratic formula: Code: ```:Prompt A,B,C :.5/A(-B+{1,-1}√(BČ-4AC ```_________________Common Errors in English · How To Ask Questions The Smart Way
ThankYouGod

Newbie

Joined: 17 Nov 2011
Posts: 11

 Posted: 17 Nov 2011 06:22:34 pm    Post subject: Souvik, what does the abs do in your code? Code: ``` Prompt A,B Disp abs(A+Bi //complex i ``` And I assume your // was to symbolize after it was not to be included in code.
Aes_Sedia5

Minor Calculator Deity

Joined: 01 Sep 2011
Posts: 1002
Location: Where Nightmares end and Dreams begin

 Posted: 17 Nov 2011 06:23:48 pm    Post subject: Yes the // is how you comment code on the forum. NOTE: It does not work on Calc._________________
ThankYouGod

Newbie

Joined: 17 Nov 2011
Posts: 11

 Posted: 17 Nov 2011 06:24:28 pm    Post subject: Thank you. Doesn't abs mean absolute value?
souvik1997

Guru-in-Training

Joined: 19 Apr 2010
Posts: 2870

 Posted: 17 Nov 2011 06:25:05 pm    Post subject: abs( takes the absolute value of a number. The absolute value of a complex number is just the distance from that point on the complex plane to (0,0). The distance would be the hypotenuse, and A and B would be the sides. The "//" is a comment; you shouldn't include it in your code._________________CALCnet Tournament-38% deviantArt
_player1537

Guru-in-Training

Joined: 25 Nov 2009
Posts: 2958

 Posted: 17 Nov 2011 06:25:24 pm    Post subject: `abs(' is a function which returns the absolute value of its arguments. You said that you've played in Java and C++, where you use // to denote comments. People do the same in TI-Basic because we don't have a way to do so without using hacky methods (not to mention, it isn't meant to be put directly onto a calculator)._________________http://tanner.myserverathome.com
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
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.

»
 » Goto page 1, 2  Next Page 1 of 2 » All times are GMT - 5 Hours

 Jump to: Select a forum Announcements----------------Cemetech AnnouncementsCemetech LabsContests General Discussion----------------Technology & Calculator Open Topic-- Electronics/Hardware Development-- Calculator HardwareYour ProjectsGeneral Open Topic-- Politics & Rants-- Reviews-- Humour/Jokes Cemetech's Projects----------------Doors CSSourceCoderMember Features-- TI-Freak8x-- Merthsoft-- GrammerOther & Upcoming Projects-- The BASIC Elite-- mobileTunes-- CALCnet 2.2-- SuggestionsProgramming the TI-83 Plus/TI-84 PlusUsing the TI-83 Plus/TI-84 PlusWebsite Programming & Design----------------General Programmingz80 AssemblyTI-BASICCasio Prizm/FX Development & ProgrammingWebsite Markup & ScriptingGraphics1337 Programming Tips Building with Blocks----------------FreeBuild, LEGO, and Minecraft-- FreeBuild General-- Suggestions & Troubleshooting-- Content & Gallery-- Servers & Activities
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© Copyright 2000-2013 Cemetech & Kerm Martian :: Page Execution Time: 0.039187 seconds.