how to solve these equations

Discussion in 'C++' started by vj, Aug 23, 2006.

  1. vj

    vj Guest

    Hi all,

    I want to solve the two equations

    u*tan(u)=w
    and
    u^2 + w^2=V^2, where V is a known constant, and u and w are the two
    unknowns to be determined. Please can someone suggest me how to write a
    code and solve these equations in C or C++? I am not an expert, but
    have elementary working knowledge of C.

    Thanks

    vj
     
    vj, Aug 23, 2006
    #1
    1. Advertising

  2. vj

    Noah Roberts Guest

    vj wrote:
    > Hi all,
    >
    > I want to solve the two equations
    >
    > u*tan(u)=w
    > and
    > u^2 + w^2=V^2, where V is a known constant, and u and w are the two
    > unknowns to be determined. Please can someone suggest me how to write a
    > code and solve these equations in C or C++? I am not an expert, but
    > have elementary working knowledge of C.


    You need algebra.

    If these are a system then it can easily be solved using math.

    If they are not a system the only way to "solve" such equations is to
    loop until you get to a certain point close to the answer. It doesn't
    look to me like that kind of problem though. Some equations are not
    solvable but you know when you get close to your answer and how to
    change the variable to get closer. I find this a lot in my job working
    on software that makes use of fluid mechanics in calculations.

    You can also solve them for input in one of the variables and output
    the value of the other. This is also a simple matter of using basic
    algebra to solve for a variable.
     
    Noah Roberts, Aug 23, 2006
    #2
    1. Advertising

  3. vj wrote:
    > I want to solve the two equations
    >
    > u*tan(u)=w
    > and
    > u^2 + w^2=V^2, where V is a known constant, and u and w are the two
    > unknowns to be determined. Please can someone suggest me how to write
    > a code and solve these equations in C or C++? I am not an expert, but
    > have elementary working knowledge of C.


    You need to look up "Newton-Raphson method", most likely. It's not
    topical here. Try sci.math.* hierarchy.

    Since you have elementary working knowledge of C, you already know how
    "to write a code". Begin with "int main(" and proceed to write all
    the necessary code for the algorithm that you already have. If you
    don't have the algorithm, we can't help you. It's not a C++ language
    problem.

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask
     
    Victor Bazarov, Aug 23, 2006
    #3
  4. vj

    Douglas Reed Guest

    vj,

    The first hit on google, if you search for "solving systems of
    equations" (no quotes).

    http://regentsprep.org/Regents/math/math-topic.cfm?TopicCode=syslin

    Doug

    vj wrote:
    > Hi all,
    >
    > I want to solve the two equations
    >
    > u*tan(u)=w
    > and
    > u^2 + w^2=V^2, where V is a known constant, and u and w are the two
    > unknowns to be determined. Please can someone suggest me how to write a
    > code and solve these equations in C or C++? I am not an expert, but
    > have elementary working knowledge of C.
    >
    > Thanks
    >
    > vj
    >
     
    Douglas Reed, Aug 23, 2006
    #4
  5. vj

    Ural Mutlu Guest

    On Wed, 23 Aug 2006 08:34:37 -0700, vj wrote:

    > Hi all,
    >
    > I want to solve the two equations
    >
    > u*tan(u)=w
    > and
    > u^2 + w^2=V^2, where V is a known constant, and u and w are the two


    this looks like a trigonometrical problem. assume there is a triangle with
    the right angle sides u ans w and the opposite side V, eg, pythagorian
    triangle..

    the first equation is tan(u)=w/u which is the normal definition of tan()
    but the angle in numbers must be equal to one of the sides. I presume the
    u in tan(u) is in radians not in degrees?

    thats all i can see for now..

    > unknowns to be determined. Please can someone suggest me how to write a
    > code and solve these equations in C or C++? I am not an expert, but have
    > elementary working knowledge of C.
    >
    > Thanks
    >
    > vj
     
    Ural Mutlu, Aug 23, 2006
    #5
  6. vj

    Ural Mutlu Guest


    > You need algebra.
    >
    > If these are a system then it can easily be solved using math.
    >
    > If they are not a system the only way to "solve" such equations is to
    > loop until you get to a certain point close to the answer. It doesn't
    > look to me like that kind of problem though. Some equations are not
    > solvable but you know when you get close to your answer and how to
    > change the variable to get closer. I find this a lot in my job working
    > on software that makes use of fluid mechanics in calculations.
    >
    > You can also solve them for input in one of the variables and output
    > the value of the other. This is also a simple matter of using basic
    > algebra to solve for a variable.


    my instinct tells me the solution to this problem is to loop until you get
    close to an answer. basically a brute force solution
     
    Ural Mutlu, Aug 23, 2006
    #6
  7. vj

    Mark P Guest

    vj wrote:
    > Hi all,
    >
    > I want to solve the two equations
    >
    > u*tan(u)=w
    > and
    > u^2 + w^2=V^2, where V is a known constant, and u and w are the two
    > unknowns to be determined. Please can someone suggest me how to write a
    > code and solve these equations in C or C++? I am not an expert, but
    > have elementary working knowledge of C.
    >
    > Thanks
    >
    > vj
    >


    Replace w in the second equation with its expression in terms of u. Use
    the trig identity 1 + tan^2 = sec^2 and apply a square root to make it
    even simpler. Then look up Newton's method.
     
    Mark P, Aug 23, 2006
    #7
  8. vj

    r norman Guest

    On Wed, 23 Aug 2006 17:04:10 GMT, Mark P
    <> wrote:

    >vj wrote:
    >> Hi all,
    >>
    >> I want to solve the two equations
    >>
    >> u*tan(u)=w
    >> and
    >> u^2 + w^2=V^2, where V is a known constant, and u and w are the two
    >> unknowns to be determined. Please can someone suggest me how to write a
    >> code and solve these equations in C or C++? I am not an expert, but
    >> have elementary working knowledge of C.
    >>
    >> Thanks
    >>
    >> vj
    >>

    >
    >Replace w in the second equation with its expression in terms of u. Use
    >the trig identity 1 + tan^2 = sec^2 and apply a square root to make it
    >even simpler. Then look up Newton's method.


    This query has all the earmarks of a homework problem, in my opinion.
    Some help and guidance, like "look up Newton's method" might be
    appropriate. I am not sure just how much more explicit information
    would be.
     
    r norman, Aug 23, 2006
    #8
  9. vj

    Default User Guest

    Douglas Reed wrote:

    > vj,



    Please don't top-post. Your replies belong following or interspersed
    with properly trimmed quotes. See the majority of other posts in the
    newsgroup, or the group FAQ list:
    <http://www.parashift.com/c++-faq-lite/how-to-post.html>




    Brian (lots of 'em today)
     
    Default User, Aug 23, 2006
    #9
  10. vj

    kanishkporwal

    Joined:
    Sep 23, 2011
    Messages:
    1
    To solve equations of this type you need to to learn algebra for a quick lesson you can visit tutorvista.com
     
    kanishkporwal, Sep 23, 2011
    #10
    1. Advertising

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. Andrej Hocevar
    Replies:
    1
    Views:
    491
    Nick Austin
    Aug 18, 2003
  2. mano
    Replies:
    3
    Views:
    2,045
    steve.kim
    Jan 31, 2007
  3. mano
    Replies:
    4
    Views:
    1,144
    Preben
    Jan 31, 2007
  4. Kelie

    Use Python to solve equations?

    Kelie, Sep 11, 2008, in forum: Python
    Replies:
    4
    Views:
    417
    Kelie
    Sep 11, 2008
  5. Common Man

    Please Help me solve these two questions

    Common Man, Aug 10, 2012, in forum: C Programming
    Replies:
    28
    Views:
    825
    James Kuyper
    Aug 12, 2012
Loading...

Share This Page