Now, the question is, do you understand how that code works?
rohi89 wrote:
PrgmRADICALS

Yeah, no.

calcdude84se's algorithm can be written as:


Code:
Input X
int(√(X
For(Y,Ans,1,-1
X/Y²
If fPart(Ans
End
{Y,Ans
Very nice, Weregoose, although if he gets confused by the use of Ans I'm prepared to try to write it without the optimizations for the sake of clarity. Smile
Can someone please explain the code to me. I undertand 50 percent of it. :(
Can you tell us what 50% you understand?
KermMartian wrote:
Very nice, Weregoose, although if he gets confused by the use of Ans I'm prepared to try to write it without the optimizations for the sake of clarity. Smile

There's also the "If fPart(Ans:End" that you may have to rewrite Wink
I don't understand why we are using while instead of the for command and the restrictions for I and R.
When I plug in 1 for R I dont get a result. It would be great if someone would write me the unoptimized version.
Weregoose wrote:
rohi89 wrote:
PrgmRADICALS

Yeah, no.

calcdude84se's algorithm can be written as:


Code:
Input X
int(√(X
For(Y,Ans,1,-1
X/Y²
If fPart(Ans
End
{Y,Ans

Rohi, we're looking at this code, right?
We're not talking about prgmRADICALS any more Wink
Well in that case I don't understan the Ans part
Ans is the result of the last calculation. For example, if I do "X*2+1->X" and X was 3, now X and Ans are both 7.
Weregoose, why write int(sqrt(X on a separate line? I don't think it saves any space, does it?
Ok thanks.
Any other part of Weregoose's program that you don't understand?
calcdude84se wrote:
Weregoose, why write int(sqrt(X on a separate line? I don't think it saves any space, does it?
It doesn't. That part was dissected in accordance with
Quote:
Find the square root of X and round down.
For a Y starting at that value and going down to 1

in hopes of making it easier to see the transition from concept to completion.

*shudder* I feel like a marketer.
Ah, okay. Thanks for clarification.
What if the roots 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))?

In the program for simplifying radicals, the programs can't simplify imaginary roots. Why and how can I fix this?

Someone please help me with this, and does anyone have any suggestions for this program?
Hm... Weregoose (or another), is there a good way to recognize fractions in TI-BASIC? The only method I can think of is if he has the whole program deal with fractions (storing the numerator and denominator for each)
Rohi: it can't simplify imaginary ones because that's not how it was designed. It was designed for positive integers. For a negative radicand (the number under the radical), you can just run the simplification program on it, but you have to make it positive first, and remember that there was originally a negative sign on there.
Thanks calcdude
Do we have a working version with integers yet? Let's not get ahead of ourselves.

Firstly, recognize that gcd( doesn't handle negative numbers or non-integers.

To solve Ax²+Bx+C=0, we use (-B±√(B²-4AC))/(2A).

Objectives:

Take the absolute value of the discriminant and factor any perfect squares out of it. The square root of their product (D) will be the radical's coefficient. As the discriminant was forced to be positive, D cannot be negative.

Take the greatest common divisor of D and B (which can be negative, in which case you'll need to make B positive for this instance), and then divide each of 2A, B, and D by the GCD. This will put the fraction in lowest terms.

If B²<4AC, you can now include i as a coefficient of the square root.

Be aware that if A is negative, the sign will distribute across all the other parts. This is inconsequential for the ±, but where B is negative, we have a redundancy – the signs should cancel out.

Tasks like hiding the unit coefficient or denominator may be left to the end user.

I think that's it. You'd have to use a variant of the Euclidean algorithm to work with fractions, which is a world away from impossible. I'm slowly working on my own version of a quadratic factoring program, which I will make sure to post on my website before anywhere else. Smile
Ah, right, the Euclidean algorithm. That completely escaped me.
But, as you said, he should probably get it working in a simple incarnation before making it more complex.
calcdude84se wrote:
Ah, right, the Euclidean algorithm. That completely escaped me.
But, as you said, he should probably get it working in a simple incarnation before making it more complex.
Definitely. Rohi89, have you tried implementing this yet? Also, feel free to chat on the SAX chat widget over

<------ there.

Finally, you should introduce yourself in the Introduce Yourself topic.
  
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 4 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