[Math] How to create a simple differential equation

ordinary differential equations

I am doing numerical analysis where we work with differential equations but I have never had any classes on differential equations. It seems you can get by in an introductory numerical analysis course with just knowing what a differential equation is an how the initial value problem solving process works. So I know a few process for solving them numerically but I have never learned how to solve them mathematically.

Anyway, I would like to know how to 'create' differential equation for testing my numerical approximation algorithms against, but as I have never learned how to deal with them mathematically I don't know the process for creating them. Can someone show me a step by step process for creating simple differential equations?

If I have $y = 5x^2 +c$, $c$ being some constant

I can make a differential equation of the form –

$\frac{dy}{dx} = 10x$

But I want to have differential equations where the $\frac{dy}{dx}$ is dependent on not just $x$, but on $x$ and $y$.

What is the process for doing this?

Edit

To clarify, I am looking to create simple equations of the form $\frac{dy}{dx} = f(x,y)$, $y(0) = y_0$ with solutions $y$ that are also relatively simple. This is so I can then write out the first few iterations of RK methods by hand to see how it all works.

Best Answer

Consider the family of curves $\gamma_C$ given by an equation of the form $$F(x,y)=C\ ,\qquad(1)$$ where the function $$F:\ {\mathbb R}^2\to {\mathbb R}\,\quad (x,y)\to F(x,y)$$ is explicitly given; e.g. $F(x,y):=x^2+y^2$. "Locally" such a $\gamma_C$ is the graph of a function $x\mapsto y(x)$. It follows that the function $$x\mapsto\phi(x):=F\bigl(x, y(x)\bigr)$$ is identically equal to $C$. Therefore by the chain rule $$\phi'(x)=F_{.1}\bigl(x,y(x)\bigr)\cdot 1+ F_{.2}\bigl(x,y(x)\bigr)\cdot y'(x)\equiv0\ ,$$ where $F_{.1}$ denotes the partial derivative of $F$ with respect to the first entry, and similarly for $F_{.2}$. Solving the last equation for $y'(x)$ gives $$y'(x)\equiv -{F_{.1}\bigl(x,y(x)\bigr)\over F_{.2}\bigl(x,y(x)\bigr)}\ .$$ But this is saying that the function $x\mapsto y(x)$ satisfies the differential equation $$y'=-{F_x(x,y)\over F_y(x,y)}\ .\qquad(2)$$ Here the right side ($=: f(x,y)$) is a known (resp., easily computable) function of $x$ and $y$ which is independent of $C$. Therefore the equation $(2)$ can be considered as the differential equation characterizing the family of curves $\gamma_C$ defined by $(1)$.

Consider the following example: The set $\gamma_C$ of points $(x,y)$ whose distances to the "foci" $(\pm1,0)$ have given product $C>0$ is called a Cassini curve. The equation of this curve is given by $$F(x,y):=\bigl((x-1)^2+y^2\bigr)\bigl((x+1)^2+y^2\bigr)=C^2\ .$$ When $C=1$ this curve is called a lemniscate. In order to obtain the differential equation of the family of curves $\gamma_C$ we compute $$F_x=2(x-1)\bigl((x+1)^2+y^2\bigr)+2(x+1)\bigl((x-1)^2+y^2\bigr)=\ldots$$ and $$F_y=2y\bigl((x+1)^2+y^2\bigr)+2y\bigl((x-1)^2+y^2\bigr)=\ldots\quad.$$ After doing the calculations (and maybe some simplification) we can put down the differential equation $$y'=-{F_x(x,y)\over F_y(x,y)}=:f(x,y)\ ,$$ where now $f(x,y)$ is a certain definite expression in $x$ and $y$ not containing the parameter $C$.

Note that the above explanations do not take into account "singular points" or points where the tangent of the considered curve $\gamma_C$ is vertical.