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

We can specify initial conditions for second-order linear equations. The following commands solve $x'' + 2x' + x =\sin t$, $x(0) = 1$, $x'(0) = 0$.

Code

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

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

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

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License