I a trying to design a short program that provides solutions to any given quadratic equation. I need to program to determine the values of "a,b and c" by referencing the quadratic (to be entered as Y1 from the Y= menu). what I mean is that the calculator will not prompt me for the values, but have my program determine them from the quadratic listed under Y1. I currently have the quadratic program that prompts the user for a, b, and c. I am trying to improve on this program for a bonus grade in my college algebra.

one of the commands you'll be relying on will be equ-string command, which will convert any function to a string. So given Y1 = x^2+2x+1, using the command will return "x^2+2x+1"

through string manipulation, you can easily obtain A B C.

*The Silver Phantom welcomes you*

I have figured it out and the code is as follows

:Y1(0)storeC

:((Y1(1)-Y1(-1))/2)storeB

:((Y1(1)+Y1(-1)-2C)/2)storeA

:If B^2-4AC<0

:Then

:Disp "NO REAL NUMBER" or whatever you would like to let you know it is an imaginary number(I also have code to give the imaginary number)

:Else

:(-B+sqrt(B^2-4AC))/(2A)storeX

:(-B-sqrt(B^2-4AC))/(2A)storeY

:Disp "X= ",X,Y

this works you just have to remember to place your function in the Y= menu

You may have just made a mistake in not putting an "End" at the end of your code, but you need it in order to close that If…Then…Else block.

Also, it looks nicer if you surround your code in [[ code ]] at the beginning and [[ /code ]] at the end (without the spaces).

That is a smart solution to avoid string manipulation. Just a few tips, you can remove the parentheses () on the second, third, eighth, and ninth lines, and remove the closing double quote on the sixth line. Also, you can remove the last three lines and replace them with -2C/(B+{-1,1}sqrt(B²-4AC

It would probably be more user-friendly to instead ask the user for each $a,b,c$ using `Input "A=",A:Input "B=",B:Input "C=",C`, and perhaps displaying the general quadratic at the beginning. Just my two cents.

Well, his original goal was to make it so that the user wouldn't be prompted for a b c.

*The Silver Phantom welcomes you*

I'm not good with string manipulation or programming in general, but I have an idea.

Would it be easier to determine the power of the function and then determine all real roots, rather than just make it for quadratic?

Obviously it would be more difficult to write, and would take a little bit more space. But wouldn't it be more user friendly oversll?

-live the life because the life is good -vivir la vida, porque la vida es buena

-Vie la vie que la vie est bonne -quod est bonum vitae in vita

-lebe das Leben, weil das Leben ist gut -vivere la vita, perché la vita è buona

Determining all real roots is quite difficult for powers above 4. If the power is above 4, then there is no true "formula" that can be used to find all the roots. The quadratic solver has simplest formula and is the most practical.

Many SE calculators come with a pre-loaded Polynomial solver App that can do root estimation for powers up to 10,

so a program for that isn't really necessary.

The solution to a complex problem is often a simple answer.

That's really clever, finding the coefficients by evaluating Y1 and algebraically manipulating it. Without any extra work, it supports any quadratic form, not just ax²+bx+c, whereas trying the obvious string manipulation would only support a few cases. The only tradeoff is that you cannot check that Y1 actually is quadratic, but that's not an issue.

If you're going to use the Y-vars you may as well just use solve(); although I'm not sure if that's any smaller than the quadratic formula.

EDIT: you're right; I forgot it was checking for imaginary roots.

Not really, since solve( only iteratively finds an approximate root, whereas this method finds all exact roots, including imaginary ones. Not to mention it would also be much slower.