Solving systems of equations in two variables - Python -
i start learn python , learned variables, input , basic math.
i been asked write mathematical exercise has parameters:
ax+by=c, dx+ey=f
a, b, c, d,e, f - user input , program result , write answear x, y
i did:
number1 = float(input('insert number1: ')) number2 = float(input('insert number2: ')) number3 = float(input('insert number3: ')) number4 = float(input('insert number4: ')) number5 = float(input('insert number:5 ')) number6 = float(input('insert number6: '))
i don't how write equation 2 variables
x=number1+2.5*number2-number3 #(it should looked ax+by=c) y=number5+2.5*number6-number4
ax+by=c , dx+ey=f ==> x=(-by+ey-f+c)(a-d)
i don't know why can't write variable inside print:
print('the value of x, y is') print((x))
well, must think in way solve equation 2 variables using programming language, it's not straightforward if you're not familiar programming.
think steps have take solve manually first , try implement using python, i'll try guiding:
1- find number multiply 1 of equations can "remove" 1 of variables.
2- sum both of equations (forget variables now, work coefficients)
3- after summing both equations , storing "new_coefficient" values , assuming removed x
should have like: ((e*step_1_number)+b)*y = f*step_1_number + c
4- previous step you'll able find y
value, after it's pretty easy find x
value.
i managed using python don't think it's going useful if post code, try work out yourself, luck!
Comments
Post a Comment