Thread: Cubic polynomial root solver program...

  1. #1
    Registered User
    Join Date
    Mar 2005
    Posts
    14

    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. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    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:

    Quote 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

    Read and follow the above instructions, and try your post (in the same thread) again.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Slave MadCow257's Avatar
    Join Date
    Jan 2005
    Posts
    735
    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. #4
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    I suspect the reason they didn't, is because ^ is not the "power-of" operator in C.

    Quzah.
    Hope is the first step on the road to disappointment.

  5. #5
    Registered User
    Join Date
    Mar 2005
    Posts
    14
    all very fair calls...

    I was taking the slack root...

    cheers for the link madcow257...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newbie with a Sudoku Solver program
    By TylerBill in forum C Programming
    Replies: 13
    Last Post: 03-08-2006, 07:27 PM
  2. Linked List program need help
    By ykchua in forum C Programming
    Replies: 3
    Last Post: 08-05-2004, 10:18 AM
  3. set root through program
    By linuxman in forum Linux Programming
    Replies: 6
    Last Post: 06-06-2004, 12:34 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM