Solving systems of equations by computer
Favorites|Homepage
Subscriptions | sitemap
HOME > Mathematics > Solving systems of equations by computer

Solving systems of equations by computer

[From: ] [author: ] [Date: 11-06-22] [Hit: ]
b1, and b2 are known.Im trying to find values x and y.This is easy to solve by hand, but Im having trouble programming it.Any help would be great.......
I'm trying to solve two equations with two unknowns using the C language. The equations are:

a1 + x(y-a1) = b1
a2 + x(y-a2) = b2

Here a1, a2, b1, and b2 are known. I'm trying to find values x and y. This is easy to solve by hand, but I'm having trouble programming it. Any help would be great. You can explain it to me using any programming language. Thanks!!!

-
I am not very familiar with many programming languages but i have had a little experience. What i would do is solve for x in the first equation then plug that into the second to solve for y. Then use y to solve for x in one of the equations. so x = (b1 - a1)/(y - a1) which then you plug into the second to get a2 + (b1 - a1)/(y - a1)*(y - a2) = b2. Solve for y to get (b2 - a2)/(b1 - a1) = (y - a2)/(y - a1). one can solve for y by letting (b2 - a2)/(b1 - a1) be p so p = (y - a2)/(y - a1) so p*y - a1*p = y - a2 then p*y - y = a1*p - a2 then factor to get y(p - 1) = (a1*p - a2) and divide to get y = (a1*p - a2)/(p - 1) if p =(b2 - a2)/(b1 - a1) then:
y = (a1*(b2 - a2)/(b1 - a1) - a2)/((b2 - a2)/(b1 - a1)-1)
that is y in every case no matter what. So all that is necessary is setting y to a variable equal to that mess. You don't need to write a program to solve for those unknowns just set y to the equation of constants and then set x to (b1 - a1)/(y - a1) using y that you obtained from the other equation.
1
keywords: Solving,computer,by,equations,systems,of,Solving systems of equations by computer
New
Hot
© 2008-2010 http://www.science-mathematics.com . Program by zplan cms. Theme by wukong .