I came across a problem of coupled differential equations of a non-analytical results. It follows that NDsolve
requires an evaluated form of equations to be fed into it for a differential equation to process.But, my functions can't be evaluated analytically. I want to know if there is any possible way to tackle the problem. I have created a sample problem here:
First I create a Complex system just to confirm I will get non-analytical solutions:
Mat[n_, x_, y_] := SparseArray[{Band[{1, 1}, {n, n}] -> {x^3, x I + 5 y^2 + 4, Sqrt[x]},
Band[{1, 2}, {n, n}] -> {y^3, Sqrt[x + I x^3 - y^2 + 4],
Sqrt[x - y^2]}, Band[{3, 1}, {n, n}] -> {I x^3, x + y x^2 + 4, Sqrt[x + y^2]}}]
eval[n_, x_, y_] := Eigensystem[Mat[n, x, y]][[1]]
evec[n_, x_, y_] := Eigensystem[Mat[n, x, y]][[2]]
Secondly, I will form some time-dependent functions so as to cover the complexity of my problem:
val = D[Mat[8, x, y], x];
x2[x1_, t_] := x1 + t^2
y2[y1_, t_] := y1 + t
T1[x1_, y1_] := {I Conjugate[#], #} &@(Conjugate[evec[8, x1, y1][[6]]].SparseArray[
ArrayRules[val] /. {x -> x1, y -> y1}, Dimensions[val]].evec[8, x1, y1][[7]] // N)
T2[t_] := {t, t^2}
T3[x1_, y1_, t_] := T1[x2[x1, t], y2[y1, t]]
T4[x1_, y1_, t_] := Re[eval[8, x2[x1, t], y2[x1, t]][[7]]] - Re[eval[8, x2[x1, t], y2[x1, t]][[8]]]//N
Last, I will list them in the required form of equation and initial conditons for processing:
t0=-5;
eqns[x1_, y1_, t_] := {A1'[t] == (T2[t].T3[x1, y1, t]) A2[t], A2'[t] == A1[t] (T2[t].Conjugate[T3[x1, y1, t]]),
i'[t] == T4[x1, y1, t],A1[t0] == 0, A2[t0] == 1, i[t0] == 0}
sol1 = ParametricNDSolve[eqns[x1, y1, t], {A1[t], A2[t]}, {t, t0, 5}, {x1, y1}]
As you see, say, eqns[x1, y1, t]
can't be evaluated unless you provide numerical values of all the parameters. How do we solve the equations in that case. I would be grateful for your help.
(Note: this is a sample just to reflect my problem, feel free to make reasonable changes)
eqns
also has a functioni
. Have you defined it or should it be solved for? $\endgroup$ – Natas Jun 19 '20 at 11:05NumericQ
functionality, as described here? $\endgroup$ – MarcoB Jun 19 '20 at 15:25T4
. Much more simplified, how can i solve this:ParametricNDSolve[ i'[t] == T4[x1, y1, t], i[t0] == 0, {i[t]}, {t, t0, 5}, {x1, y1}]
. $\endgroup$ – Rupesh Jun 19 '20 at 17:18