In: Mechanical Engineering
Suppose you have a wire of length L. You cut a length x to make a square and use the remaining length L - x to make a circle. Use MuPAD to find the length x that maximizes the sum of the areas enclosed by the square and the circle.
Perimeter of the square is x.
Perimeter of the circle is L-x.
Therefore, the side and area of the square is
a = x/4
Area = a2 = x2/16
Radius and area of the circle is
r = L – x/2π
Area = πr2
A = π{(L – x)/2π}2
A = (L – x)2/4π
Now, A function in MATLAB can be made which will represent the sum of the two areas. That function can then be maximize to obtain the desired x.
The MATLAB code is given below. The variables A1 and A2 represent two areas. Differentiation of the sum of two areas is calculated and equated to zero to find the maximum.
Input:
syms x L
A1 = x^2/16;
A2 = (L-x)^2/(4*pi);
dif = diff(A1+A2);
solve(dif)
Output
Therefore,
x = 4L/(π + 4).
Therefore output is
x = 4L/(π + 4).