]> www.ginac.de Git - ginac.git/blob - ginac/function.py
More evaluation rules: abs(x^n) => abs(x)^n (x > 0, n is real).
[ginac.git] / ginac / function.py
1 #!/usr/bin/env python
2 # encoding: utf-8
3
4 maxargs = 14
5 methods = "eval evalf conjugate real_part imag_part derivative power series print".split()
6
7 import sys, os, optparse
8 sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'scripts'))
9 import yaptu
10
11 def seq(template, N, start = 1, separator = ', '):
12         return separator.join([ template % { 'n' : n } for n in range(start, N + start) ])
13
14 def main():
15         parser = optparse.OptionParser()
16         parser.add_option("-o", dest="outfile")
17         options, args = parser.parse_args()
18         cop = yaptu.copier(globals())
19         if not options.outfile is None:
20                 cop.ouf = open(options.outfile, 'wt')
21         inp = sys.stdin
22         if len(args) >= 1:
23                 inp = open(args[0])
24         cop.copy(inp)
25         if inp != sys.stdin:
26                 inp.close()
27         if cop.ouf != sys.stdout:
28                 cop.ouf.flush()
29                 cop.ouf.close()
30         return 0
31
32 if __name__== '__main__':
33         ret = main()
34         sys.exit(ret)
35