hello!
As you can tell I am new to this board, but I hope that I may still be able to get my point across as I value everyones input!
Last week while I was being bored to death from my professor explaining how the color code for resistors work for the MILLIONTH TIME, I got thinking about creating a program on my TI-83 that would essentially give the color code for a resistor from the numerical value that you enter. It seemed simple enough, so I began the task. Once I started actually laying out the logic for it though, I soon realized this may not be as easy as I thought
For those who are not familiar with how the resistor color code system works, essentially each resistor has 4 colored bands on it. The first band represents the 10's column number of the resistors value, the 2nd band represents the 1's column digit, the 3rd band represents that value that 10 gets raised to and multiplied against the number from the first 2 bands, and the 4th band states the acceptable tolerance limit for the resistor. Example, a resistor whos colored bands were orange, red, orange, and gold would have a value of 32K Ohms, the 1st orange band being the 3, the 2nd red band being the 2, giving a value of 32. This number is then raised by 10^3, with the 3 coming from the 3rd orange band.
The main plan of attack I had for this problem was to seperate a number like 32000 into 3 variables, X representing the 10's column, Y representing the 1's column, and Z representing the exponent of base 10. I would then compare these variables, and display their colors. (3 equals orange, 2 equals red and so on)
The first problem I ran into was figuring out how to get these 3 variables from one input prompt. After much head scratching I came up with a main idea.
Modulusly (sp? haha) divide the inputted number (32000 in this case) by 10^X, with X representing the base 10 value of the first number, in this case the ten thousands column, or 10^4)
using fpart(32000/10000)*10000 leaves me with the remainder of 2000, which i subtract from my original value of 32000, giving me 30,000 which I then mathematically divide by 10^4 again giving me 3. This gives me both the X and the Y that I am seeking, X from what I just explained and Y as you will see below. How do I get the Z value though! How will the calculator be able to know to divide 32,000 by 10,000 and 32,000,000 by 10,000,000?
Well I loosely came up with a For loop of sorts that would go as follows if written in C language
( int z = 0; z < 99; z++ )
//continuously mod divide the original number (32000) by 10, and as long as the remainder is equal to 0, add 1 to Z.
EX.
32000%10=3200=x, y=0, z=1
3200%10=320=x, y=0, z=2
320%10=32=x, y=0, z=3
32%10=3=x, y=2, z=4
This gives me z=4 (i think, or if it still remains as z=3 I can just alter the later formula), and I'll know that 10^(Z-1) multiplied by 32 gives me 32,000 and I'll be able to get the colors from that. If z=3 however, I can just multiply by 10^Z
My syntax however is what obviously needs some work
Is this method even possible in TI-83's language?
If so I would GREATLY appreciate to understand how to call a recursive function such as this in the calculator.
If this works, I can simply just compare each value X,Y, and Z to some If statements which will give me the appropriate colors!
Example Output:
Value?= 32000
The colors are:
Orange, Red, Orange
I appreciate ANY and ALL feedback to this matter, ESPECIALLY any suggestions of a better way to solve this problem. Thank you for reading!
As you can tell I am new to this board, but I hope that I may still be able to get my point across as I value everyones input!
Last week while I was being bored to death from my professor explaining how the color code for resistors work for the MILLIONTH TIME, I got thinking about creating a program on my TI-83 that would essentially give the color code for a resistor from the numerical value that you enter. It seemed simple enough, so I began the task. Once I started actually laying out the logic for it though, I soon realized this may not be as easy as I thought
For those who are not familiar with how the resistor color code system works, essentially each resistor has 4 colored bands on it. The first band represents the 10's column number of the resistors value, the 2nd band represents the 1's column digit, the 3rd band represents that value that 10 gets raised to and multiplied against the number from the first 2 bands, and the 4th band states the acceptable tolerance limit for the resistor. Example, a resistor whos colored bands were orange, red, orange, and gold would have a value of 32K Ohms, the 1st orange band being the 3, the 2nd red band being the 2, giving a value of 32. This number is then raised by 10^3, with the 3 coming from the 3rd orange band.
The main plan of attack I had for this problem was to seperate a number like 32000 into 3 variables, X representing the 10's column, Y representing the 1's column, and Z representing the exponent of base 10. I would then compare these variables, and display their colors. (3 equals orange, 2 equals red and so on)
The first problem I ran into was figuring out how to get these 3 variables from one input prompt. After much head scratching I came up with a main idea.
Modulusly (sp? haha) divide the inputted number (32000 in this case) by 10^X, with X representing the base 10 value of the first number, in this case the ten thousands column, or 10^4)
using fpart(32000/10000)*10000 leaves me with the remainder of 2000, which i subtract from my original value of 32000, giving me 30,000 which I then mathematically divide by 10^4 again giving me 3. This gives me both the X and the Y that I am seeking, X from what I just explained and Y as you will see below. How do I get the Z value though! How will the calculator be able to know to divide 32,000 by 10,000 and 32,000,000 by 10,000,000?
Well I loosely came up with a For loop of sorts that would go as follows if written in C language
( int z = 0; z < 99; z++ )
//continuously mod divide the original number (32000) by 10, and as long as the remainder is equal to 0, add 1 to Z.
EX.
32000%10=3200=x, y=0, z=1
3200%10=320=x, y=0, z=2
320%10=32=x, y=0, z=3
32%10=3=x, y=2, z=4
This gives me z=4 (i think, or if it still remains as z=3 I can just alter the later formula), and I'll know that 10^(Z-1) multiplied by 32 gives me 32,000 and I'll be able to get the colors from that. If z=3 however, I can just multiply by 10^Z
My syntax however is what obviously needs some work
Is this method even possible in TI-83's language?
If so I would GREATLY appreciate to understand how to call a recursive function such as this in the calculator.
If this works, I can simply just compare each value X,Y, and Z to some If statements which will give me the appropriate colors!
Example Output:
Value?= 32000
The colors are:
Orange, Red, Orange
I appreciate ANY and ALL feedback to this matter, ESPECIALLY any suggestions of a better way to solve this problem. Thank you for reading!