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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started