desolve

## Description

`desolve` will compute the “general solution” to a 1st or 2nd order ordinary differential equation using Maxima. To solve the equation $x′+x−1=0$.

## Sage Cell

#### Code

```
t = var('t') # define a variable t
x = function('x')(t) # define x to be a function of that variable
DE = diff(x, t) + x - 1
desolve(DE, [x,t])
```

## Options

#### Option

You can use `ics` to specify an initial condition. For example, we can solve the initial value problem $x′+x−1=0$ with $x(0) = 2$.

#### Code

```
t = var('t')
x = function('x')(t)
DE = diff(x, t) + x - 1
desolve(DE, [x,t],ics=[0,2])
```

#### Option

Higher order equations such as second-order linear equations can be solved. The following commands solve $x'' + 2x' + x =\sin t$.

#### Code

```
t = var('t')
x = function('x')(t)
DE = diff(x,t,2)+2*diff(x,t)+x == sin(t)
desolve(DE, [x,t])
```

#### Option

Implicit solutions are returned for separable differential equations. Consider the solution to $\cos x \dfrac{dy}{dx} = \tan x$.

#### Code

```
x = var('x')
y = function('y')(x)
DE = diff(y,x)*cos(y) == tan(x)
desolve(DE, [y,x])
```

## Tags

Primary Tags: differential equations

Secondary Tags:

## Related Cells

- desolve_odeint. Solving ordinary differential equations numerically with
`desolve_odeint`. - Euler's Method.
`eulers_method`implements Euler’s method for finding a numerical solution of the first-order ODE $y′=f(x,y)$. - Euler's Method for Systems.
`eulers_method_2x2`implements Euler’s method for finding a numerical solution of a $2 \times 2$ system of first-order ODEs. - desolve_laplace. Solving ordinary differential equations using Laplace transforms.
- Interact to plot direction fields and solutions for first order differential equations. A Sage interact for plotting direction fields for differential equations.

## Attribute

Permalink:

Author: http://doc.sagemath.org/html/en/reference/calculus/sage/calculus/desolvers.html

Date: 08 Jul 2017 14:10

Submitted by: Tom Judson