Well I did use your method but I still get an error.
Code:
r,z = var('r,z')
gro = 1.0
kro = 3.0
def f(r,z): term1 = (1+(bessel_J(0, gro)/bessel_J(2,gro)))*(r/
kro)*(bessel_J(1, r)/bessel_J(1,gro))*cos(z) term2 = -(bessel_J(0,r)/
bessel_J(2, gro))*(r**2/kro**2) return term1 + term2 if t != 0
This version works for me:
r,z = var('r,z')
gro = 1.0
kro = 3.0
def f(r,z):
term1 = (1+(bessel_J(0, gro)/bessel_J(2,gro)))*(r/
kro)*(bessel_J(1, r)/bessel_J(1,gro))*cos(z)
term2 = -(bessel_J(0,r)/bessel_J(2, gro))*(r**2/kro**2)
return term1 + term2
p = contour_plot(f , (r, 0, 2.5),
Hi!
I'm not sure what you mean by
Also if I have the terms, and return on separate lines in the
definition then I get this error.
You _have_ to have the different statements on separate lines, like I
did. (Unless you use a semicolon to separate the statements, I
suppose.) Did you combine
Everything worked once I placed semicolons after each line in the
definition of the function.
On Oct 21, 5:22 pm, D. S. McNeil dsm...@gmail.com wrote:
Hi!
I'm not sure what you mean by
Also if I have the terms, and return on separate lines in the
definition then I get this error.
You
A new issue came up.
program:
r,z = var('r,z')
gro = 1.0
kro = 3.0
def f(y,t): return (1+(bessel_J(0, gro)/bessel_J(2, gro)))*(r/
kro)*(bessel_J(1, r)/bessel_J(1,gro))*z.cos()-(bessel_J(0,r)/
bessel_J(2, gro))*(r**2/kro**2) if t != 0 else infinity
p = contour_plot(f , (r, 0, 2.5), (z, 0, 4),
def f(y,t): return (1+(bessel_J(0, gro)/bessel_J(2, gro)))*(r/
kro)*(bessel_J(1, r)/bessel_J(1,gro))*z.cos()-(bessel_J(0,r)/
bessel_J(2, gro))*(r**2/kro**2) if t != 0 else infinity
A few things:
(1) Your arguments to this function are y and t, but inside you use r
and z. r and z are still
I still get an error:
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');
File , line 1, in module
File /tmp/tmpZLCoKg/___code___.py, line 6
return (sqrt(t**_sage_const_2
SyntaxError: invalid syntax
You'll need to type the whole part after
def f(y,t):
in just one line, and similarly for the whole plot command. Google
groups tends to cut off things at a fairly short line length.
- kcrisman
--
To post to this group, send email to