I have a rectangle, its width is a and its height is b
I want to cover a maximum of surface from that rectangle with n rectangles, those rectangles must have the same dimensions and respect a ratio of w on h
how can I compute the dimensions of the n rectangles ?
I tried the following
$$c = \sqrt{a*b* w/h \over n}$$
$$width = c * w$$ $$height = c * h$$
But it's not perfectly working because this is looking for covering the entire rectangle (so in some cases the result dimensions make a bigger rectangle then the rectangle ab
Unless Fig. 1 depicts an example of what you are expecting, don't read any further, because the description given below is based on it.
It is assumed that $a$, $b$, $h$, $w$, and $n$ are given. Let the height of the small rectangles be $k$. Then, the width of the small rectangles is equal to $k\frac{w}{h}$. Now, we can find out how many small rectangles we need to cover the large rectangle as shown below
$$\mathrm{Nr.\space of\space small\space rectangles\space on\space a\space column} =n_c= \Big\lfloor \frac{b}{k}\Big\rfloor \le \frac{b}{k}\qquad\quad\space$$
$$\mathrm{Nr.\space of\space small\space rectangles\space on\space a\space row} = n_r=\Big\lfloor \frac{a}{k} \times \frac{h}{w}\Big\rfloor \le \frac{a}{k} \times \frac{h}{w}$$
$$\therefore\quad n = n_c\times n_r = \Big\lfloor \frac{b}{k}\Big\rfloor \times \Big\lfloor \frac{a}{k} \times \frac{h}{w}\Big\rfloor \le \frac{a}{k}\times \frac{b}{k}\times \frac{h}{w}.$$
As you see, the relationship between $n$ and the unknown $k$ has been obtained using floor functions. These functions prevent us from making $k$ the subject of an equation, which we need to determine both the height and the width of the small rectangles. Therefore, I think that your question cannot be resolved mathematically. However, one may find a solution experimentally.