Exercises

Ex. 1 → Write a method simplify to the class RationalNumber. This method should return the simplified version of the fraction as a tuple.

Ex. 2 → To provide results with confidence intervals a special calculus, so-called interval arithmetic is introduced in numerical mathematics; (refer to [3, 14]). Define a class called Interval and provide it with methods for addition, subtraction, division, multiplication, and power (with positive integers only). These operations obey the following rules:

Exercises.

Provide this class with methods that allow operations of the type a + I, a I, I + a, I a, where I is an interval and a an integer or float. Convert ...

Get Scientific Computing with Python 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.