The rule of mixtures is used in the mechanical design of composite structures to estimate the elastic modulus (Ec) based on the following properties:
Ef: elastic modulus of the fiber material Em: elastic modulus of the matrix material ff or fm: volume fraction of the fiber or matrix material (ff = 1 – fm)
Sometimes, the volume fraction is not known and must be calculated from known volumes (Vf and Vm). In this case, ff = Vf / (Vf + Vm).
Based on these values, the lower-bound estimate of elastic modulus is calculated by:
Ec = 1 / (ff / Ef + (1 – ff) / Em).
On the other hand, the upper-bound (linear) estimate of elastic modulus is calculated by:
Ec = ff * Ef + (1 – ff) * Em.
Write a function to calculate either bound, depending on which bound is requested in the input string and using the known volumes.