Math Maniac's Musings

A Python Notebook with Sympy.

Sympy (Symbolic Python)

The equation $$\int_a^b f(x)\,dx = \lim_{n\rightarrow\infty} \sum_{i=1}^n f(x_i^*)\Delta x$$ defines the definite integral over the interval $[a,b]$.

In [16]:
from sympy import init_session
init_session()
IPython console for SymPy 0.7.5 (Python 2.7.6-64-bit) (ground ...

SIR Infection Model

In [1]:
%matplotlib inline
In [2]:
#import math
#import numpy
#from numpy import *
#import scipy
from scipy import integrate
from pylab import *
In [3]:
y = lambda x: x*sin(x)
print y(2)
1.81859485365

In [7]:
integrate.quad(y,0,3)
Out[7]:
(3.111097497861204, 3.4540120739792224e-14)
In [7]:
print integrate.quad(y,0,5)
print integrate.quad(y,0,20)
(-2.377235201979269, 9.62658877519353e-14)
(-7.248695985540208, 4.753140728230854e-10)

In [8]:
print...