DGS Studio

Differential Equations

Differential Equations

Solve dsolve(equation, y(x)) for separable and linear first-order equations and constant-coefficient second-order equations. Initial conditions replace C1 and C2.

Solve Equation accepts dsolve(diff(y(x),x)-y(x),y(x)) and returns y(x)=C1*exp(x). The equation is first-order and separable. Separation writes dy/y = dx, integrates both sides with the existing antiderivative routine, and writes the constant as C1 after exponentiating. Substitution of that solution, using its computed derivative, simplifies to 0.

dsolve(diff(y(x),x)-2*x,y(x)) is y(x)=x^2+C1. dsolve(diff(y(x),x)-2*y(x),y(x)) is y(x)=C1*exp(2*x). dsolve(diff(y(x),x)-x*y(x),y(x)) is y(x)=C1*exp(x^2/2). dsolve(diff(y(x),x,2)+y(x),y(x)) uses the characteristic equation r^2+1=0 and returns y(x)=C1*cos(x)+C2*sin(x). dsolve(diff(y(x),x)-y(x),y(x),ics={y(0):2}) applies y(0)=2 after the general solution and returns y(x)=2*exp(x). A step is printed only after that calculation has been performed.

Equation

dsolve(diff(y(x),x)-y(x),y(x))

Graph preview

Graph preview of dsolve(diff(y(x),x)-y(x),y(x))
A static sample of this expression. The studio draws the full interactive result.

How a differential equation is solved

A first-order equation asks for a function whose slope equals a given expression. When the right-hand side does not depend on the unknown, separation writes dy = g(x) dx and integrates both sides. When it factors as g(x) times h(y), the same separation divides by h(y). An equilibrium y = constant is mentioned only after substitution shows that constant has slope zero. A first-order linear equation multiplies by the integrating factor exp of the integral of P, which turns the left side into the derivative of a product. Those integrals come from the existing antiderivative routine. A method that does not evaluate is not presented as a derivation.

A second-order linear equation with constant coefficients uses its characteristic polynomial. Distinct real roots give two exponential terms. A repeated root multiplies the second term by x. A complex pair gives an exponential times sine and cosine. Initial conditions replace C1 and C2 only after the general solution is formed and checked by substitution. When no closed form is verified, an adaptive Runge-Kutta method samples a trajectory from the given initial value and stops at a failed step instead of drawing across a singularity. A slope field draws a short segment in the direction (1, f) at each grid point, with equal lengths, and a click starts a numerical trajectory from that point.

Reading the input

Other versions of this example

These stay on this page so each version keeps the same explanation. Choose Try example to run a version in its Studio workflow, or copy it into the editable field below.

Exponential growth

The general solution is y(x)=C1*exp(x).

dsolve(diff(y(x),x)-y(x),y(x))

Direct integration

The general solution is y(x)=x^2+C1.

dsolve(diff(y(x),x)-2*x,y(x))

Harmonic oscillator

The general solution is y(x)=C1*cos(x)+C2*sin(x).

dsolve(diff(y(x),x,2)+y(x),y(x))

Growth rate 2

The general solution is y(x)=C1*exp(2*x).

dsolve(diff(y(x),x)-2*y(x),y(x))

Gaussian factor

The general solution is y(x)=C1*exp(x^2/2).

dsolve(diff(y(x),x)-x*y(x),y(x))

Initial value

y(0)=2 selects y(x)=2*exp(x).

dsolve(diff(y(x),x)-y(x),y(x),ics={y(0):2})

Try a change

Solve Equation classifies the equation, names the method, shows the integrals or the characteristic equation, and prints the general solution. Initial conditions are applied only after that solution is verified by substitution.

Edit and generate

Solve Equation opens the studio homepage and runs this field. Open in DGS Studio loads the same text and waits for you to generate it. The equation is sent once, as a query parameter.

Related examples