printSoln module problem
<p>Hi I found in book:Numerical Methods in engineering with Python the module run_kut5, but for that module I need module printSoln, all provided in the book. Now I cp the code, made necessary line adjustments and so. The code looks like:</p>

<pre><code>  # -*- coding: cp1250 -*-
## module printSoln
''' printSoln(X,Y,freq).
    Prints X and Y returned from the differential
    equation solvers using printput frequency ’freq’.
        freq = n prints every nth step.
        freq = 0 prints initial and final values only.
'''

def printSoln(X,Y,freq):

    def printHead(n):
        print "\n  x ",
        for i in range (n):
            print " y[",i,"] ",
        print

    def printLine(x,y,n):
        print "%13.4e"% x,f
        for i in range (n):
            print "%13.4e"% y[i],
        print

    m = len(Y)
    try: n = len(Y[0])
    except TypeError: n = 1
    if freq == 0: freq = m
    printHead(n)
    for i in range(0,m,freq):
        printLine(X[i],Y[i],n)
    if i != m - 1: printLine(X[m - 1],Y[m - 1],n)
</code></pre>

<p>Now, when I run the program it says:</p>

<pre><code>line 24, in &lt;module&gt;
    m = len(Y)
NameError: name 'Y' is not defined
</code></pre>

<p>But I cp'd from the book :\ So now when I call the run_kut module I get the same error, no Y defined in printSoln...</p>

<p>I'm trying to figure this out but I suck :(</p>

<p>Help, please...</p>
