Python Forum
Simple animation -- time evolution of function - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: Simple animation -- time evolution of function (/thread-38759.html)



Simple animation -- time evolution of function - schniefen - Nov-20-2022

I would like to animate how a function evolves over time. I would like to do this using only plt.blablabla, not ax.blablabla. The function is defined as follows:

import numpy as np
from scipy import special

y_lim=0.5
alpha=1

def pulse(t, x):
    return 1/2*(special.erf((y_lim-x)/np.sqrt(4*alpha*t))-special.erf((-y_lim-x)/np.sqrt(4*alpha*t)))
Reasonable ranges for x and t are:

max_iterations=200
t=np.linspace(0.0001, 3, max_iterations)
x=np.linspace(-3,3, max_iterations)
I appreciate any help.