Math for - OOP: Inheritance, continued

  1. Engineering Component Properties

    An engineering design system has a base component "Frame". All Frames have a mass (M). A "ReinforcedFrame" is a type of "Frame". It inherits mass and adds a tensile_strength (T). The formula for its load_capacity (L) is $L = T \times 0.5 + M \times 0.1$.

    A "LightweightFrame" is also a type of "Frame". It inherits mass and adds a flexibility_rating (F). Its vibration_dampening (V) is $V = F \times 2 - M \times 0.05$.

    1. A ReinforcedFrame has $M=50$ kg and $T=300$ N/mm$^2$. Calculate its $L$.

    2. A LightweightFrame has $M=20$ kg and $F=8$ units. Calculate its $V$.

    3. If we have a component that is only specified as a "Frame" with $M=30$ kg, can we calculate its load_capacity or vibration_dampening? Why or why not?

  2. Set of Numbers with Properties

    Let $U$ be the set of all positive integers. For any integer $x \in U$, we can calculate $x^2$. Let $E$ be the set of all positive even integers. $E \subset U$. For any $y \in E$, we can also calculate $\frac{y}{2}$. Let $O$ be the set of all positive odd integers. $O \subset U$. For any $z \in O$, we can also calculate $2z+1$.

    1. Consider the number $6 \in E$. Calculate $6^2$ and $\frac{6}{2}$.

    2. Consider the number $5 \in O$. Calculate $5^2$ and $2(5)+1$.

    3. Consider the number $k=4$. Since $k \in E \subset U$, what calculations (from the ones mentioned: $x^2, y/2, 2z+1$) are defined for $k$? List the results of these defined calculations.

    4. If a number $m$ is only known to be in $U$, which of the calculations $m/2$ (associated with $E$) or $2m+1$ (associated with $O$) can you be sure is a specifically defined operation for $m$ based on the rules for $E$ and $O$? Explain.

  3. Formula Specialization (Physics Context)

    The general formula for displacement ($s$) of an object under constant acceleration ($a$) is $s = v_0 t + \frac{1}{2} a t^2$, where $v_0$ is initial velocity and $t$ is time. This general scenario is "AcceleratedMotion".

    1. An object starts with $v_0 = 5$ m/s and accelerates at $a = 2$ m/s$^2$ for $t = 4$ s. Calculate its displacement $s$.

    2. A special case is "MotionFromRest", where the object starts with $v_0 = 0$ m/s. Adapt the general formula for "AcceleratedMotion" to create a simplified formula for displacement specifically for "MotionFromRest".

    3. Using your simplified formula from (b), calculate the displacement of an object starting from rest that accelerates at $a = 3$ m/s$^2$ for $t = 5$ s.

  4. Geometric Calculations (2D and 3D Shapes)

    Consider a 2D shape, a "BaseRectangle", defined by length $L$ and width $W$. Its area is $A_{2D} = L \times W$ and its perimeter is $P_{2D} = 2(L+W)$.

    Now, consider a 3D shape, a "RectangularPrism", which is formed by extending a "BaseRectangle" to a height $H$. The "RectangularPrism" inherits the base dimensions $L$ and $W$ and adds the dimension $H$. Its volume is $V_{3D} = L \times W \times H$. Its surface area is $SA_{3D} = 2(LW + LH + WH)$.

    1. A BaseRectangle has $L=10$ cm and $W=5$ cm. Calculate its area $A_{2D}$ and perimeter $P_{2D}$.

    2. A RectangularPrism is formed using this BaseRectangle ($L=10$ cm, $W=5$ cm) and has a height $H=4$ cm. Calculate its volume $V_{3D}$.

    3. Can the volume $V_{3D}$ of the RectangularPrism be expressed using the area $A_{2D}$ of its base? If so, write this relationship.

    4. Show how the surface area $SA_{3D}$ of the RectangularPrism can be expressed in terms of the area $A_{2D}$ and perimeter $P_{2D}$ of its BaseRectangle, and its height $H$.

  5. Algorithmic Efficiency (Conceptual Math)

    You need to calculate two values for a series of $N$ different geometric objects: Value 1 ($V_1$): Requires 3 arithmetic operations using object-specific parameters. Value 2 ($V_2$): Requires 5 arithmetic operations, 2 of which are identical to two operations already performed for $V_1$ using the same parameters.

    Scenario X (Independent Calculation): You calculate $V_1$ and $V_2$ completely independently for each of the $N$ objects.
    Scenario Y (Shared Calculation): You identify the 2 common operations. For each object, you perform these 2 common operations once. Then you perform 1 additional operation for $V_1$ (total 3 for $V_1$) and 3 additional operations for $V_2$ (total 5 for $V_2$).

    1. For one object, how many total distinct arithmetic operations are performed in Scenario X?

    2. For one object, how many total distinct arithmetic operations are performed in Scenario Y (common ops + specific ops for $V_1$ + specific ops for $V_2$)?

    3. If $N=100$ objects, what is the total number of operations for Scenario X and Scenario Y?

    4. Which scenario is more efficient, and how many operations are saved over 100 objects by choosing the more efficient scenario? Explain what this saving represents.