ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 20 Dec 2018 14:47:35 -0600Vector field: how to make arrows fine? (plot2d)http://ask.sagemath.org/question/44705/vector-field-how-to-make-arrows-fine-plot2d/I'm using the function arrow and I'm trying to have arrows fine like the one you can find on the wikipedia page of vector field, because the normal arrows in Sage are not enough fine for me. I looked at the manual and at the properties of arrows but I found nothing.
Thank you for any help :)
here is my code:
def champs_vecteur(f,L,n):
P = point((0,0))
for k in [-n..n]:
for l in [-n..n]:
i = L*k
j = L*l
(u,v) = f(i,j)
nor = sqrt(u*u+v*v)/L
if nor != 0:
u = u/nor
v = v/nor
P += arrow( (i-u/2,j-v/2) , (i+u/2,j+v/2) ,color="black", arrowsize=3,width=1)
show(P,aspect_ratio=1)
I use it like that
var('y')
h(x,y) = (-x-y,-y+x)
champs_vecteur(h,0.1,10)Tue, 18 Dec 2018 05:45:20 -0600http://ask.sagemath.org/question/44705/vector-field-how-to-make-arrows-fine-plot2d/Answer by tmonteil for <p>I'm using the function arrow and I'm trying to have arrows fine like the one you can find on the wikipedia page of vector field, because the normal arrows in Sage are not enough fine for me. I looked at the manual and at the properties of arrows but I found nothing.</p>
<p>Thank you for any help :)</p>
<p>here is my code:</p>
<pre><code>def champs_vecteur(f,L,n):
P = point((0,0))
for k in [-n..n]:
for l in [-n..n]:
i = L*k
j = L*l
(u,v) = f(i,j)
nor = sqrt(u*u+v*v)/L
if nor != 0:
u = u/nor
v = v/nor
P += arrow( (i-u/2,j-v/2) , (i+u/2,j+v/2) ,color="black", arrowsize=3,width=1)
show(P,aspect_ratio=1)
</code></pre>
<p>I use it like that </p>
<pre><code>var('y')
h(x,y) = (-x-y,-y+x)
champs_vecteur(h,0.1,10)
</code></pre>
http://ask.sagemath.org/question/44705/vector-field-how-to-make-arrows-fine-plot2d/?answer=44721#post-id-44721If you change the `arrowsize` to `1.5`, the picture looks close to what can be seen on wikipedia.
Thu, 20 Dec 2018 14:47:35 -0600http://ask.sagemath.org/question/44705/vector-field-how-to-make-arrows-fine-plot2d/?answer=44721#post-id-44721