In the first part of the paper, we characterize certain systems of first-order nonlinear differential equations whose space of solutions is an
s
l
2
(
C
)
\mathfrak{sl}_{2}(\mathbb{C})
-module.
We prove that such systems, called Ramanujan systems of Rankin–Cohen type, have a special shape and are precisely the ones whose solution space admits a Rankin–Cohen structure.
In the second part of the paper, we consider triangle groups
Δ
(
n
,
m
,
∞
)
\Delta(n,m,\infty)
.
By means of modular embeddings, we associate to every such group a number of systems of nonlinear ODEs whose solutions are algebraically independent twisted modular forms.
In particular, all rational weight modular forms on
Δ
(
n
,
m
,
∞
)
\Delta(n,m,\infty)
are generated by the solutions of one such system (which is of Rankin–Cohen type).
As a corollary, we find new relations for the Gauss hypergeometric function evaluated at functions on the upper half-plane.
To demonstrate the power of our approach in the non-classical setting, we construct the space of integral weight twisted modular form on
Δ
(
2
,
5
,
∞
)
\Delta(2,5,\infty)
from solutions of systems of nonlinear ODEs.