This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. TI-Basic => TI-BASIC
Author Message
Galandros


Active Member


Joined: 29 Aug 2008
Posts: 565

Posted: 11 Dec 2008 01:16:38 pm    Post subject:

Well I would like to request efforts or show some routines to:


1-
By inputting in Ans the value of sin(30o),sin(45o),sin(60o),sin(120)
And all kinds of sin, cos,tan results became in prettyprint in the homescreen.
And also the routines will be as small as possible without being too slow.

Example: .7071067... (sin(45)
will output square(2)/2
cos(120)=-1/2 --> yeah even that...

2- The smallest routine that will output into Ans the number pressed. Just a number.
And it mustn't output a number resulted from a wrong key. Only the 0,1,2,3,4,5,6,7,8,9 especific keys in the TI-83 family.

An alternative routine and easier to be smaller: do not consider the 0.


Also I searched in the forum something but it may not be accurate because I don't know some good key words...

Have fun. And I will post later some versions of this routines made by me... I have impression that is possible something better than mine.
PS: this was written somewhat in rush so, anything just ask. I will try to edit later, today. (at least here xD)


Last edited by Guest on 11 Dec 2008 01:17:46 pm; edited 1 time in total
Back to top
paprika killer


Newbie


Joined: 27 Nov 2008
Posts: 4

Posted: 11 Dec 2008 01:36:50 pm    Post subject:

I guess this should be put in the brainteasers section?
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 11 Dec 2008 03:34:35 pm    Post subject:

The brainteasers section is specifically not for people's actual TI-Basic problems. So this topic is right where it should be.

However, for the second problem, this brainteaser might be relevant (this was the best solution). You'll have to adapt it a bit for your own needs, but that should be easy.

Your first question is either really easy or really hard. It's really easy if you restrict yourself to the simplest values of sin, cos, and tan. Then all you have to do is square the value, convert this to a fraction, and then take the square root symbolically.

On the other hand, if you want it to work for *all* values of sin, cos, and tan... the results are ridiculously complicated, and so is the method of calculating them.


Last edited by Guest on 11 Dec 2008 03:36:15 pm; edited 1 time in total
Back to top
Galandros


Active Member


Joined: 29 Aug 2008
Posts: 565

Posted: 11 Dec 2008 04:54:12 pm    Post subject:

DarkerLine wrote:
However, for the second problem, this brainteaser might be relevant (this was the best solution). You'll have to adapt it a bit for your own needs, but that should be easy.
Your routine is the smaller and fits better my needs. It only needs a small tweak to the 0...

I tried some quick search but I think that even searching further I wouldn't find it... :confused: I need powerups for my searching skills in forums...

DarkerLine wrote:
Your first question is either really easy or really hard. It's really easy if you restrict yourself to the simplest values of sin, cos, and tan. Then all you have to do is square the value, convert this to a fraction, and then take the square root symbolically.
I will blast myself because I had some research enough to reach that point and I reached... And right after exiting quickly of the pc and shutting it down I had a bright idea. And was that indeed. I will code that and show. Mad

DarkerLine wrote:
On the other hand, if you want it to work for *all* values of sin, cos, and tan... the results are ridiculously complicated, and so is the method of calculating them.
[post="130186"]<{POST_SNAPBACK}>[/post]
No, I don't think so. At least for now =)

Thanks. Some optimizations to my programs, yupi!


Last edited by Guest on 11 Dec 2008 05:03:41 pm; edited 1 time in total
Back to top
Galandros


Active Member


Joined: 29 Aug 2008
Posts: 565

Posted: 11 Dec 2008 05:53:12 pm    Post subject:

Coding progressing... EDIT: weregoose site has a smaller routine to fracformat or is mistake of mine? I don't think so.
And I have some other routines that might be useful to others. And optimizations tricks with some techniques and some tips (maybe they are related somewhere but I write them anyway). Maybe I should make a new post to this?

And I remembered another weird need of mine and this could turn into a Brain Teaser:

In any graph screen configuration in func mode, convert a point (like point commands and lines) to the respective pixel (like pxls commands).
The inputs are:
X=X coordinate
Y=Ycoordinate
Outputs:
R=row of pixel
C=column of pixel

Also a program that is the reverse. Also the conversion should accurate as possible.
I tried some things but they didn't resolved some screens. I found some routines around for this (like in WikiTI) but didn't work on "hard" screens.


Last edited by Guest on 11 Dec 2008 05:53:55 pm; edited 1 time in total
Back to top
Galandros


Active Member


Joined: 29 Aug 2008
Posts: 565

Posted: 17 Dec 2008 09:53:17 am    Post subject:

Sorry for the late reply but I got enthusiasm in programming asm. (see signature)

Here it is:
[quote name='"BASIC Code"']:Prompt B              \\it doesn't matter if is radians or degrees, just give a input like I said above
:B²→A
:1-tanh(BE9→F                  \\ if number is negative F will be 1
:seq(X,X,1,10,2                                        \\ from this line to...
:Ansnot(fPart(round(AnsA,9
:min(Ans+E2not(Ans
:{AnsA,Ans
:If not(max(fPart(Ans
:Ans/abs(Ans(1)),Ans(2                           \\ to this is weregoose's routine for "extracting" the fraction in A. It returns a list with number 1 the numerator and 2 the denominator
:ClrHome
:√(Ans
:If fPart(Ans(2)) and not(fPart(Ans(1        \\ checks if need rationalization
:{prod(Ans),round(Ans(2)²,0                   \\ rationalize (it's a math term translated, if you don't know say something). Also the round is needed...
:If F
:Output(3,1,"‾
:Output(3,3,"--
:Ans→A
:For(θ,1,2                                             \\ made a loop to save space Razz
:∟A(θ
:If fPart(Ans
:Then
:Output(2θ,3,"√(
:Output(2θ,4,Ans²
:Else
:Output(2θ,3,Ans
:End
:End[/quote]
I could get the divisions by one out but I think it doesn't worth the bytes.


I post the adapted number pad reader
[quote name='"BASIC Code"']:Repeat Ans≤9
:Repeat Ans
:getKey
:End
:Ans(102≠Ans)-13int(Ans/13(2>abs(5-abs(5-abs(Ans-83
:End[/quote]


And I found a little curious code to do kind of 90-X. Test yourself to see the results.
[quote name='"BASIC Code"']:Degree
:sin(^-1)cos(X
:cos(^-1)sin(X[/quote]
All Generated by SourceCoder, © 2005 Cemetech

(I had this all since weekend) Also you have the programs are in annexed.
I have been working in an old image editor of mine, pure basic. (I had nothing to do)
And I will post in these day (I hope) what I promised above.

Any optimizations to the programs or explanations to the last code behaviour?
EDIT: commented code


Last edited by Guest on 17 Dec 2008 10:05:47 am; edited 1 time in total
Back to top
Galandros


Active Member


Joined: 29 Aug 2008
Posts: 565

Posted: 06 Feb 2009 04:02:39 pm    Post subject:

*Necromancy*
:sin(^-1)cos(X
:cos(^-1)sin(X
I though in that a little and discovered alone. It was elemental... But can be used to encrypt list (depend on the list) in games or something.

I have some minor size optimizations on the sin cos and tan expressions simplifier.
Also I put a round( to avoid some rare cases of floating point errors!

And a little bonus in the annexed archive: a cool 3 equations and 3 variables system solver using strings manipulating and matrix commands. I would like to adapt that to other number of variables...
Input string has to be this formats:
AX+BX+CY=D
where a,b,c are the coefficients of X,Y and Z. But you can have AX,BY,CY in any order.
If for example A=0, you can simply:
BX+CY=D
And also you can do negative A, B or C like this:
-AX-BX=4 (just like normal input in TI-83)
D is obviously the constant term and has to be after the "=". Also after the = now X,Y or Z things. For example this CANNOT BE entered:
X=Y-6
Does not support fractions. I think is all.

The program returns if the system of equations are impossible, or indeterminated. But I forgot to translate so it gives:
"IMPOSSIVEL" for impossible and "INDETERMINADO" for indeterminated.


Ok enjoy!
Important edit.


Last edited by Guest on 06 Feb 2009 05:58:06 pm; edited 1 time in total
Back to top
Display posts from previous:   
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
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement