PDA

View Full Version : How to solve simultanious equations...??



joseph
28th May 2008, 07:01
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 .......



6x + 5y = 10 // --------------------( 1 )
11x - 3y = 75 // --------------------( 2 )


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 ....



18x + 15y = 30 // --------------------- (3)
55x - 15y = 75 // --------------------- (4)



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



63x = 105
then x = 105/63 ;


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.

wysota
28th May 2008, 07:33
Google for Gauss method for solving equations.

lyuts
28th May 2008, 10:53
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 .......



6x + 5y = 10 // --------------------( 1 )
11x - 3y = 75 // --------------------( 2 )


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 ....



18x + 15y = 30 // --------------------- (3)
55x - 15y = 75 // --------------------- (4)



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



63x = 105
then x = 105/63 ;


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...