2019-12-05 22:31:29 +0100 | received badge | ● Notable Question (source) |
2018-12-13 22:42:16 +0100 | received badge | ● Enthusiast |
2018-12-09 17:57:14 +0100 | received badge | ● Popular Question (source) |
2016-12-31 22:50:09 +0100 | received badge | ● Student (source) |
2016-12-31 22:30:25 +0100 | asked a question | Plotting 2d vector fields – how to delay function evaluation I want to plot, for example, the following 2d vector field: $$\vec{F}(x,y)= \begin{cases} (0.1,0.1), & \text{for }r\le d_{min}\newline \frac{\vec{r}}{r^3}, & \text{otherwise}. \end{cases}$$ In one SageMath cell I have defined corresponding Python function: In another cell, I use function However, function my_vector_field_2D(x,y) is evaluated before it is given to the function How can I prevent this function evaluation? I tried something that works with the But here this method does not work: TypeError: 'function' object is not iterable. My first why question: Why this does not work? It works for Then I found in the SageMath documentation that “when plotting non-symbolic functions, they should be wrapped in And the same error popped up: TypeError: 'function' object is not iterable. But this works: My second why question: Why do I need two |