Login

Welcome, Guest. Please login or register.

April 24, 2024, 06:44:02 am

Author Topic: TI-89 Programming  (Read 2762 times)  Share 

0 Members and 1 Guest are viewing this topic.

/0

  • Victorian
  • ATAR Notes Legend
  • *******
  • Posts: 4124
  • Respect: +45
TI-89 Programming
« on: December 21, 2008, 02:50:55 am »
0
Inspired by shinny in the other thread on calculators, I've decided to have a go at programming myself

Here's a program to find scalar and vector resolutes. It works but is still quite primitive:

Vector 1 is ai+bj+ck
Vector 2 is di+ej+fk

p = scalar resolute in direction of second vector
q = vector resolute  etcetcetc.
r = scalar resolute perpendicular to second vector
s = vector resolute etcetcetc.

Code: [Select]
res(
Prgm
Prompt a,b,c
Prompt d,e,f
(a*d+b*e+c*f)/(√(d^2+e^2+f^2)) → p
Disp p
(a*d+b*e+c*f)/(d^2+e^2+f^2)*(d*i+e*j+f*k) → q
Disp q
√(a^2+b^2+c^2-p^2) → r
Disp r
a*i+b*j+c*k-q → s
Disp s
EndPrgm

There are several improvements I need help with though:
- Is there a way to input values in the Home screen, for example: " res(a,b,c ; d,e,f) " ?
- Is there a way to display the answer on the Home screen? Preferably in a matrix like:
Row 1: [scalar, vector]
Row 2: [perpendicular scalar, perpendicular vector]
- Is there a way to clear all the variables after the program has run? (I mean like a "clear a-z", but integrated into the code)

(btw all these should be possible, a friend did it but didn't reveal the code lol)

So... anyone here pro with the calculator? :P
« Last Edit: December 21, 2008, 02:59:23 am by DivideBy0 »

shinny

  • VN MVP 2010
  • Honorary Moderator
  • ATAR Notes Legend
  • *******
  • Posts: 4327
  • Respect: +256
  • School: Melbourne High School
  • School Grad Year: 2008
Re: TI-89 Programming
« Reply #1 on: December 21, 2008, 11:02:22 am »
0
For vectors, ALWAYS use matrices. For example, i+2j+3k is [1,2,3] in the homescreen. Don't forget that the 89 has a built in dotP( function (obviously dot product) so make use of that. To simplify your further programming, define other things first such as a unit vector function which you can use to program other things. I'd copy down the code I used except I have a severe lack of AAA's to power up my 89 with (mum stole them IMMEDIATELY after I finished VCE; go asianness).
MBBS (hons) - Monash University

YR11 '07: Biology 49
YR12 '08: Chemistry 47; Spesh 41; Methods 49; Business Management 50; English 43

ENTER: 99.70


shinny

  • VN MVP 2010
  • Honorary Moderator
  • ATAR Notes Legend
  • *******
  • Posts: 4327
  • Respect: +256
  • School: Melbourne High School
  • School Grad Year: 2008
Re: TI-89 Programming
« Reply #2 on: December 21, 2008, 11:18:39 am »
0
So using matrices, you'll get something like: 'res([a,b,c],[d,e,f])', but remember that you just code this as 'res(a,b)' as the matrice is treated as a number by itself in a way. However, rather than integrating all your vector functions into one program, I just defined a series of functions instead and used each individually as required as it's quite unlikely you'll ever need all of those in one hit, and it'll be too unmanagable if you did. The ones which I had were:
1. uv(a) (produces the unit vector of a)
2. sr(a,b) (scalar resolute of a in b)
3. vr(a,b) (vector resolute of a in b)
4. mag(a) (magnitude of vector a)
5. va(a,b) (angle between vectors a and b)
6. pr(a,b) (vector resolute of a perpendicular to b)
and I think that's all I had. However, if you want to finish what you already had going, try asking Mao for some help with programming since this really isn't my area.
MBBS (hons) - Monash University

YR11 '07: Biology 49
YR12 '08: Chemistry 47; Spesh 41; Methods 49; Business Management 50; English 43

ENTER: 99.70


/0

  • Victorian
  • ATAR Notes Legend
  • *******
  • Posts: 4124
  • Respect: +45
Re: TI-89 Programming
« Reply #3 on: December 21, 2008, 02:17:22 pm »
0
lol thanks shinny, I didn't even know TI-89 had vector functions!
I'll keep going with this diabolical plan, but if it the calculator takes too long then I might split it up into smaller functions as you suggested. :P

Mao

  • CH41RMN
  • Honorary Moderator
  • Great Wonder of ATAR Notes
  • *******
  • Posts: 9181
  • Respect: +390
  • School: Kambrya College
  • School Grad Year: 2008
Re: TI-89 Programming
« Reply #4 on: December 21, 2008, 02:54:41 pm »
0
I've actually written a program to do this, however it would appear now to be superfluous if all those functions shinny said actually existed :P

if it doesn't work, find me on msn, i can help you with the syntax =]
Editor for ATARNotes Chemistry study guides.

VCE 2008 | Monash BSc (Chem., Appl. Math.) 2009-2011 | UoM BScHon (Chem.) 2012 | UoM PhD (Chem.) 2013-2015

shinny

  • VN MVP 2010
  • Honorary Moderator
  • ATAR Notes Legend
  • *******
  • Posts: 4327
  • Respect: +256
  • School: Melbourne High School
  • School Grad Year: 2008
Re: TI-89 Programming
« Reply #5 on: December 21, 2008, 03:41:32 pm »
0
nono, the ones I said above I programmed myself. The only native function is dotP(. Sorry for making that unclear.
MBBS (hons) - Monash University

YR11 '07: Biology 49
YR12 '08: Chemistry 47; Spesh 41; Methods 49; Business Management 50; English 43

ENTER: 99.70


Mao

  • CH41RMN
  • Honorary Moderator
  • Great Wonder of ATAR Notes
  • *******
  • Posts: 9181
  • Respect: +390
  • School: Kambrya College
  • School Grad Year: 2008
Re: TI-89 Programming
« Reply #6 on: December 21, 2008, 03:53:01 pm »
0
ahhh =]

i demand sauce :P
Editor for ATARNotes Chemistry study guides.

VCE 2008 | Monash BSc (Chem., Appl. Math.) 2009-2011 | UoM BScHon (Chem.) 2012 | UoM PhD (Chem.) 2013-2015

/0

  • Victorian
  • ATAR Notes Legend
  • *******
  • Posts: 4124
  • Respect: +45
Re: TI-89 Programming
« Reply #7 on: December 30, 2008, 04:00:08 pm »
0
Anyone know how to keep something exactly the way you input it?

i.e. I want output to read after I input that exact same thing...

But it reads as: , very annoying.

thanks

(loci program, this is gonna be big)
« Last Edit: December 30, 2008, 10:10:02 pm by /0 »

/0

  • Victorian
  • ATAR Notes Legend
  • *******
  • Posts: 4124
  • Respect: +45
Re: TI-89 Programming
« Reply #8 on: January 01, 2009, 04:03:55 am »
0
I've made a code for finding the general equation of an ellipse. Unfortunately, it is rather useless at the moment, since you will have to already know that the form you are dealing with is an ellipse! I am working on branching this code out to include the main loci, then it should be EPIC. Since the equation may appear unfactored (grrr), I have included the solutions for a^2,b^2,h,k in . The "Output" commands were ****** up so I had to mess around with them to get them right, they might work differently on another calculator. Also, the program is 507 (kb, b, kB?), so it could use some tidying up.

OH yeah, and a BIG THING to note is that you have to solve your expression = 0, then put it in, i.e.:

You type:

(~4 seconds to evaluate)

Code: [Select]
loci()
Prgm
ClrIO
Input "Input Expression",q
x+y*i→z
zeros(d(q,x),x)→list4
list4[1]→j
zeros(q|x=j,y)→list4
1/2*abs(list4[1]-list4[2])→a
1/2*(list4[1]+list4[2])→k
zeros(q|y=k,x)→list4
1/2*abs(list4[1]-list4[2])→b
ClrIO
Disp "Input Expression"
Disp q
If a=b Then
Disp "Circle"
Else
Disp "Ellipse"
EndIf
Disp (x-j)^2/a^2+(y-k)^2/b^2=1
Pause
Output 76,1,"h="
Output 64,26,j
Output 63,75,"k="
Output 63,97,k
Pause
Output 80,1,"a^2="
Output 63,35,a^2
Output 65,76,"b^2="
Output 63,111,b^2
EndPrgm

The program works by identifying the coordinates of the stationary points of the ellipse (since that is the only way I know to do it). It then uses this information to find the rest of the values. The planned program will require extensive use of stationary points:
0 stat points => Left-right Hyperbola, Line, Inverse parabola
1 stat points => Parabola
2 stat points => Ellipse, Up-down Hyperbola
My current dilemma is in trying to find a way for the calc to recognise the # of solutions, and furthermore to recognise the type of locus required. Comments and advice would be appreciated :)

EDIT: Code for y=ax^2+bx+c parabola:

Code: [Select]
para()
Prgm
Input "Input Expression",q
zeros(d(q,x),x)→h
zeros(q|x=h,y)→t
t→k
{}→t
zeros(q|y=k-1,x)→t
If t={} Then
zeros(q|y=k-1,x)→t
t[1]→r
t[2]→s
zeros(a*(x-r)*(x-s)-y|x=h and y=1,a)→a
Disp expand(y=a*(x-r)*(x-s)+k-1)
Else
t[1]→r
t[2]→s
zeros(a*(x-r)*(x-s)-y|x=h and y=-1,a)→a
Disp expand(y=a*(x-r)(x-s)+k+1)
EndIf
EndPrgm

Once again, solve equal to 0, then type the expression, e.g.: or
« Last Edit: January 01, 2009, 09:10:02 am by /0 »

Mao

  • CH41RMN
  • Honorary Moderator
  • Great Wonder of ATAR Notes
  • *******
  • Posts: 9181
  • Respect: +390
  • School: Kambrya College
  • School Grad Year: 2008
Re: TI-89 Programming
« Reply #9 on: January 01, 2009, 06:23:50 pm »
0
Kudos on trying, but i still do not understand what these programs actually do :P

but, 507 is quite small for a program, so it's not that bad. I've written quite a few 2k+ ones, though I have come to realise they were absolutely useless :P

however, may i suggest the 'nsolve' function for solving rather devious algebraic equations for numerical values, it is a LOT faster.
Editor for ATARNotes Chemistry study guides.

VCE 2008 | Monash BSc (Chem., Appl. Math.) 2009-2011 | UoM BScHon (Chem.) 2012 | UoM PhD (Chem.) 2013-2015

/0

  • Victorian
  • ATAR Notes Legend
  • *******
  • Posts: 4124
  • Respect: +45
Re: TI-89 Programming
« Reply #10 on: January 01, 2009, 07:27:46 pm »
0
Kudos on trying, but i still do not understand what these programs actually do :P

but, 507 is quite small for a program, so it's not that bad. I've written quite a few 2k+ ones, though I have come to realise they were absolutely useless :P

however, may i suggest the 'nsolve' function for solving rather devious algebraic equations for numerical values, it is a LOT faster.

Lol yeah, sorry it isn't very clear, basically my aim is to be able to solve a question like:

Find the locus of the point P such the sum of distances from P to (0,2) and from P to (8,2) is 20. (Extension to complex loci is easy)

So you would set up the equation as

Then you solve

Then you type in:

And out pops:

Ellipse







(In reality the output is actually ... that's why I give the values for h,k,a^2,b^2. aiyah!)

« Last Edit: January 01, 2009, 07:31:24 pm by /0 »

Mao

  • CH41RMN
  • Honorary Moderator
  • Great Wonder of ATAR Notes
  • *******
  • Posts: 9181
  • Respect: +390
  • School: Kambrya College
  • School Grad Year: 2008
Re: TI-89 Programming
« Reply #11 on: January 01, 2009, 08:36:40 pm »
0
riiight, that makes sense, and nicely done!

however, I have never seen a question like that. so... :P
Editor for ATARNotes Chemistry study guides.

VCE 2008 | Monash BSc (Chem., Appl. Math.) 2009-2011 | UoM BScHon (Chem.) 2012 | UoM PhD (Chem.) 2013-2015

shinny

  • VN MVP 2010
  • Honorary Moderator
  • ATAR Notes Legend
  • *******
  • Posts: 4327
  • Respect: +256
  • School: Melbourne High School
  • School Grad Year: 2008
Re: TI-89 Programming
« Reply #12 on: January 01, 2009, 08:39:22 pm »
0
Loci isn't even on the Specialist course I thought?
MBBS (hons) - Monash University

YR11 '07: Biology 49
YR12 '08: Chemistry 47; Spesh 41; Methods 49; Business Management 50; English 43

ENTER: 99.70


Mao

  • CH41RMN
  • Honorary Moderator
  • Great Wonder of ATAR Notes
  • *******
  • Posts: 9181
  • Respect: +390
  • School: Kambrya College
  • School Grad Year: 2008
Re: TI-89 Programming
« Reply #13 on: January 01, 2009, 09:25:01 pm »
0
Loci isn't even on the Specialist course I thought?

I thought that also, though loci over C is in the course.
Editor for ATARNotes Chemistry study guides.

VCE 2008 | Monash BSc (Chem., Appl. Math.) 2009-2011 | UoM BScHon (Chem.) 2012 | UoM PhD (Chem.) 2013-2015

/0

  • Victorian
  • ATAR Notes Legend
  • *******
  • Posts: 4124
  • Respect: +45
Re: TI-89 Programming
« Reply #14 on: January 01, 2009, 09:45:58 pm »
0
Loci isn't even on the Specialist course I thought?

I thought that also, though loci over C is in the course.

Oh... didn't know that. Is loci over C a common question?