Changing the shape of the initial value problem in DiffentialEquations.jl and possible performance issues

Dear Community

I’m not very familiar with the numerical handling of ODEs in Julia. Maybe I should begin with my goal, what I want to achieve in order to simplify the feedback loop.

I try to implement a variational solver for a one-dimensional equation (this will be extended later). Therefore I defined an ansatz u=u(x_1,...,x_n), let’s say all parameters in the ansatz depend on time t and this finally ends up in an evolution equation for the parameters X=(x_1,...,x_n) of the ansatz of the form M(X) \dot{X} = F(X). Where M(X) is a coefficient matrix with polynomial nonlinearities in the x_i`s and F(X) is a vector-valued function of X.

Now I want to use DifferentialEquations.jl to solve the evolution equation for the parameters and plug it into my ansatz function u. But it seems DifferentialEquations.jl only can handle problems of the from \dot{X} = f(X, t, x) as an input.

My question is now if it is possible to change the problem shape of the input to my original system M(X) \dot{X} = F(X) or in case this is not possible do I have to expect performance losses from (some?) algorithms when I bring the system to the form \dot{X} = M(X)^{-1} F(X), where the matrix M(X)^{-1} now contains rational nonlinearities.

Cheers

No, you’re looking for a mass matrix:

https://docs.juliadiffeq.org/latest/tutorials/advanced_ode_example/#Handling-Mass-Matrices-1

Thanks for your input, I’m almost at the solution to my problem. Right now I’m failing at a syntax barrier because in my case, the vector F and the matrix M both depend on the unknown vector X. By creating a system of equations like in the test example of your answer, it only sends back unknown variable errors. I just want to be securce that it is still possible to have a mass matrix depending the unknown variable? I serached the documentation but foundy any hints to my concrete problem.

Cheers

Oh you want a state-dependent mass matrix? We need to document how to do that. In the meantime, the more general form is to just use a DAE:

https://docs.juliadiffeq.org/latest/tutorials/dae_example/