~jrjohansson/qutip/master

« back to all changes in this revision

Viewing changes to qutip/fstidy.py

  • Committer: Paul Nation
  • Date: 2011-04-21 04:46:56 UTC
  • Revision ID: git-v1:dd4c966b490aa468dfbd28cef66694df4bf235c8

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from fseries import *
 
2
 
 
3
def fstidy(fs,*args):
 
4
        '''FSTIDY tidies up a function series, removing small terms
 
5
        fs = fstidy(fs1,tol)
 
6
        fs1 is input function series. Terms with identical parameters are merged.
 
7
        Terms are deleted if amplitude is smaller than tol
 
8
        tol = [reltol,abstol]. Default tolerance is [1e-6,1e-6].'''
 
9
        if not any(args):
 
10
                tol=[1e-6,1e-6]
 
11
        if len(args)==1:
 
12
                args[1]=0
 
13
        numterms=fs.nterms()
 
14
        ftype=fs.ftype
 
15
        fparam=fs.fparam
 
16
        data=array([fs.series[k].full().max() for k in range(0,numterms)])
 
17
        Amax=data
 
18
        return Amax 
 
19
        
 
20