# differential equations – Cannot program NDSolve for two-variable system of ODE

$$begin{cases} frac{dx}{dt}+frac{dy}{dt}=frac{df}{d{(x+y)}} \ frac{d}{dt}(frac{df}{d{(x+y)}})+frac{df}{d{(x+y)}}=0 end{cases}$$

where $$f=-(x+y)^2$$

There is my code and error message:

``````ClearAll("Global`*")

extr = -(x(t) + y(t))^2

sys =
NDSolve({x'(t) + y'(t) == D(extr, x'(t) + y'(t)),
D(D(extr, x'(t) + y'(t)), t) + D(extr, x'(t) + y'(t)) == 0,
x(0) == 1, y(0) == 1}, {x, y}, {t, 0, 500})
``````

ERROR:

``````During evaluation of In(672):= General::ivar: (x^(Prime))(t)+(y^(Prime))(t) is not a valid variable.

During evaluation of In(672):= General::ivar: (x^(Prime))(t)+(y^(Prime))(t) is not a valid variable.

During evaluation of In(672):= General::ivar: (x^(Prime))(t)+(y^(Prime))(t) is not a valid variable.

During evaluation of In(672):= General::stop: Further output of General::ivar will be suppressed during this calculation.

During evaluation of In(672):= NDSolve::ntdvdae: Cannot solve to find an explicit formula for the derivatives. NDSolve will try solving the system as differential-algebraic equations.

During evaluation of In(672):= NDSolve::nlnum: The function value {0. -!(*SubscriptBox(((PartialD)), (0.`))(((-4.`)))),!(*SubscriptBox(((PartialD)), (0.`))(((-4.`))))+!(*SubscriptBox(((PartialD)), (0.`))0.`)} is not a list of numbers with dimensions {2} at {t,x(t),y(t),(x^(Prime))(t),(y^(Prime))(t)} = {0.,1.,1.,0.,0.}.

During evaluation of In(672):= NDSolve::icfail: Unable to find initial conditions that satisfy the residual function within specified tolerances. Try giving initial conditions for both values and derivatives of the functions.
``````

Posted on Categories Articles