> Sage: y,t = var('y,t')
> Sage: contour_plot(lambda y,t: (sqrt(t^2+y^2)/(2*pi*y))*(bessel_J(0,
> t ).arccos()), (t, 0, 3), (y, 0, 4), fill = false, axes_labels=['$gro
> $','$kro$'], contours = [0.1, 0.2, 0.3, 0.5, 0.7, 1.0, 2.0, 4.0],
> fill=False, legend_label='qwall');
>
> This is the error message that I get when processing the code:
>
> The error I get is: File "<ipython console>", line 1 SyntaxError:
> keyword argument repeated (<ipython console>, line 1).
>
> Does it have something to do with assigning the variables?

It has to do with the fact you're repeating a keyword argument. :^)
Note that you write "fill=false" and then later "fill=False".

Also, be careful: when you use a Python function (lambda or def), you
can't use the (variable, lower, upper) syntax, you have to give them
in order.  Proof:

sage: aa = []
sage: bb = []
sage: def f(a,b):
....:         aa.append(a)
....:     bb.append(b)
....:     return a+b
....:
sage: a,b = var("a b")
sage: contour_plot(f,(b,2,3),(a,4,5))

sage:
sage: min(aa),max(aa)
(2.0, 3.0)
sage: min(bb),max(bb)
(4.0, 5.0)

And you see that f gets two variables ranging from 2 to 3 and 4 to 5,
but it doesn't put the "a" values in a.  (Aside for devs: we could fix
this using introspection.)

Finally, I found that I had to manually handle the zero case to avoid
getting a "Symbolic division by zero" error:

----
y,t = var('y,t')

def f(y,t):
    return (sqrt(t^2+y^2)/(2*pi*y))*(bessel_J(0,t).arccos()) if y != 0
else infinity

p = contour_plot(f, (y, 0, 6), (t, 0, 3), fill = false,
axes_labels=['$gro$','$kro$'], contours = [0.1, 0.2, 0.3, 0.5, 0.7,
1.0, 2.0, 4.0], legend_label='qwall');
show(p)
----

Hope some of that helps!


Doug

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to