News:

Happy New Year! Yes, the current one, not a previous one; this is a new post, we swear!

Main Menu

TI-BASIC: Loops?

Started by Joe, April 22, 2006, 03:29:46 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Joe

Yeah. Inspired by this, I tried to figure it out in TI-BASIC. So far I've got..

PROGRAM:CIRCLE
:0 [STO] A
:Lbl B
:Pt-On(sin(A)*7+8,cos(A)*7+8)
:A+1 [STO] A
:
:Goto B


On the blank line, I'm looking to check if A = 100 (and to quit if it is). How would I do this?
Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


MyndFyre

You know, on TI graphing calculators, to draw a circle, it's just two graphed equations:
y1=sqrt(r2 - x2)
y2=-sqrt(r2 - x2)
where r is the radius of the circle you would like drawn.  This is derived from the definition equation of a circle, x2 + y2 = r2.

I'm pretty sure in the past, for me, something like If A < 100 Then Goto B worked.
Quote from: Joe on January 23, 2011, 11:47:54 PM
I have a programming folder, and I have nothing of value there

Running with Code has a new home!

Quote from: Rule on May 26, 2009, 02:02:12 PMOur species really annoys me.

Nate

Its actually possible to graph a circle on a Ti-86 using only one equation but i forget how.

MyndFyre

IIRC, In radians mode, set the function theta1 = radius.
Quote from: Joe on January 23, 2011, 11:47:54 PM
I have a programming folder, and I have nothing of value there

Running with Code has a new home!

Quote from: Rule on May 26, 2009, 02:02:12 PMOur species really annoys me.

Ender

I believe that will be a spiral, not a circle. The quickest way is to put the calculator in polar mode and enter the equation r = c, where r is the radius and c is some constant.

Nate

#5
PROGRAM:CIRCLE
:0 [STO] A
:For(A,0,360,0.1)
:Pt-On(7sin(A)+8,7cos(A)+8)
:End

Ender

#6
Eh, I believe that either won't work or is inefficient, depending on what mode your calculator is in. If your program is in degrees, then that shouldn't complete the circle, as the period of sine and cosine are 360° or 2∏ radians. If you're in radians then your program will draw the circle nearly 16 times, wasting your calculator's resources.

Edit: Now it should work.


Nate

i don't know how to change from degrees to radians in a program on TI-86.

Ender

#8
I have a TI-83, not a TI-86, but on mine you can choose radians or degrees by hitting the mode button.

Edit: Or you can just type in Radian.

Edit2: You can hit the mode button inside the calculator's program edit menu, pick radians, and it will insert the Radian command.

Nate

#9
I meant TI-83.  But there should be a function built in to change it inside a program.

Edit: I found the function in the catalog
PROGRAM:CIRCLE
:0 [STO] A
:Radian
:For(A,0,2∏,2∏/360)
:Pt-On(7sin(A)+8,7cos(A)+8)
:End

d&q

Quote from: MyndFyrex86] link=topic=5660.msg66252#msg66252 date=1145737663]
You know, on TI graphing calculators, to draw a circle, it's just two graphed equations:
y1=sqrt(r2 - x2)
y2=-sqrt(r2 - x2)
where r is the radius of the circle you would like drawn.  This is derived from the definition equation of a circle, x2 + y2 = r2.

I'm pretty sure in the past, for me, something like If A < 100 Then Goto B worked.

I believe that will draw only a partial circle, as seperating the equation into two restricts the domain.
The writ of the founders must endure.

MyndFyre

Quote from: Deuce on April 24, 2006, 06:56:08 PM
Quote from: MyndFyrex86] link=topic=5660.msg66252#msg66252 date=1145737663]
You know, on TI graphing calculators, to draw a circle, it's just two graphed equations:
y1=sqrt(r2 - x2)
y2=-sqrt(r2 - x2)
where r is the radius of the circle you would like drawn.  This is derived from the definition equation of a circle, x2 + y2 = r2.

I'm pretty sure in the past, for me, something like If A < 100 Then Goto B worked.

I believe that will draw only a partial circle, as seperating the equation into two restricts the domain.

You need to split the equations into two equations, because calculators only return positive results of sqrt() where they should return both +/-.

Think of the equations as ORed together.
Quote from: Joe on January 23, 2011, 11:47:54 PM
I have a programming folder, and I have nothing of value there

Running with Code has a new home!

Quote from: Rule on May 26, 2009, 02:02:12 PMOur species really annoys me.

d&q

No I mean, the circle will only look like this:



Try graphing it on a graphing calculator.

Quotey1=sqrt(r2 - x2)
y2=-sqrt(r2 - x2)
Quote

When rooting it, you are still restricting it to a positive number underneath the radical, regardless if you are later going to 'negatify' it.
The writ of the founders must endure.

MyndFyre

#13
Quote from: Deuce on April 25, 2006, 10:53:07 PM
No I mean, the circle will only look like this:



Try graphing it on a graphing calculator.

Quotey1=sqrt(r2 - x2)
y2=-sqrt(r2 - x2)

When rooting it, you are still restricting it to a positive number underneath the radical, regardless if you are later going to 'negatify' it.
Rooting *should* restrict the number under the radical such that expr >= 0.  Note that this means:
expr ∈ √(expr) : [0, ∞)
That means your graphing calculator is broken.  :P

By which I mean to say, the calculator simply does not know how to graph it at that granularity.  If you eval your function at x = r, it will tell you 0 for both y1 and y2.  That's how real-life math works, not graphing calculators.  ;)
Quote from: Joe on January 23, 2011, 11:47:54 PM
I have a programming folder, and I have nothing of value there

Running with Code has a new home!

Quote from: Rule on May 26, 2009, 02:02:12 PMOur species really annoys me.

Nate