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]}};

NDSolve[Flatten@{Thread[p'[t] == A[t].p[t]], 
                  Thread[p[t] == {1, 0}] /. t -> 0}, {p1, p2}, {t, 0, 1}]

NDSolve::ndsz: At t == 0.9040861047003397`, step size is effectively zero; singularity or stiff system suspected. >>

  • $\begingroup$ I believe there will be but I am not certain. (You noticed the comment in time; I was giving it only 5 minutes before deleting). $\endgroup$ – Daniel Lichtblau Sep 25 '14 at 23:07
  • $\begingroup$ @DanielLichtblau Deleting all the rest too. Nice post on image domain calc! $\endgroup$ – Dr. belisarius Sep 25 '14 at 23:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.