Thread: mathematical expressions

  1. #1
    Unregistered
    Guest

    Question mathematical expressions

    i got a trouble releated to a mathematical exp in c.

    i don not know how to evalate such an expression

    (third power of)x +(square of)x +23 = 0
    it is just an example.

    as u see we can not leave the x on one side of the equation so how can i solve such an expression?


    thanks

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145

    Re: mathematical expressions

    Originally posted by Unregistered
    how can i solve such an expression?
    There is no general rule on how to calculate a third degree equation when you have a constant on your left side (ax^3 + bx^2 + cx + d = 0. I believe there are some numerical way to solve it...
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Unregistered
    Guest

    Exclamation mis-understanding

    as i said it is just an example.

    the problem is i have an equation in this form

    (f + 1)^(n + 1) - (1+x/a)*(f+a)^n+x/a=0

    x,a,n is given and i want to calculate f but i can t find such an expression f=...... it is possible to write it in this manner.
    what should i do?

  4. #4
    Registered User
    Join Date
    Jan 2002
    Posts
    552
    I dont know of a algebraic way of solving it, but there is a method I know of that can give you an estimate to any desired accuracy, called the Newton-Raphson (or something like that) method, but it involves calculating the derivative of your funtion. Although there is the secant method that doesnt involve calculating derivatives which works just as well. I dont remember it off the top of my head but I can look it up of you like.

  5. #5
    Registered User
    Join Date
    Jan 2002
    Posts
    552
    hmmm, just thought of something else, since im assuming you need to evaluate that equation using a program, you can use the "divide-and-conquer" method. Its pretty simple to implement, since it only involves using the actual equation and calculating averages.

  6. #6
    Registered User
    Join Date
    Apr 2002
    Posts
    23

    Question

    Hi,

    just thinking there that it may also be usefull if you told us what you were going to do with the solution,

    is it not common in graphics to turn this sort of equation into a parametric equation? so you can solve over values of t if your plotting the solution?

    this is off the top of my head so not too sure if its acurate....

  7. #7
    Unregistered
    Guest

    Talking thanks

    thanks to all i solve it

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Stack that evaluates postfix expressions
    By killmequick in forum C Programming
    Replies: 7
    Last Post: 10-01-2008, 06:23 PM
  2. Mathematical Operation
    By madahmad1 in forum C Programming
    Replies: 29
    Last Post: 07-30-2008, 09:58 AM
  3. Regular expressions [Boost]
    By Desolation in forum C++ Programming
    Replies: 8
    Last Post: 12-30-2006, 10:10 PM
  4. Prefix Expressions
    By mannyginda2g in forum C++ Programming
    Replies: 4
    Last Post: 03-19-2004, 01:30 AM
  5. postfix expressions
    By Unregistered in forum C Programming
    Replies: 4
    Last Post: 12-12-2001, 01:32 PM