Re: Algorithm to solve equation for variable

Discussion in 'Java' started by pete kirkham, Jun 27, 2003.

  1. pete kirkham

    pete kirkham Guest

    Dan wrote:

    > I am looking for an algorithm to solve an equation for any particular
    > variable. For example, if I have the equation y = w * h + l (actually
    > I have y = w h * l + because I'm using postfix notation), I need an
    > algorithm that can solve the equation for any of w, h, l.
    >
    > I only support the four basic operators in my equations ( + - * / )
    > and do not support functions. The way I store the equation is in a
    > container; each item in the container is either a variable name or an
    > Integer representing the operation, where + is 2, - is 3, * is 4 and /
    > is 5.
    >
    > Any assistance would be much appreciated.
    > Dan

    If you are solving for one variable with the other variables fixed, then
    use some form of evaluator (as a compiled function, an abstract tree or
    iterpreted directly) for the function and an itertive solver (Mueller,
    Newton Raphson, etc). As David said, for less than 5th order analytical
    solutions exist.

    If you are solving for multiple variables, then you either need more
    equations and use a matrix method, or use some form of heuristic space
    search.

    It is possible to solve multi-variate problems iteratively by
    compositing loops; it's why we still have crays in the basement at work.


    Pete
     
    pete kirkham, Jun 27, 2003
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Zimmerman
    Replies:
    0
    Views:
    964
    David Zimmerman
    Jun 27, 2003
  2. Chris Smith
    Replies:
    1
    Views:
    5,570
    Dale King
    Jun 30, 2003
  3. Ahmed Moustafa
    Replies:
    0
    Views:
    869
    Ahmed Moustafa
    Nov 15, 2003
  4. purple
    Replies:
    2
    Views:
    331
    Gabriel Genellina
    Mar 19, 2008
  5. Usama Khan

    how to solve complex equation?

    Usama Khan, Jan 1, 2013, in forum: Python
    Replies:
    6
    Views:
    208
    someone
    Jan 2, 2013
Loading...

Share This Page