In [62]:
A0 = 32
A1 = 34
A3 = 45
TH = 11
TW = 14

In [63]:
import sympy
from sympy import Eq

In [64]:
h = sympy.symbols('h0:4')
w = sympy.symbols('w0:4')
A = sympy.symbols('A')

In [65]:
rels = [Eq(h[0]+h[2], TH),
        Eq(w[2]+w[3], TW),
        Eq(h[0], h[1]),
        Eq(h[2], h[3]),
        Eq(w[0], w[2]),
        Eq(h[0]*w[0], A0),
        Eq(h[1]*w[1], A1),
        Eq(h[2]*w[2], A),
        Eq(h[3]*w[3], A3),]
solns = sympy.solve(rels)

In [66]:
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle

In [87]:
for soln in solns:
    fig, ax = plt.subplots()
    
    coords = [(0, 0, soln[w[2]], soln[h[2]]),
              (soln[w[2]], 0, soln[w[3]], soln[h[3]]),
              (soln[w[2]], soln[h[2]], soln[w[1]], soln[h[1]]),
              (0, soln[h[2]], soln[w[0]], soln[h[0]])]
    
    colors = 'rwww'
    
    for color, (x,y,w_,h_) in zip(colors, coords):
        rect = Rectangle((x, y), w_, h_, ec='k', fc=color)
        ax.text(x+w_/2, y+h_/2, h_*w_, ha='center', va='center', size=20)
        ax.add_patch(rect)
        
    ax.set_ylim(0,12)
    ax.set_xticks([0,14])
    ax.set_xlim(0,15)
    ax.set_yticks([0,11])
    ax.set_facecolor('gray')
    plt.show()



In [85]:
for soln in solns:
    print(soln[A])


32
45