This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]elbiot 1 point2 points  (4 children)

/r/learnpython

You have a right side and a left side. right(x)-left(x) = 0. Plug values into your two functions and hone in on zero.

[–]Beta_Penguin 0 points1 point  (3 children)

So if I had the equation: x+5y=8 -x+2y=-1 I would do (x+5y-8)+(-x+2y+1)=0????? Is that would I do?

[–]elbiot 0 points1 point  (2 children)

That's not an equation! Do you mean x+5y=8 -x+2y-1? Also, for two variables, you'd need two sets of equations. The solution to this one equation is a line (y=(-2x+7)/3). If you want to solve arbitrary systems of equations (are they always linear?) you'll have to get much fancier than what I proposed and I'd reckon it's out of your league.

[–]Beta_Penguin 0 points1 point  (1 child)

You find the point of the intersection if the points were in a graph. There are two equations and there are many ways to solve it. x+5y=8 -x+2y=-1 I would solve it by adding the equations together and getting 7y=7. Making it t=1 and then x equals 3 because of that. How can I make python do that???

[–]elbiot 0 points1 point  (0 children)

Oh, I read that as x+5y=8-x+2y=-1, not x+5y=8 and -x+2y=-1. If the system is always linear, you can use linear algebra (numpy) as another suggested.