Don't have an account? Register now to chat, post, use our tools, and much more.
Latest Headlines
Online Users
There are 121 users online: 4 members, 87 guests and 30 bots. Members: Ashbad, legodude, ordelore. Bots: VoilaBot (2), Spinn3r (2), MSN/Bing (1), Magpie Crawler (3), VoilaBot (1), Googlebot (19), MSN/Bing (2).
RSS & Social Media
SAX
You must log in to view the SAX chat widget
|
| 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. |
|
| Back to top |
|
|
_player1537

Guru-in-Training

Joined: 25 Nov 2009 Posts: 2958
|
|
| Back to top |
|
|
KermMartian

Site Admin

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? _________________
 |
|
| Back to top |
|
|
souvik1997

Guru-in-Training

Joined: 19 Apr 2010 Posts: 2870
|
|
| Back to top |
|
|
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. |
|
| Back to top |
|
|
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
 |
|
| Back to top |
|
|
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
|
|
| Back to top |
|
|
Aes_Sedia5

Minor Calculator Deity

Joined: 01 Sep 2011 Posts: 1002 Location: Where Nightmares end and Dreams begin
|
|
| Back to top |
|
|
souvik1997

Guru-in-Training

Joined: 19 Apr 2010 Posts: 2870
|
|
| Back to top |
|
|
_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
 |
|
| Back to top |
|
|
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 |
|
| Back to top |
|
|
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 |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55763 Location: Earth, Sol, Milky Way
|
|
| Back to top |
|
|
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. |
|
| Back to top |
|
|
Weregoose

Cemetech Expert

Joined: 23 Oct 2009 Posts: 463
|
|
| Back to top |
|
|
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. |
|
| Back to top |
|
|
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. _________________

 |
|
| Back to top |
|
|
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? |
|
| Back to top |
|
|
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
 |
|
| Back to top |
|
|
_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
 |
|
| Back to top |
|
|
|
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
|
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.
|