# Substitution of a function in a differential equation

Suppose we have a differential equation as follows:

    g[t_] := t/2
m[t_] := t/3
A[t_] := {{g[t], 1}, {1, m[t]}}
p'[t] == A[t]. p[t], p[0] == {1, 0}


and a solution is easily found with NDSolve:

    NDSolve[{p'[t] == A[t]. p[t], p[0] == {1, 0}}, p, {t, 1, 0}]


Let p[t]={p1[t],p2[t]} be the solution. My question: is there a way to solve a similar equation, but with A[t] equals to

    A[t_] = {{p1[t],1},{1,p2[t]}}


that is, substituting g and m with the unknowns? (Of course without re-defining the system with two unknowns and substituting). Something worked in the one dimensional case (what follows explains maybe better what I'd like to do), where these two problems are equivalent:

    NDSolve[{p'[t] == p[t]^3, p[0] == 1}, p, {t, 0, 1}]
Module[{g = p, m = p}, {{g[t] /. g -> p}, {m[t] /. m -> p}};
NDSolve[{p'[t] == m[t] g[t] p[t], p[0] == 1}, p, {t, 0, 1}]]


but I can't figure out how to extend it in the two dimensional one.

You can do it like this, but your system is Stiff:

p[t]  = {p1[t], p2[t]};
p'[t] = {p1'[t], p2'[t]};
A[t_] = {{p1[t], 1}, {1, p2[t]}};