Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Automatic Fractions
#11
Alright, so that works, thanks!

However, I still can't figure out how to make it appear to the left of the screen. The ultimate goal is to have a degree to radian converter that changes the degree into a radian (DEGREE * pi/180) and then also gives it in a fractional value...

DEGREE * (pi/180) _> D
D/pi = some decimal (we'll call it x)

when you use the >FRAC function it changes it into a fraction; aka just like what Pr0gger told me. In order to get the fractional value akin to the opening Radian value, you must multiply the fraction by PI...

for Example:

45 * (pi/180) = .785398163397 (approximately)
ANSWER / pi = .25
.25 >FRAC = 1/4

to obtain the original answer you have to take 1/4 (.25) and multiply it by PI.

All this leads up to the displaying of the answer on the calcultor; I can't seem to place PI anywhere near the fraction. A simple "LEN$(variable)" would work wonderfully, but I don't know an equivallent function for TI-BASIC or whatever it is. So, here's your new problem...

-Nova
ovaProgramming.

One night I had a dream where I was breaking balls. The next morning, BALLSBREAKER was born.

Quote: Excellent. Now you can have things without paying for them.

BALLSBREAKER 2
~-_-Status Report-_-~
Engine: 94%
Graphics: 95%
Sound: 100%
A Severe Error has crippled BB2 for the time being... I have to figure it out, but until then you won't see much of it Sad.
-----------------------------
Reply
#12
length( can be found in the catalog and works the same way as LEN(, excpet it can't be used with numbers. Smile
size=9]"To announce that there must be no criticism of the president, or that we are to stand by the president, right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public." -- Theodore Roosevelt[/size]
Reply
#13
Okay, then if it can be done, is there a way to designate those variables,

A

B

that are the top of the fraction and the bottom of the fraction as string variables to use with that function? Sorry that I'm such a newb, there's just so many damn commands that I don't know what does what.
ovaProgramming.

One night I had a dream where I was breaking balls. The next morning, BALLSBREAKER was born.

Quote: Excellent. Now you can have things without paying for them.

BALLSBREAKER 2
~-_-Status Report-_-~
Engine: 94%
Graphics: 95%
Sound: 100%
A Severe Error has crippled BB2 for the time being... I have to figure it out, but until then you won't see much of it Sad.
-----------------------------
Reply
#14
Ah, I see. Well there's a better way and you don't even have to use that:

this formula:
Code:
int(log(X)/log(10))+1

Will return the number of digits in X. As for converting them into strings...hmm...
size=9]"To announce that there must be no criticism of the president, or that we are to stand by the president, right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public." -- Theodore Roosevelt[/size]
Reply
#15
Okay, this is EXACTLY what I want the program to do...

Input the Degree value
Convert it to Radians
Give a Decimal Answer for the Radian
Give a fractional value of the Radian by dividing the decimal by PI, and changing it into a fraction, later putting PI next to it.

The only problem is that I have to get PI to be next to the fraction

for instance, 1/4 must look like 1/4(PI) where (PI) is the actual PI symbol. Which could be done, I just don't know how. Is there a way to use this LENGTH command with integers? Or, if not, is there a way to convert the integers into strings AND THEN use the command? Argh I am so confuzed. It pisses me off because I could do this in QBasic SO EASILY...
ovaProgramming.

One night I had a dream where I was breaking balls. The next morning, BALLSBREAKER was born.

Quote: Excellent. Now you can have things without paying for them.

BALLSBREAKER 2
~-_-Status Report-_-~
Engine: 94%
Graphics: 95%
Sound: 100%
A Severe Error has crippled BB2 for the time being... I have to figure it out, but until then you won't see much of it Sad.
-----------------------------
Reply
#16
Hmm, there is no way to convert a number to a string, but is a way to output to any place on the screen.

Output(R, C, Blah) and Output(R, C, "Blah") where R is the screen row, C is the column, and Blah is any number or string.

ClrHome works like qbasic's CLS.

So...

The following program will take A and B and print "A/Bpi" in the top left corner, where "pi" is the PI symbol.

Code:
ClrHome
int(log(A)/log(10))+1_>C
int(log(B)/log(10))+1_>D
Output(1,1,A)
Output(1,C+1,"/")
Output(1,C+D+1,B)
Output(1,C+D+2,"pi")

Where "pi" is the PI symbol.
size=9]"To announce that there must be no criticism of the president, or that we are to stand by the president, right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public." -- Theodore Roosevelt[/size]
Reply
#17
pr0gger, bless you and your beautiful logarithims, cause that's what they are, right? I'm only in Trigonometry for 3 weeks and I've only ever heard breifly about LOG and all that jazz. Anyway, that probably made no sense, but thanks!



But we have a problem, I realize, after testing it. For some numbers it can't find a GCD with 10^11...

The forumula is (DEGREE * (pi/180))/pi <--- and when fractionized, converts a degree measurement into a radian measurement in a fractional from in terms of PI. So if you used 60 as the degree, it would end up being .33333333... which we all know as 1/3 . but the program doesn't say that. I don't really know why... Is there an alternative way of finding the denominator besides finding the Greatest Common Denominator? Argh, sorry about all this...
ovaProgramming.

One night I had a dream where I was breaking balls. The next morning, BALLSBREAKER was born.

Quote: Excellent. Now you can have things without paying for them.

BALLSBREAKER 2
~-_-Status Report-_-~
Engine: 94%
Graphics: 95%
Sound: 100%
A Severe Error has crippled BB2 for the time being... I have to figure it out, but until then you won't see much of it Sad.
-----------------------------
Reply
#18
Just so you know, gcd stands for greatest common divisor, not denominator.
Don't mean to nitpick, though. Big Grin
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Reply
#19
Zack: denominator, divisor, whatever :p Wink

(first, yes those are logs, I just grabbed that equation out of a book over here)

Well, the main reason I used 10^11 was to make any fractions into whole numbers-- you'll note that gcd( can't use decimals.

As for alternative ways... I'm not sure. THere's probably an equation out there...
size=9]"To announce that there must be no criticism of the president, or that we are to stand by the president, right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public." -- Theodore Roosevelt[/size]
Reply
#20
Alright, thanks for your guys' help. It's Monday morning, so that means back to school. My friend Eric and I both were trying to figure this out, as well as the Trig teacher, so maybe one of them got it... either that or maybe I'll be the closest! Big Grin :bounce:

Thanks again, though, seriously, QBNZ roxor.
ovaProgramming.

One night I had a dream where I was breaking balls. The next morning, BALLSBREAKER was born.

Quote: Excellent. Now you can have things without paying for them.

BALLSBREAKER 2
~-_-Status Report-_-~
Engine: 94%
Graphics: 95%
Sound: 100%
A Severe Error has crippled BB2 for the time being... I have to figure it out, but until then you won't see much of it Sad.
-----------------------------
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)