I have a function functiontoplot
defined using the following piece of code:
f1 = -α*u*v + u*(1 - u)*(u - m)*(u + v);
f2 = β*u*v - γ*v*(u + v);
eq = Solve[{f1, f2} == 0, {u, v}][[5]];
jacobianmat = D[{f1, f2}, {{u, v}}];
diffmatrix = DiagonalMatrix[{D1, D2}];
det = Simplify[Det[jacobianmat - μ*diffmatrix] /. eq];
der = Simplify[D[det, μ]];
ksquared = Simplify[Solve[der == 0, μ][[1]]];
functiontoplot = Simplify[det /. ksquared];
α = 0.24;
β = 0.19;
γ = 0.01;
D2 = 10^-4;
With this, functiontoplot
depends on two parameters: $m$ and $D1$. I want to plot the implicit curve defined by the equation functiontoplot==0
, using the method of pseudo-arclength continuation. Up until now, I have tried with the following piece of code:
func = functiontoplot /. {m -> m[t], D1 -> D1[t]};
eqn = D[func, t] == 0;
D1values = D1 /. Quiet@Solve[functiontoplot == 0 /. m -> 0.0461, D1];
sol = NDSolve[{eqn, m'[t]^2 + D1'[t]^2 == 1, m[0] == 0.0461, D1[0] == D1values[[1]]}, {m, D1}, {t, -15, 15}
but after running it, I get the following error:
With that in mind, I tried changing the last line of the previous code by
sol = NDSolve[{eqn, m'[t]^2 + D1'[t]^2 == 1, m[0] == 0.0461, D1[0] == D1values[[1]]}, {m, D1}, {t, -15, 15}, Method -> {"EquationSimplification" -> "Residual"}];
But I get the following output:
Is there a way to estimate the derivatives of the functions $m[t]$ and $D1[t]$, or another method to solve this problem?
I have plotted the curve using the following line of code:
ContourPlot[functiontoplot == 0, {m, 0.04605, 0.04635}, {D1, 0, 0.00005}]
and I have gotten the following output:
Yet I want to be able to plot the function in an accurate way using the pseudo-arclength continuation method to plot other curves that may be defined by messy functions that ContourPlot
takes a long time to plot.