Hello. I would greatly appreciate it if you answer any one of my questions. I have started planning a program for factoring a quadratic equation (in the form y=ax^2+bx+c). I have some questions about creating this program.

The code for when B^2-4AC is a follows (I haven't yet decided the points for the text command so i will be showing you only what will appear on a calculator):

If B^2-4AC<0
Then:
Text(-B
Text("+sqrt"
Text("-"
Text(-B^2-4AC
Text(")"
Text("(imaginary number)"
Line (didn't decide)
Text( 2A)

1. Lets says that I get (-4 +- sqrt 8i)/ 2, how can I simplify sqrt(8 to 2sqrt(2)? Is a there a command for this? How can I then simplify the answer...to show -2+- sqrt(2)i as the simplified answer?

2. I have created the program for when A=1. Here is the display on the calculator for y=x^2+bx+c:

ROOTS ARE
-2,-3

(X+2 )
(X+3 )

I left a huge space between the 2 and the ) becuase I don't know how big the roots would. Is there a command on the TI-84 Silver Edition, in which I can determine how many digits a certain number consists of?

3. I haven't started to program for when a person inputs a perfect square like y=x^2+2x+1. I know that the calculator can display (X+1)(X+1) but can I make the calculator combine these to say (X+1)^2?

4. I haven't started to program this yet but what if the root are 1/3 and 1/2. How can I display the factored form as (2X-1)(3X-1) and not as (X-(1/2))(X-(1/3))?

5. Do you have any other suggestions or constructive criticism that I can use to make better programs in the future. I am a beginning programmer (started about 2 week ago) and a 13 year old so can you please explain in detail, if possible, some of the optimized code, but I would love it if you give me the simplified code.

Thank you
[/code][/quote]
1) There is an Omnicalc command for that
2)For integers, you can use
Code:
1+int(log(N
, where N is the integer
3)Use the sub() command
Syntax:

sub(Str1,Start,Length; where Str1 is a string
Can you please explain each in detail. I am still confused.
souvik: he can find the largest perfect square factor without using omnicalc (I don't think he'd know what it is, anyway...)
I doubt he's working solely with integers.
sub( has nothing to do with this. He's talking about recognizing if the two roots are the same. (In this case, B^2-4AC equals 0, btw)
Back to him:
4)If you're trying to factor them, then you can't just change coefficients. I don't think there's any good way to recognize that something is a fraction
I'm working on a long post trying to answer you questions (hopefully in some detail). I'll have it done in a few.
might as well say, welcome to cemetech, enjoy your stay here. [/offtopic]
thanks you player1537. calcdude84se I don't know what you mean
Quote:
souvik: he can find the largest perfect square factor without using omnicalc (I don't think he'd know what it is, anyway...)
I doubt he's working solely with integers.
sub( has nothing to do with this. He's talking about recognizing if the two roots are the same. (In this case, B^2-4AC equals 0, btw)
?

Edit by Tanner (_player): Added in quotes around the post you were referring to.
omnicalc is a calculator application that gives your calculator some extra functions. it can be found: http://www.ticalc.org/archives/files/fileinfo/226/22626.html
I vote that he doesn't use any external libraries for this. He is just learning Basic, so let's not confuse him with the use of libraries (plus it teaches him to learn to write functions he needs when he needs them Razz)
Good point, but I just wanted to inform him what is was Wink
is omnicalc like a calculator prgm or is it on the computer
I'm saying that, regrettably, most of what souvik said is not applicable to you. But let me reword it for you Smile
First point: To simplify a square root, you have to factor it and see if it is divisible by a perfect square.
Second: The method souvik gave for finding the length of a number only works for integers (numbers without a decimal part). Being a quadratic solver, I doubt you'll only be working with integer answers. (Though it's interesting if you are Razz)
Third: To reduce (X+#)(X+#) to (X+#)^2 (# is any number), you have to know that each of the first two #'s are the same. You can tell this easily by looking at the discriminant. If it is 0, then the two solutions are identical and you can factor (X+#)(X+#) to (X+#)^2

Sorry for being confusing...

Edit: discriminant and determinant are not the same. Stupid typo...
It is a calculator application, which means that it is for the calculator. But lets stay on topic and stick to the original problem.
Wow, lots of questions (not a bad thing at all)

1) Sadly, there is not a function for this on the calculators. I believe that in one of the TI Basic tutorials on the internet, it shows how to make one, but I don't remember where it is. Basically, when you program something like this, you just have to program it to do exactly what you think when you have to solve the problem yourself. For instance, you have to first try every prime number you can think of (For() loop anyone?). Then you have to divide the number inside the radical by the prime numbers and see if the answer is an integer (has no Fpart()). Then, if that number is an integer, divide the radical by it, and put the square root of the number you just divided by and put it on the outside. (a lot to take in (maybe?) if you need code examples, I'm here.)

2) Souvik is right, that log() whatever function would be good for this if it were an integer.

3) Souvik wasn't very specific on that one. He meant that you should take the answer to one of the factors and compare it directly to the other factor, and if they are the same, display only one radical and a "^2" sign. Unfortunately, I don't think I can help unless I see how you are doing this. In one way, you could use strings to compare (that is what Souvik was speaking of). But at the same time, you could have 2 variables (3), one for the coeficcient of X and another for the number being added to X in the factor.

4) Again, there isn't a function for this, but it could be written Very Happy Unfortunately, I don't actually follow what you are saying to be done with that. (I've never done something like that before. Ever. Sorry.)

5) Aha, a fun one Smile In my opinion, the best way I have ever seen to learn Basic is to just mess around with every single function, look at some tutorials, and read other people's code (last?). I'm sure other people could say something different. By the way, when people say that an external library can do something you are needing (that isn't like advanced, ASM stuff). If it's something like math (like what people are referring you to Omnicalc) then you can probably do it yourself.

Gogogogo contradictions + questions!

By the way, if you need any more clarification on this, just ask.
are discriminant and determinant the same thing?

Edit: player1537 can you please describe the commands in #1?
rohi89 wrote:
are discriminant and determinant the same thing?

No, that was a typo. I fixed it Smile (Check the original post again)
Also, as player will tell you, don't double-post Razz
Rohi, a bit of advice, please do not double post unless it has been 12-24 hours since your last post in a topic. Use the edit button for new ideas
rohi89, please don't double post. I joined your posts together. If you have to add something to your post and it hasn't been 24 hours, press the "edit" button Smile

I'll look at my post real quick and try and explain it better. Give me a few minutes Razz
sorry about the double post. i typed something wrong on the first one. i tried to delete it...but i didnt know where to....sorry about this :(

Edit: what are determinants anyways?
That was double posting. Again, please use the Edit button. It is at the top right of your post's "box" and says "edit". Posting again in a second with constructive stuff Razz
  
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
Page 1 of 4
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement