Differential Equations using Sage

Derivative: A rate of Change of object w.r.t Time and Space.
Differentiation: The process of finding a derivative is called “differentiation”.
Differential Equation: A differential equation is a mathematical equation that relates some function of one or more variables with its derivatives. Differential equations arise whenever a deterministic relation involving some continuously varying quantities (modeled by functions) and their rates of change in space and/or time (expressed as derivatives) is known or postulated.
A differential equation is linear if the unknown function and its derivatives appear to the power 1 (products of the unknown function and its derivatives are not allowed) and nonlinear otherwise.
OrderThe order of a differential equation is given by the  highest derivative used.
Degree: The degree of a differential equation is given by the  degree of the  power of the highest derivative used.
Ordinary Differential Equation: An ordinary differential equation (ODE) is a differential equation in which the unknown function (also known as the dependent variable) is a function of a single independent variable. Ordinary differential equations are further classified according to the order of the highest derivative of the dependent variable with respect to the independent variable appearing in the equation. The most important cases for applications are first-order and second-order differential equations.
Partial Differential Equation: A partial differential equation (PDE) is a differential equation in which the unknown function is a function of multiple independent variables and the equation involves its partial derivatives.
The general solution of differential equations of the form  dy/dx = f(x)  can be found using direct integration.
Substituting the values of the initial conditions will give particular solutions.
 

Examples:

3

4

5

Here is the good demonstration of Differential equations and Differentiation.

Rather than solving it manually, we can solve it using Sage.

Sage (System for Algebra and Geometry Experimentation) :

Sage is mathematical software with features covering many aspects of mathematics, including algebra, combinatorics, numerical mathematics, number theory, and calculus.

Ways to use Sage:
  • Notebook Graphical Interface
  • Interactive Command Line
  • Programs  
  • Scripts

This link will help you to solve DE in Sage.

>>>We can Embed Sage with Tex using SageTex:<<<

The SageTeX package allows you to embed the results of Sage computations into a LaTeX document. It comes standard with Sage.

For its Installation, click here.

Example of SageTex file:

Using Sage\TeX, one can use Sage to compute things and put them into
your \LaTeX{} document.

Below is the example of Sage code with LateX:

 \documentclass{article}
 \usepackage{sagetex}
 \begin{document}
 Using Sage\TeX, one can use Sage to compute things and put them into
 your \LaTeX{} document.
 Here's some Sage code:
 \begin{sageblock}
 f(x) = exp(x) * sin(2*x)
 \end{sageblock}
 The second derivative of $f$ is
 \[
 \frac{\mathrm{d}^{2}}{\mathrm{d}x^{2}} \sage{f(x)} =
 \sage{diff(f, x, 2)(x)}.
 \]
 Here's a plot of $f$ from $-1$ to $1$:
 \sageplot{plot(f, -1, 1)}
 \end{document}

A sageblock environment typesets your code verbatim and also executes the code when you run Sage. \sage{foo}, the result put into your document is whatever you get from running latex(foo) inside Sage.  /sageplot is used to plot a graph.

How to run SageTeX code:
  • Run LaTeX on your .tex file
  • Run Sage on the generated .sage file
  • Run LaTeX again.

To read the documentation for SageTeX,

$ cd SAGE_ROOT/local/share/texmf/tex/generic/sagetex

SAGE_ROOT  is the path where you have installed Sage. In my system,  SAGE_ROOT = /home/jasleen/sage/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s