equations for a program

This is a discussion on equations for a program within the C Programming forums, part of the General Programming Boards category; I know this is a programming site but I need to put two simultaneous equations in to a program so ...

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    41

    equations for a program

    I know this is a programming site but I need to put two simultaneous equations
    in to a program so my problem is really math,
    My equations are y - 3x + 3 = 0 and y+2x - 3 = 0.

    I need to solve them I know you need to eliminate
    one of the variables first so I've tried to eliminate y by subtraction with wrong
    results, I can't remember if I need to write the equations again in a different format,
    Could someone please solve my equations and remind me of the method involved.

    Thanks for all the help (leaner wanting to be a master).

  2. #2
    Banned Troll_King's Avatar
    Join Date
    Oct 2001
    Posts
    1,784
    I'm not quite sure, what you want however, try isolating the variable that you want to solve for. Is it y or x? Isolate either on one side of the equation.

  3. #3
    Registered User
    Join Date
    Jan 2002
    Posts
    41
    I would be happy to solve any x or y I just need to be
    shown the method for solving both please, I tried isolating
    both seperately but with wrong results I can do it graphically
    but not algebraicly please please please show me the steps
    to obtain both solutions.

    BIG thanks.

  4. #4
    Registered User stautze's Avatar
    Join Date
    Apr 2002
    Posts
    195
    subtract one equation frmo the other, you already have the in the right form.
    Code:
              y-3x+3=0
            - y-2x+3=0
          ----------------
                -5x+6=0 => x = 6/5
                                   
    now substitute x into either equation and solve for y.
    
             y = 3/5
    There is probably more than one solution.

    ps. when you wright the code for this, i would like to see it.
    Last edited by stautze; 06-19-2002 at 05:44 AM.
    'During my service in the United States Congress, I took the initiative in creating the Internet.' - Al Gore, March 9, 1999: On CNN's Late Edition

  5. #5
    Unregistered
    Guest
    Multiply y - 3x +3 = 0 by -1 giving you -y +3x -3 = 0. Move the integer over to the other side giving you -y +3x = 3. Do the same for the other equation giving you y +2x = 3. Add the two equation together (y and -y cancell each other) giving you 5x = 6, therefore x = 6/5 = 1.2

    Substitute this x value back into one of the original equations -

    y -3(1.2) +3 =0

    This gives you y -3.6 + 3 = 0

    y -0.6 = 0 , therefore y = 0.6

    Ta-da!

    Ciaran

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 02-21-2008, 10:39 AM
  2. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 01:27 PM
  3. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 11:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21