dear friends i am facing the error below.
could you please help me how to solve it. thanks.

*error*

anim = FuncAnimation(fig, animate, frames=len(temperature)//skip, 
interval=20)

TypeError: 'module' object is not callable

-- 
You received this message because you are subscribed to the Google Groups 
"spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/spyderlib/26ae2086-7673-46f1-9086-b182c3fa0fe3n%40googlegroups.com.
# -*- coding: utf-8 -*-
"""
Spyder Editor

This is a temporary script file.
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as FuncAnimation
import IPython.display as display
D = 1e-5
L = 0.1
tmax = 100

x = np.linspace(0, 0.1, 101)
a = L/100

time = np.linspace(0, tmax, 10**4+1)
h = tmax/1e4

T = 50*np.ones(101) # initial conditions
T[0] = 0 # BCs
T[-1] = 100

temperature = []
for t in time:
    temperature.append(T.copy())
    T[1:-1] += h*D/a**2*(T[2:] + T[:-2] - 2*T[1:-1])

skip = 100

fig = plt.figure()
line, = plt.plot([], "r") 
plt.xlim(0, L)
plt.ylim(0, 100)

def animate(frame):
    y = temperature[frame*skip]
    line.set_data(x, y)
    
anim = FuncAnimation(fig, animate, frames=len(temperature)//skip, interval=20)
video = anim.to_html5_video()
html = display.HTML(video)
display.display(html)
plt.close()
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

Reply via email to