Why does Maple fail to find a solution to this system of differential equations using rkf45 numerical method but not using the classical method?

105 Views Asked by At

Consider the system of differential equations

$$y'(x)=z(x)\cdot g(x)$$ $$z'(x)=y(x)\cdot g(x)$$

where $g(x)$ is just some random number, generated from seed $x$.

How do we solve this system using the rkf45 numerical method?

Using the "classical" method seems to work just fine, with a plot at the end. Using rkf45, there is always a warning that solutions could not be found to the left/right of some particular value.

Here is the code representing this situation.

with(Statistics);
with(plots);
with(RandomTools[MersenneTwister]);
gen := proc(t) local hrand, intSeed; setState(t); hrand := Sample('Uniform'(1, 2)); return hrand(1)[1]; end proc;
test := proc() local sys, fcns, p; sys := diff(y(x), x) = z(x)*'gen(x)', diff(z(x), x) = y(x)*'gen(x)'; fcns := {y(x), z(x)}; p := dsolve({y(0) = 0, z(0) = 1, sys}, fcns, type = numeric, method = rkf45); odeplot(p, [[x, y(x)], [x, z(x)]], -4 .. 4, symbol = box); end proc;
test();

The code above can be copied and pasted to a Maple worksheet and it will have nicer formatting.

It tries to solve the system of DE with rkf45.

1

There are 1 best solutions below

0
On BEST ANSWER

The classical methods of Maple's dsolve,numeric don't do much (if any) adaptive error control.

That's in contrast to the method=rkf45 solver.

Given the random aspect of the rhs driving functions, how would you want error control (if any) to take effect?

Suppose the solver halves the stepsize temporarily (possibly recomputing over a short duration of the independent variable), to try and assess the error. How should the solver compare such results, in light of the fact that the driver input has a random component?