ParametricNDSolveValue
seems to have a problem with a certain combination of matrices and complex numbers. Here is a minimal example (also attached):
R[t_] = Through[#[t]] & /@ Table[Subscript[r, i, j], {i, 2}, {j, 2}];
ParametricNDSolveValue[{R'[t] == I R[t], R[0] == DiagonalMatrix[{0, n}]}, Subscript[r, 2, 2], {t, 0, 10}, {n}][1][1]
ParametricNDSolveValue[{R'[t] == I R[t], R[0] == DiagonalMatrix[{0, 1}]}, Subscript[r, 2, 2], {t, 0, 10}, {n}][1][1]
ParametricNDSolveValue[{R'[t] == R[t], R[0] == DiagonalMatrix[{0, n}]}, Subscript[r, 2, 2], {t, 0, 10}, {n}][1][1]
The difference between the first and the second evaluation of ParametricNDSolveValue
is only that the value of n
is already inserted into the DE in the second case. So the results should be the same. But they are not.
I also noticed that removing the I
(third evaluation) works when n
is only assigned afterwards.
Does anybody understand this? Is this a bug? Most importantly, is there a way around it?
Thanks for any input!
Attachments: