from gekko import GEKKO import numpy as np m = GEKKO(remote=False) x10 = 0; x20 = 1 u, x11, x12, x21, x22, dx11, dx12, dx21, dx22 = m.Array(m.Var,9) u.value = 1; x11.value = 1; x12.value = 1; x21.value = 1; x22.value = 1 N = np.array([[0.75, -0.25],\ [1.00, 0.00]]) m.Equations([np.dot(N[0],[dx11, dx12]) == x11 - x10, np.dot(N[1],[dx11, dx12]) == x12 - x10, np.dot(N[0],[dx21, dx22]) == x21 - x20, np.dot(N[1],[dx21, dx22]) == x22 - x20, 5*dx11 == -x11 + 2*u**2, 5*dx12 == -x12 + 2*u**2, 3*dx21 == -x21 + x11**2, 3*dx22 == -x22 + x12**2, x22-5 == 0]) m.solve(disp=False) print(u[0]) print(x10, x11[0], x12[0]) print(x20, x21[0], x22[0]) print(dx11[0], dx12[0], dx21[0], dx22[0])