Script hanging during plot of Runge-Kutta

Hi Eric,

   Ok I guess I have a bigger problem. The plot window opens,but nothing
is plotted. I thought that the blank window was because the code was
hanging and not plotting. I had it work once and plot, but now I just
get the blank window.

Khary,

(Please keep correspondence on the list so others can jump in, and whatever answer emerges is available to others.)

You need to provide more information: operating system, mpl version, backend, how you installed it.

Some systematic troubleshooting is also in order. Start here: http://matplotlib.sourceforge.net/faq/index.html.

Eric

···

On 02/19/2012 07:46 PM, Khary Richardson wrote:

Khary

On Mon, Feb 20, 2012 at 12:25 AM, Eric Firing <efiring@...202... > <mailto:efiring@…202…>> wrote:

    On 02/19/2012 07:08 PM, surfcast23 wrote:
     >
     > Hi I wrote the following script, but it hangs right after
    plt.show(). I would
     > really appreciate it if someone could take a look and let me know
    where I'm
     > messing up. Thanks in advance

    That's what show() does in a script--it displays the plot and blocks
    execution until you close the window. It can be more complicated than
    that depending on the version of mpl you are running. So, what version
    are you running, and what is the behavior you are trying to achieve? An
    animation?

    Eric

     >
     > from numpy import *
     > import matplotlib.pyplot as plt
     >
     > #H=p^2/2-cosq
     > #p=dp=-dH/dq
     > #q=dq=dH/dp
     >
     > t = 0
     > h = 0.5
     > pfa = #Create arrays that will hold
    pf,qf values
     > qfa =
     >
     > while t< 10:
     > q = 1+t
     > p = -sin(q+t)
     >
     > p1 = p
     > q1 = q
     > p2 = p + h/2*q1
     > q2 = q + h/2*p1
     > p3 = p+ h/2*q2
     > q3 = q+ h/2*p2
     > p4 = p+ h/2*q3
     > q4 = q+ h/2*p4
     > pf = (p +(h/6)*(p1+2*p2+3*p3+p4))
     > qf = (q +(h/6)*(q1+2*q2+3*q3+q4))
     > #pf = log10(pf) #Convert to log scale
     > #qf = log10(qf)
     > pfa.append(pf) #append arrays
     > qfa.append(qf)
     > t += h #increase time step
     >
     > print("test")
     > plt.plot(pfa,qfa)
     > print("test1")
     > plt.show()
     > print("tes2t")
     >

    ------------------------------------------------------------------------------
    Try before you buy = See our experts in action!
    The most comprehensive online learning library for Microsoft developers
    is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
    Metro Style Apps, more. Free future releases when you subscribe now!
    http://p.sf.net/sfu/learndevnow-dev2
    _______________________________________________
    Matplotlib-users mailing list
    Matplotlib-users@lists.sourceforge.net
    <mailto:Matplotlib-users@lists.sourceforge.net>
    matplotlib-users List Signup and Options

--
StriperCoast SurfCasters Club