# Cubic polynomial root solver program...

This is a discussion on Cubic polynomial root solver program... within the C Programming forums, part of the General Programming Boards category; Hey, i'm a newbie to the programming scene (1st year uni) and i need some help... I have an assignment ...

1. ## Cubic polynomial root solver program...

Hey, i'm a newbie to the programming scene (1st year uni) and i need some help...

I have an assignment that requires me to write a c program that solves the roots of a cubic polynomial of the form

y(cubed) + py(squared) + qy + r = 0

So far i have been able to write the program so that it can solve for the solution where there are three real root, of which at least two are equal.... but i'm having trouble with the other solutions

I would REALLY appreciate it if anyone could reffer me to somewhere i could get an example of a similar program or could give me some advice...

2. You need to be able to do the actual math yourself, otherwise you're not going to be able to write a program to solve it. If you can solve the problem yourself, then you shouldn't have any problem turning the basic steps to solve into a program.

If you want to search for a program that will do it for you, try Google, because we don't just hand out homework answers here. On that note:

Originally Posted by kermi3
Welcome to the boards. If you haven't already done so then please take some time to familiarise yourself with the faq:
http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

Make sure you have a look at the the posting guidelines:
http://cboard.cprogramming.com/annou...ouncementid=51
Following the rules will ensure you get a prompt answer to your question.

Remember, too, that the board has a search facility, a link is at the top of your screen:
http://cboard.cprogramming.com/search.php
It will often get you a quicker answer to your questions than waiting for a response to one you have posted.

It appears that you are posting a homework assignment or other project.

Please don't ask people to do all your work for you, See the announcement on Homework at the top of all forums to see what is acceptable or PM me. Basically people are happy to help, but they're not going to do it all for you.

Show us what you've got, show your code (using code tags), or where you're confused and someone will be happy to help you I'm sure. If it's something that you absolutely don't understand how it works, like you have no clue how qsort works, then ask a general question about the function and I'm sure someone will explain it. Though they may not give you all of the code for it, but someone will explain the concept.

On obivous homework questions especially, I like to remind people of the board's ninth guildeline, while this board is very helpful to people, make sure you have your instructor's permission before seeking help on assignments. While people on these boards are more than happy to help, we discourage people from asking for help on graded work without the instructor's permission, and we claim no repsonsibilty for any cheating or honor violations.

Feel free to PM me with any questions.

Good Luck,

Kermi3

Quzah.

3. this site looks nice for explaining the math
http://www.1728.com/cubic2.htm

BTW
y(cubed) + py(squared) + qy + r = 0
We usually denote that y^3 + py^2 + qy + r = 0

4. I suspect the reason they didn't, is because ^ is not the "power-of" operator in C.

Quzah.

5. all very fair calls...

I was taking the slack root...