Solving Tutorial > Task 2–2: Optimization with Constraints
  
Task 2–2: Optimization with Constraints
Use a solve block to find the width and length of a rectangle with a maximum area enclosed in a circle.
1. Define the radius of the circle.
2. Define length d, as shown in the illustration above.
3. Insert a solve block, define guess values for a and b, define the area function, and define the constraint d < r for keeping the rectangle inside the circle. To solve for a and b, call the maximize function.
4. Evaluate A, B, and d.
As expected, A = B. This implies that the rectangle with the maximum area is in fact a square where d = r.
5. Plot the circle along the square with sides A and B.
* 
Plot the top and bottom halves of the circle using two separate traces.
Similarly, plot the four sides of the square using four separate traces.
Proceed to Task 2–3.