Hi The function H t x takes two real numbers and return a real number. The python program is attached. You can run it with "python heatsim.py"and it produces a mp4 file called "im5.mp4"
Thanks for the help Jorge On Friday, August 10, 2018 at 5:43:52 PM UTC-3, Brent Yorgey wrote: > > Hi Jorge, > > (I have sent this to diagrams-discuss again, let's keep the discussion on > the mailing list so that others can also chime in if they have anything to > add, or learn from whatever is said.) > > I am still not quite sure I am understanding what you want to do. What > kind of function is H? I guess t is a real number? What type is x? And > what type does H return? Maybe sending the python program as an attachment > would be helpful (please also send clear instructions on how to run it). > > -Brent > > On Fri, Aug 10, 2018 at 2:56 PM Jorge Devoto <jorge.a...@gmail.com > <javascript:>> wrote: > >> I have a function H t x, The variable t is time and the variable x >> denotes ponts. I want to make >> an animation taking a series of times t_0 < t_1, < .... etc and plotting >> the sequence of functions >> H t_k x as functions of x. I have a program in python to do this but I >> would like to learn how to do >> it in Haskell. I can send you the python program if this helps- >> >> Thanks for the answer >> >> Best >> Jorge >> >> >> >> On Fri, 10 Aug 2018 at 12:39, Brent Yorgey <byo...@gmail.com >> <javascript:>> wrote: >> >>> Hi Jorge, >>> >>> I am not sure I understand what you mean by "evolution of the heath". >>> Can you elaborate, or give an example? >>> >>> -Brent >>> >>> On Fri, Aug 10, 2018, 9:47 AM Jorge Devoto <jorge.a...@gmail.com >>> <javascript:>> wrote: >>> >>>> Hello >>>> >>>> I am trying to make a simulation of the evolution of the heath >>>> using diagrams with animations. I can not find any example. >>>> >>>> Could anybody tell me where can I find examples? >>>> >>>> Any help is welcomed. >>>> >>>> Thanks in advanced. >>>> >>>> Jorge >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "diagrams-discuss" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to diagrams-discu...@googlegroups.com <javascript:>. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> -- You received this message because you are subscribed to the Google Groups "diagrams-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to diagrams-discuss+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
import matplotlib.pyplot as plt import numpy as np import matplotlib.animation as animation def b(k): s = (9.0/ (k * np.pi)) - (9.0/ (k * np.pi)) * np.cos(k * np.pi / 3.0) s += (3.0 / (k * np.pi)) * (np.cos(k * np.pi / 3) - np.cos(2 * k * np.pi / 3)) s += (12.0 / (k * np.pi)) * (np.cos(2 * k * np.pi / 3) - np.cos(k * np.pi)) return s def h(t, x): hf = 0 for k in range(1, 50): hf += b(k) * np.exp(-0.01 * t * (k * np.pi / 3.0)**2) * np.sin((k * np.pi / 3.0) * x) return hf fig, ax = plt.subplots() x = np.arange(0.0, 3.0, 0.01) line, = ax.plot(x, h(0, x)) Writer = animation.writers['avconv'] writer = Writer(fps=15, metadata=dict(artist='Me'), bitrate=1800) def animate(i): line.set_ydata(h(i * 0.1, x)) # update the data return line, def init(): line.set_ydata(np.ma.array(x, mask=True)) return line, ani = animation.FuncAnimation(fig, animate, np.arange(1, 1800), init_func=init, interval=25, blit=True, repeat=False) ani.save('im5.mp4', writer=writer) #plt.show()