Ans doesn't work that way.
Date: 19 Jul 2009 04:33
Number of posts: 7
RSS: New posts
It doesn't? How does it work in 68k?
I don't have a calculator to play with right now, so I don't know…
There is an ans() command, which can return any one of the recently-returned answers on the home screen — ans(1) is the most recent, ans(2) the second most recent, etc. It does not take into account any of the intermediate calculations inside a program, so it can't be used for optimization in most cases.
Also, it would be simpler to just do
Edit: Or slap an expand() on there if you like to match the output of your code. Not entirely sure why you're using strings, though, except to prevent Europeans from using the program.
Edit 2: You are aware that the resulting polynomial is always fully factorable, right?
Yeah, I don't know too much about 68k. I was just playing with my teacher's TI-92 and concocted this program from experimentation. In the program, I didn't use Ans, but I optimized it when transferring it here, and apparently that was an illegal optimization…
I used strings because I didn't know how else to do this. Regardless, at least it is a technique of minor string manipulation…
And that's a rather interesting code. I didn't know the CAS could do that.
It is? I had always checked it using the factor( command, and a lot of the time for higher degree polynomials, it didn't factor entirely with a trailing quadratic factor on the end, or of higher degree. I added the b variable to govern number of rational roots.
Wait, never mind. I thought that the function was called randPoly() and that you were calling it recursively. My bad.
I guess the code should then be