# Behaviour of DSolve

MMA version 13.1

Background

I am trying to get a parametrized representation of some implicit curve and surfaces. If possible the parameter should be the curve length.

Here is a toy example:

Consider a unit circle at the origin. We have x^2+y^2==1. If we take e.g. the angle between the x axis and the radius to the point p={x,y}, we have a parametrization with the curve length: p[t_]={Cos[t],Sin[t]}. For this case, the derivative of p is a unit tangent vector: x'^2+y^2==1. This gives 2 equations for 2 functions x and y.

The equation:

The circle equation and the unit tangent together with initial conditions:

eq= {x[t]^2+y[t]^2==1, x'[t]^2+y'[t]^2==1, {x,y}=={1,0} }


This looks like a simple system of ODEs with the solution {Cos[t],Sin[t]}. However:

DSolve[eq, {x, y}, t]


returns un-evaluated.

Can someone explain, why MMA is not be able to solve such a simple case? Or do I fool myself?

Ulrich mentioned that maybe the DEA system is the problem. Well, we can change this easily. We take the derivative of the first equation. Then we have a pure ODE system:

eq = {x[t] x'[t] + y'[t] y[t] == 0, x'[t]^2 + y'[t]^2 == 1, {x, y} == {1, 0}}


But now it is even worse. Although it gave some warnings DSolve returns an empty list, meaning that there is no solution.

DSolve[eq, {x, y}, t]
(* {} *)

• NDSolve gives a solution. Perhaps DSolvecannot handle such a DAE-system ? Sep 16, 2022 at 10:23
• math.stackexchange.com/questions/1590952/…
– Syed
Sep 16, 2022 at 10:28
• In your addendum, you should perhaps mention that Mathematica does produce warnings (including Solve::ifun, at least in Mathematica 12.3) and that therefore the user is alerted that the empty solution set {} may be wrong. Sep 16, 2022 at 10:49
• The error mentioned in the addendum usually suggests trying the problem without initial/boundary conditions. I think it means DSolve was able to find the general solution or at least a first integral. Sep 17, 2022 at 13:03

I suspect DSolve solves the ODE as a homogeneous one, which is probably a more robust strategy and seems wrong only when things happen to simplify excessively in another coordinate system. The toy system is unusual in that (1) it is homogeneous and (2) simplifies excessively in polar coordinates.

Each of the following yield solutions. The second shows a homogeneous approach that yields a simpler but similar solution to the last one. The last is a general solution, which should be tried when one gets a DSolve::bvnul message. In the OP's IVP, DSolve/Solve fails to determine the constants of integration from the initial condition. Comparting the last two approaches below, it seems DSolve, if in fact it does approach the ODE as homogeneous, takes a slightly different route. Keep in mind, I didn't convert back to x,y coordinates.

eq = x[t]^2 + y[t]^2 == 1;
ode = x'[t]^2 + y'[t]^2 == 1;
ics = {{x, y} == {1, 0}};

toPolar = # /. {x -> Function[t, r[t] Cos[θ[t]]],
y -> Function[t, r[t] Sin[θ[t]]]} &;
DSolve[
toPolar@{ode, D[eq, t], ics},
{r, θ}, t]
(* warnings of possible lost solutions (Solve::ifun) *)
(* output omitted (six redundant branches, r = ±1, θ = ±t + const) *)

fromHom = # /. {x -> Function[t, x[t]], y -> Function[t, x[t] u[t]]} &;
DSolve[
fromHom@{ode, D[eq, t], ics},
{x, u}, t]
(* warnings of possible lost solutions (Solve::ifun) *)
(* output omitted (two branches, redundant semicircles) *)

DSolve[{ode, D[eq, t]}, {x[t], y[t]}, t]
(* output omitted (eight branches) *)


Given how slight alterations in an ODE can change it from easy to impossible to solve, I'm not sure how helpful the analysis of the toy example can be. I have doubts that more insight in to the behavior of DSolve can be found from the toy example beyond what I presented above.

• Great answer Michael, thank you. How did you get the idea to make y depended on x: y= x u. And why does this help? Sep 17, 2022 at 17:10
• @DanielHuber It's a standard solution method one can find in introductory diff. eqns. textbooks that still cover homogeneous ODEs. The substitution arises in other contexts where you run into homogeneous equations, such as algebraic geometry. A hom. eqn. may be rewritten in terms of the slope $u=y/x$, which leads to the same substitution $y=ux$. Having studied both, it was just a substitution I've been taught to try in homogeneous equations. Sep 17, 2022 at 17:21
• Looks a bit frustrating that MMA is not trying a standard method. Sep 18, 2022 at 8:59
• E Not the ultimate solution, but better than nothing using a series expansion with AsymptoticDSolveValue: eq = {x' [t]^2 + y' [t]^2 == 1, x' [t] x [t] + y' [t] y [t] == 0, x == 1, y == 0}; sol = AsymptoticDSolveValue[eq, {x, y}, {t, 0, 20}] Sep 21, 2022 at 10:24

Let Reduce prepare the equations to get desired result.

D[x[t]^2 + y[t]^2 == 1, t]

eq = {x[t] x'[t] + y'[t] y[t] == 0,
x'[t]^2 + y'[t]^2 == 1, {x, y} == {1, 0}};

red2 = Reduce[{x[t] Derivative[x][t] + y[t] Derivative[y][t] ==
0, Derivative[x][t]^2 + Derivative[y][t]^2 == 1}, {x'[t],
y'[t]}, Reals];

StandardForm[
red2 //. Or ->
Composition[(Column[#, Right, Background -> {{White, LightGray}},
Frame -> All] &), List]] Take for example the last two equations

dsol = DSolve[{Derivative[x][t] == Sqrt[y[t]^2/(x[t]^2 + y[t]^2)],
Derivative[y][t] == -((x[t] Derivative[x][t])/y[t]),
x == 1, y == 0}, {x, y}, t]

{{x1[t_], y1[t_]}, {x2[t_], y2[t_]}} =
FullSimplify[{x[t], y[t]} /. dsol]

(*   {{Cos[t], -Sqrt[Sin[t]^2]}, {Cos[t], Sqrt[Sin[t]^2]}}   *)


Edit

Regarding the pureODE. The problem then is the zero in {x,y}. Yields only definite solution with Limit. Start with other t0.

pureODE = {x[t] x'[t] + y'[t] y[t] == 0, x'[t]^2 + y'[t]^2 == 1}

dsol = DSolve[{pureODE, x[Pi/4] == Cos[Pi/4],
y[Pi/4] == Sin[Pi/4]}, {x, y}, t]

({x[t0], y[t0]} /. dsol // FullSimplify) /. t0 -> 0

(*   {{Indeterminate, 0}, {Indeterminate, 0}, {0, 1}, {Indeterminate,
0}, {Indeterminate, 0}}   *)

Limit[({x[t0], y[t0]} /. dsol // FullSimplify), t0 -> 0] // TableForm  (* but third solution is wrong  *)

({x[t0], y[t0]} /. dsol // FullSimplify[#, 0 < t0 < Pi] &)

(*   {{Cos[t0], Sin[t0]},
{Cos[t0], Sin[t0]},
{Tan[t0]/Sqrt[Sec[t0]^2], Abs[Cos[t0]]},
{Cos[t0], Sin[t0]},
{Cos[t0], Sin[t0]}}   *)


Don't know why the DAE system is not working.

• Thank you for your answer. Any idea why MMA does not try it automatically. Sep 18, 2022 at 9:00

Your Background is a little bit too thin.

In Mathematics this might be quite a strange problem. In Mathematica, it is not.

Since very early versions of Mathematica there has been the package:

EquationTrekker

This is a valuable tool!

Despite the very technical name it does a very meaningful job of plotting a Poincare plot or section. That is the phase space section. Section because phase spaces are higher dimensional than the problem of consideration. And as You might already know higher dimensionality is inaccessible to humans used to geometrics.

So to Your very problem. You pose here on the community a very particular formulation of the problem. That is the cause why everybody ready to answer here starts to reformulate the problem.

And so do I. But as my link already did answer the very problem in a suitable formulation in a rather more general form of the problems formulation: EquationTrekker.

The very danger for the newbie is that the conditions got somewhat implicit by the quick formulation. There is some standard book on pde around giving this in the for Mathematicians proper path of transformations.

The advantage of EquationTrekker is that it uses NDSolve. That is what You already rejected. But the use does not directly avoid working with DSolve it is more are the path that NDSolve immanently tries to solve the pde with DSolve before starting the larger, more tedious, and expensive NDSolve processes. This can sometimes be recovered by the user in the results.

So EquationTrekker plots what can be named a solvability overview. Now therefore there is a need to interpret them as beautiful as confusing plots. The package plots the Poincare sections but it does not offer any help to interpret them. That is to learn or study on a longer time scale.

EquationTrekker is somewhat infamous for taking very long for the plot. The same is commonly true for the Poincare plots themself. So a chain of a long time needs processes for knowledge.

So the formulation that You offer is unstable. So DSolve can solve the problem in general but not if the point in the phase space itself in the unstable points for solutions.

Now there is a lot of text written but no code enter and the progression is little as well. We did only progress in theory abstraction on the informal level.

The code is in my link. That is Wolfram anciency. The main path in literature is to reduce the dimensions of the posed problem to one before solving the pde system. That is possible by coincidence or an mathematical accident. The $$x$$ is the angle the radius remain fixed. So the phase space remains two dimensional and the subspace of $$\{r,0\}$$ that is a single point.

There is no general path beyond this informal phase space, Poincare plot interpretation. Because everybody can understand it. There are introductory text for example on wikipedia.org for the pde and Poincare that are free on the internet.

With EquationTrekker You get a window with input field to vary the initial values or boundary value to match Your selected problem. Hope that this not only help but solves the needs of Your question and subquestions.

Here is the successor a simplification: advanced-hybrid-and-differential-algebraic-equations/poincare-sections and the updates version PoincareSections.

This question tends more to the interpretation poincare-maps-and-interpretation.

sol = NDSolve[{x'[t]^1 + y'[t]^1 == 1, x[t]^2 + y[t]^2 == 1,
x == 1, y == 0, x' == 1, y' == 0}, {x[t], y[t]}, {t, 0,
0.415}]

Plot[Evaluate[{x[t], y[t]} /. sol], {t, 0, .4125},


PlotLegends -> "Expressions", AspectRatio -> Automatic] This shows that the approximation works with EquationTrekker based on NDSolve.

There is biggest t for which the solutions can be calculated. There is need to think about the starting conditions for better results.

DSolve does not even produce an answer in 13.1.

From the classification this is a first-order nonlinear differential equation with a constraint. It is both nonlinear in $$x$$ and $$y$$. There is a parametrization in $$t$$ otherwise this gets meaningless or needs reformulations. Look for example at ImplicitD that is new in 13.1.

 ParametricPlot[Evaluate[{x[t], y[t]} /. sol], {t, 0, .4125},
PlotLegends -> "Expressions", AspectRatio -> Automatic] or

ParametricPlot[Evaluate[{x[t], y[t]} /. sol], {t, 0, .4125},
PlotLegends -> "Expressions", AspectRatio -> 1] This is already a reformulation of the problem to solve it at all in Mathematica!!!

This is a fast shot. Mathematica should be able to calculate this closed in the plot at the end of the definition range.

DSolve[ImplicitD[x, x^2 + y[x]^2 == 1,x]^2 +  ImplicitD[y[x], x^2 + y^2 == 1,x]'^2 == 1, y, x] This reduces the input but does not solve it.

DSolve[x^2+(y[x]^\[Prime])^2==1,y,x]


has solutions.

Old solution form 12.0

$$\left\{\left\{y\to \left(\{x\},c_1+\frac{1}{2} \left(-\sqrt{1-x^2} x-\sin ^{-1}(x)\right)\right)\right\},\left\{y\to \left(\{x\},c_1+\frac{1}{2} \left(\sqrt{1-x^2} x+\sin ^{-1}(x)\right)\right)\right\}\right\}$$

New solution from 13.1

$$\left\{\left\{y\to\left(\{x\},+\frac{1}{2}\sqrt{1-x^2}x-\tan^{-1}\left(\frac{\sqrt{1-x^2}}{x+1}\right)+c_1\right)\right\},\left\{y\to\left(\{x\},-\frac{1}{2}\sqrt{1-x^2}x+\tan^{-1}\left(\frac{\sqrt{1-x^2}}{x+1}\right)+c_1\right)\right\}\right\}$$

 ParametricPlot[{x,Sqrt[1-x^2]/2-ArcTan[Sqrt[1-x^2]/(1+x)]} , {x, -10, 10}] ParametricPlot[{x,,-Sqrt[1-x^2]/2+ArcTan[Sqrt[1-x^2]/(1+x)]} , {x, -10, 10}] This use the unadopted parameter of $$c_{1}$$.

This is caused by the parametrization. This is a so called roll-of-curve. Again these are only construction solution and not full solutions. Caused by the started poiint of a nonlinear description homogeneous soluiotns might be lost.

This is a solutions set computed with a two step using DSolve and the implicit differentiation on the unit circle as constraint via ImplicitD. By that the two equation are reduced to one that was the real differential equation of the problem.

The solution remains to be a circle of unit radius.

The solution path via $$NDSolve$$ is left to the roll-off-curve concept. $$NDSolve$$ will calculate better solution is used fully fleshed but the curve needs like a real circle or ellipse have parallel curvature, derivative to the y-axis and that is singular for $$NDSolve$$. A change in parametrization like in the phase space Poincare plot example shown in $$EquationTrekker$$ is much more appropriate.

My curves are in different segment on the plane and evolve in different direction but all look rather the same! So $$NDSolve$$ is not out of the way for a solution. It can do it. The reformulation is new an only available in 13.1 as required. Have a nice end of the bounty.

DSolve[{x'^2+y'^2==1,x^2+y^2==1},{ x,y },t,

• Some prefer to do this more like this differential equation of circles! Perhaps this pde for ciricle with radius $s$. EquationTrekker is user friendly. Just enter the pde correctly and it works. The changes in representation too offer insight into the stability question. Sep 20, 2022 at 20:10