Author |
Message |
|
mitchba12
Newbie
Joined: 15 Feb 2011 Posts: 23
|
Posted: 12 Jan 2012 12:36:06 pm Post subject: |
|
|
I just got a TI 89 Titanium over winter break, and I've been trying to port some of my favorite 84+ math programs and functions. However, whenever I try to make a program, The calc throws an, "Error: missing (" error. I've tried everything I could think of, (changing the line, adding random parentheses, and just deleting the line,) and nothing works. The program below is the latest headache I've been working on. (Note: The line the calc takes me to is marked with a "!!!!" instead of a "/" at the beginning of the comment. This program's intention is estimate the sum of an infinite series to an accuracy the user defines. Because of the bug, I've not been able to do any detailed debugging. The calc is brand new, and no shells are installed.)
:serimakr()
:Prgm
:ClrIO
:Local d,c,e,s,z
:InputStr "Expression in terms of 'n':",e /asks for an expression f(n)
:Input "Starting 'n':",s /asks for starting "n" value
:Input "Ending 'n':",z /asks for ending "n" value
:0->sum /defines the variable "sum" to be used at end (changed from Define sum=0
:newList(z-(s+1))->series !!!!!!issue line (defines and resizes line "series")
:For n,s,z /main program loop
:getkey()->d /to be used for pause block
:expr(e)->c /evaluates f(n) and stores to "c"
:c->series(n) /stores "c" to term "n" in list "series
:Output 1,34," " /erases term # (does nothing in first loop)
:Disp c /displays term
:Output 1,1,"Term:"
:Output 1,34,n /displays term #
:If d>0 /pause block
:Pause /pause block
:EndFor
:sum(series)->sum /evaluates estimation
:Disp "Sum:",sum /displays result
:EndPrgm
Now keep in mind that I am new to 68k BASIC. Any help would be awesome! Thanks in advance. |
|
Back to top |
|
|
jammasterz
Advanced Newbie
Joined: 28 Nov 2011 Posts: 72
|
Posted: 12 Jan 2012 12:44:15 pm Post subject: |
|
|
When it says error, do you have 2 choices like :1. Quit, 2. Goto?
IF yes press Goto and give us the line it highlited |
|
Back to top |
|
|
Xeda112358
Active Member
Joined: 19 May 2009 Posts: 520
|
Posted: 12 Jan 2012 06:27:20 pm Post subject: |
|
|
When I debug with my 89t, I try to replace the Input statements with actual numbers to store to the variables and see if that helps. I've never actually used Input on my 89, though. The reason is that you can actually make your program have arguments.
Also, a really neat thing about the TI-89 i that it handles symbolic. What this means is that you do not actually need to store equations in a string. If n is not defined as a number and you do n^2+3→e, e will be n^2+3. When you do 6→n, e will be 39, when you do 5→n, E will be 28. Using this fact and some indirection, you can have inputs like the OS functions where you have a formula, the variable to use, and the start and endpoints. However, indirection is a bit weird to grasp if you are not familiar, so here is an idea to try (I have not tried this yet):
Code:
:serimakr(e,s,z)
:Prgm
:ClrIO
:Local d,e,s,z
:0→sum0 ;I changed this to sum0 because variables cannot be the same name as functions. I've no clue if sum would interfere.
:newList(z-(s+1))→series
:For n,s,z
:getkey()→d
:e→series[n] ;Should this use [] instead of ()? Lists in 89 BASIC use [] to access elements
:Output 1,34," "
:Disp e
:Output 1,1,"Term:"
:Output 1,34,n
:If d>0 ;cool idea :D
:Pause
:EndFor
:sum(series)→sum
:Disp "Sum:",sum
:EndPrgm
Now you can pass the arguments to the program For example, you could do something like serimakr(n^2+3,3,7) on the homescreen or in other programs. I am not too experienced with TI-89 BASIC, but I have worked with it a bit and I am currently trying to get more experience, so I will be around to try to help!
(I would try to test this code, but my calculator is currently... under the weather XD I tried making an assembly program and I am not sure how to fix it. I've even removed all the batteries o.o Oh well, here's to experimentation!) |
|
Back to top |
|
|
mitchba12
Newbie
Joined: 15 Feb 2011 Posts: 23
|
Posted: 20 Jan 2012 12:13:46 pm Post subject: |
|
|
Thanks to ThunderBolt, I've finnally got rid that () error, but now I'm having trouble with lists. I only know how to store to a specific term in 84+ BASIC. If anyone could provide a tutorial, that would be great, thanks. |
|
Back to top |
|
|
Xeda112358
Active Member
Joined: 19 May 2009 Posts: 520
|
Posted: 20 Jan 2012 03:23:42 pm Post subject: |
|
|
That, too, was one of the more confusing things for me. I was accustomed to TI-83+ BASIC which uses (. On the TI-89, you need to use [. For example, if you have a list called list1, you can do 34→list1[2]. Also note that TI-89 BASIC is much more powerful. For example, you could also store strings to a list element. |
|
Back to top |
|
|
mitchba12
Newbie
Joined: 15 Feb 2011 Posts: 23
|
Posted: 26 Jan 2012 11:05:16 am Post subject: |
|
|
Oh... OK. I get it. Thanks. |
|
Back to top |
|
|
Xeda112358
Active Member
Joined: 19 May 2009 Posts: 520
|
Posted: 26 Jan 2012 04:40:44 pm Post subject: |
|
|
No problem
Just wait until you need to create a picture o.o |
|
Back to top |
|
|
|