+ Reply to Thread
Results 1 to 3 of 3

Thread: How to solve simultanious equations...??

  1. #1
    Join Date
    Feb 2006
    Posts
    157
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4

    Default How to solve simultanious equations...??

    Hi guys,

    Can any body help me to solve simultaneous equations using C++ ..?
    or What should be my approach to solve the simultaneous equations using C++ ...?

    For eg: I have the following equations .......

    Qt Code:
    1. 6x + 5y = 10 // --------------------( 1 )
    2. 11x - 3y = 75 // --------------------( 2 )
    To copy to clipboard, switch view to plain text mode 

    To solve the above 2 equations i need to multiply 3 with equation (1) and multiply 15 with equation (2)
    Then i will get the following eqauations ....

    Qt Code:
    1. 18x + 15y = 30 // --------------------- (3)
    2. 55x - 15y = 75 // --------------------- (4)
    To copy to clipboard, switch view to plain text mode 


    Now let's solve the equations ( 3, 4 ) and i will get the following outoput.

    Qt Code:
    1. 63x = 105
    2. then x = 105/63 ;
    To copy to clipboard, switch view to plain text mode 

    Now we got the "x" value . // This is what i need programmatically


    So my plan is , in my C++ application i just need to take the first 2 equations ( 1, 2 )as inputs. Please tell me which data structure i need to use to accept/store equations( 1, 2) .
    Or How to start with this equations..??

    thanks in advance.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    31,279
    Thanks
    3
    Thanked 4,708 Times in 4,509 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Blog Entries
    4
    Wiki edits
    10

    Default Re: How to solve simultanious equations...??

    Google for Gauss method for solving equations.

  3. #3
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Thanks
    1
    Thanked 29 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to solve simultanious equations...??

    Quote Originally Posted by joseph View Post
    Hi guys,

    Can any body help me to solve simultaneous equations using C++ ..?
    or What should be my approach to solve the simultaneous equations using C++ ...?

    For eg: I have the following equations .......

    Qt Code:
    1. 6x + 5y = 10 // --------------------( 1 )
    2. 11x - 3y = 75 // --------------------( 2 )
    To copy to clipboard, switch view to plain text mode 

    To solve the above 2 equations i need to multiply 3 with equation (1) and multiply 15 with equation (2)
    Then i will get the following eqauations ....

    Qt Code:
    1. 18x + 15y = 30 // --------------------- (3)
    2. 55x - 15y = 75 // --------------------- (4)
    To copy to clipboard, switch view to plain text mode 


    Now let's solve the equations ( 3, 4 ) and i will get the following outoput.

    Qt Code:
    1. 63x = 105
    2. then x = 105/63 ;
    To copy to clipboard, switch view to plain text mode 

    Now we got the "x" value . // This is what i need programmatically


    So my plan is , in my C++ application i just need to take the first 2 equations ( 1, 2 )as inputs. Please tell me which data structure i need to use to accept/store equations( 1, 2) .
    Or How to start with this equations..??

    thanks in advance.
    If I'm not mistaken then 55 + 18 is 73.... not 63.. And, Yes, Gauss method will work...

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts