Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. 2 Equations 2 Unknows - How to program in C#?

2 Equations 2 Unknows - How to program in C#?

Scheduled Pinned Locked Moved C#
questioncsharphelptutorial
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    laura1316
    wrote on last edited by
    #1

    Hi All: I have the following algebraic equations I want to code in C#. I am not sure how to do this. Please help! 495 = 66t + c 951 = 190 + c How do I write this in code? Thanks, Laura

    L D 2 Replies Last reply
    0
    • L laura1316

      Hi All: I have the following algebraic equations I want to code in C#. I am not sure how to do this. Please help! 495 = 66t + c 951 = 190 + c How do I write this in code? Thanks, Laura

      L Offline
      L Offline
      laura1316
      wrote on last edited by
      #2

      Sorry the equations are actually: 495 = 66t + c 951 = 190t + c Thanks! Please Help! :laugh: Laura

      L 1 Reply Last reply
      0
      • L laura1316

        Sorry the equations are actually: 495 = 66t + c 951 = 190t + c Thanks! Please Help! :laugh: Laura

        L Offline
        L Offline
        Leslie Sanford
        wrote on last edited by
        #3

        Are you looking for an algorithm for solving two simultaneous equations[^]? And you want to code that in C#? Make sure you understand the algorithm first without being concerned about how to implement it in C#. Once you have a strong handle on the algorithm, you can then begin to consider how to implement it in C#. The above link describes three approaches.

        1 Reply Last reply
        0
        • L laura1316

          Hi All: I have the following algebraic equations I want to code in C#. I am not sure how to do this. Please help! 495 = 66t + c 951 = 190 + c How do I write this in code? Thanks, Laura

          D Offline
          D Offline
          darkcalin
          wrote on last edited by
          #4

          You must use the matrix. for ex: 2x+6y=8 3x+2y=5

          |8 6|
          |5 2| -14
          x=-----= --- = 1
          |2 6| -14
          |3 2|

          |2 8|
          |3 5| -14
          y=-----= --- = 1
          |2 6| -14
          |3 2|

          sol x=1 y=1.

          D 1 Reply Last reply
          0
          • D darkcalin

            You must use the matrix. for ex: 2x+6y=8 3x+2y=5

            |8 6|
            |5 2| -14
            x=-----= --- = 1
            |2 6| -14
            |3 2|

            |2 8|
            |3 5| -14
            y=-----= --- = 1
            |2 6| -14
            |3 2|

            sol x=1 y=1.

            D Offline
            D Offline
            darkcalin
            wrote on last edited by
            #5

            this method works for n Equations n Unknows. FOR 2 Equations 2 Unknows For one system like this: {a*X+b*Y=c {d*X+e*Y=f the part of code ar: if (a*e-d*b) { X=(c*e-f*b)/(a*e-d*b); Y=(a*f-d*c)/(a*e-d*b); } else { MessageBox.Show("Many solution!!!"); } PS: The determinant |a b| is equal with a*d-b*c |c d| math my love

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups