Scientific Hello World example

Consider this Scientific Hello World module (hw):
import math

def hw1(r1, r2):
    s = math.sin(r1 + r2)
    return s

def hw2(r1, r2):
    s = math.sin(r1 + r2)
    print 'Hello, World! sin(%g+%g)=%g' % (r1,r2,s)
Usage:
from hw import hw1, hw2
print hw1(1.0, 0)
hw2(1.0, 0)
We want to implement the module in Fortran 77, C and C++, and use it as if it were a pure Python module

previousnexttable of contents