Question: following python program using python 3xx write a linear equation. A generic linear equation is of the form y =mx+b where m and b are

following python program using python 3xx

write a linear equation. A generic linear equation is of the form y =mx+b where m and b are constants. include the following methods:

----> __init__, __str__,__repr__

----> vaue(x), which returns the value of the equation given x

----> compose(Linear equation) that composes two linear equations. that is y=x+1 and z=2a+5, then y(z)=2x+6 and will be called as y.compose(z). Not that compose operation is commutative.

----> __add__ returns the sum of two linear equations. that is if y=ax+b and z= cx+d, then y+z=(a+c)x+(b+d).

Include sample code that uses your class and demonstrates use of value (), compose() and __add__

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!