I’m trying to animate a function with parameters, and it seems animate cannot handle a function definition, only the function description. For example, this works:
The “a” inside of Animate is a local variable, and it is not the same as the global “a” that appears in your function. You can pass the local “a” from the Animate into your function as a second argument.
If I understand correctly what you are trying to write, your first argument ot the Plot function is not calling your funciton p with any arguments. Also your function p is not explicitly a function of a.
Is this what you actually mean? (note the semicolon and the first argument of Plot)
Making a an argument of the function fixed the problem in the Animate, appreciated. Had no idea there were “local” and “global” concepts in the function definitions.