Tutorial A2¶
1 Consider the equation \(y = \frac{3a + 2b}{b^2}\), with \(a = 1\) and \(b = 2\).
Calculate \(y\) using Python.
Of what type is the result?
How can you force the result to be a whole number?
Of what type is the result if \(b = 1\)?
What happens if \(b = 0\)?
2 Calculate the gravitational force between the moon and the earth at a distance of \(r = 3.84\times 10^8\) m, with masses \(m_\mathrm{earth} = 5.97\times 10^{24}\) kg, \(m_\mathrm{moon} = 7.35\times 10^{22}\) kg. Use \(G = 6.67 \times 10^{-11}\) m\(^3\) kg\(^{-1}\) s\(^{-2}\) for the gravitational constant.
Advanced 1 How does Python handle infinity and absent numeric values? What is the result of a multiplication of these values with 0?
Note: Advanced exercises are not mandatory to get the points.